title: Custom post type tags not showing in search

text: I have a number of custom post types for which the admin can tag each separate posts. The problem : None of the posts show upon front-end search query with any of the tags... Is this normal ? have I not configured my custom type properly ? below my post type registration:               $args = array(     'labels'             => $labels,     'public'             => true,     'publicly_queryable' => true,     'show_ui'            => true,     'show_in_menu'       => true,     'query_var'          => true,     'taxonomies'         => array('post_tag'),     'rewrite'            => array( 'slug' => 'enseigne' ),     'capability_type'    => 'post',     'has_archive'        => true,     'hierarchical'       => false,     'menu_position'      => 7,     'menu_icon'          => $theme_url . '/images/enseignes16x16.png',       'supports'           => array( 'title', 'author', 'editor', 'thumbnail','comments')  );     register_post_type( 'enseigne', $args );


title: Edit/Customize the Single Page of a Genesis Sample Child Theme

text: I got my 'Page' and 'Blog List' Page working.. But when i click on one of my Post... the Layout is different .. I want to edit it. Where can i find that? I tried to edit it..               <?php     /*      WARNING: This file is part of the core Genesis framework. DO NOT edit      this file under any circumstances. Please do all modifications      in the form of a child theme.      */          /**      * This file handles posts, but only exists for the sake of      * child theme forward compatibility.      *      * This file is a core Genesis file and should not be edited.      *      * @category Genesis      * @package  Templates      * @author   StudioPress      * @license  http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later)      * @link     http://www.studiopress.com/themes/genesis      */          genesis();      I guess this isnt the correct file to edit.. What should i do...


title: WP Super Cache All Pages

text: I didnt find it but is it possible to run at night all pages so the next morning the whole website is cached? Or are there other plugins who does this job? I hope someone can help me! Thanks!


title: Using pagination with multiple loops causes it to break

text:
I'm have two loops on my index page. One fetches the latest posts from the 'work' category and the other fetches the latest from the 'blog' category. (see below) I am also using a plugin called WP-PageNavi - http://wordpress.org/extend/plugins/wp-pagenavi/. I only want the pagination on the blog section which I have at the moment and it works fine for that. The problem is that when I click on to page 2 or 3 on the pagination the 'work' section also goes to the next page but there isnt enough posts so i see the "sorry, no posts" message. How do i get the pagination to just affect the 'blog' section? The other problem is that when I goto the 'blog' category page and click on the pagination there (or the 'view older posts', i tried both) it sends me to this url               http://localhost:8888/blog/page/2/       which results in a 404 as it is inserting 'blog' in the url. But if i remove 'blog' so goto               http://localhost:8888/page/2/       It then sends me to the index page and using the pagination on the index page. If it helps my permalink structure is:                /%category%/%postname%/      Here is my code... First Loop for 'work' section:               <?php query_posts ($query_string . '&category_name=work'); ?>           <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                  <?php                  // check if the post has a Post Thumbnail assigned to it.             if ( has_post_thumbnail() ) {                 the_post_thumbnail('latest-work');  // Other resolutions             } else {                 //No featured image supplied so use default.             ?>                      <img src="<?php bloginfo('template_url'); ?>/img/default.png" width="300" height="200"/>                  <?php   }   ?>
<a href="<?php the_permalink() ?>"><?php the_title(); ?>

<?php $key="client"; echo get_post_meta($post->ID, $key, true); ?>

                 <?php endwhile; else: ?>
Sorry, no posts matched your criteria.
                 <?php endif; ?>      Second loop for 'Blog' section:               <?php query_posts( array( 'cat' => 6, 'paged' => get_query_var('paged') ) ); ?>                <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<a href="<?php the_permalink() ?>"><?php the_title(); ?>
                     <?php the_excerpt(); ?>                 <a class="readmore" href="<?php the_permalink() ?>">

                 <?php                      // check if the post has a Post Thumbnail assigned to it.                 if ( has_post_thumbnail() ) {                     the_post_thumbnail('latest-work');  // Other resolutions                 } else {                     //No featured image supplied so use default.                 ?>                      <img src="<?php bloginfo('template_url'); ?>/img/default.png" width="300" height="200"/>                 <?php   }   ?>

           <?php endwhile; else: ?>
Sorry, no posts matched your criteria.
                 <?php endif; ?>          <?php wp_pagenavi(); ?>


title: Split multiple categories into two columns

text:
What is the best way to split multiple categories into two columns on the page? At this moment I don't need category-A to go into column-1 and category-B/C/D to go into column-2. I just need multiple categories to spilt in to two columns irrespective of what they are. the code for the page currently looks like:               <?php get_header(); ?>
         <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                  <article <?php post_class() ?> id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>"><?php the_title(); ?>
                 <?php include (TEMPLATEPATH . '/_/inc/meta.php' ); ?>
                     <?php the_content(); ?>
                                      <?php the_tags('Tags: ', ', ', '
'); ?>                     Posted in <?php the_category(', ') ?> |                      <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
                  <?php endwhile; ?>             <?php include (TEMPLATEPATH . '/_/inc/nav.php' ); ?>              <?php else : ?>
Not Found
              <?php endif; ?>
          <?php get_sidebar(); ?>     <?php get_footer(); ?>      Thanks


title: How can i change the texts of plugin (created by me) in wordpress admin?

text: i have a created a contact us plugin, i want to change that name of the plugin "contact us" in Hindi. I already created languages folder in my wordpress, and maintaining hi_IN.mo, hi_IN.po files.


title: Array to modify post titles

text: Could this be converted into an array:               function manipulate_post_title($title){     global $post;     if ($post->ID == 1) {$title = $title.'suffix';}     if ($post->ID == 2) {$title = $title.'different_suffix';}     }     add_filter ('the_title','manipulate_post_title',10,1);      Something like:               '1' => $title.'suffix',     '2' => $title.'different_suffix'      New version based on your code (doesn't work):               function manipulate_post_title($title){     global $post;     $title = get_the_title();          $title_array = array(     '1' => $title.'suffix',     '2' => 'prefix'.$title,     '3' => 'completely different title'     );            if ( is_single() && isset($title_array[$post->ID]) ) {         $title = $title_array[$post->ID];       }            return $title; // Don't forget the return value!               }     add_filter ('the_title','manipulate_post_title',10,1);


title: I cannot log into my wordpress site with my wp-login.php

text: I can login into wordpress.com - but I cannot login to to my hosting wordpress site: http://www.hunterbaby.com.au/wp-login.php When I try to reset password it only recognises my wordpress username - but not my existing emails that are linked with my wordpress account? So I'm unable to send a reset password link. Please help!


title: Can't edit pages and posts since https (ssl)

text: I have a SSL certificate for my WordPress site and it is working. I'm using this WordPress HTTP (SSL) plugin: http://wordpress.org/plugins/wordpress-https/ First my website was very very slow but after I changed my WordPress settings to https:// it was over. It's still a bit slower but working ok. I almost thought everything was ok but I was wrong. I can't edit any pages or posts anymore! I can open the editor and make changes but when I want to save them I get redirected to a page that says something like: "Are you sure you want to do this?" When I press "Try Again" it pops back to the editor but nothing has changed. I allready disabled the HTTPS (SSL) plugin but still no luck. How can I fix this and am I the only one with this problem? I really need to edit my pages and posts. Any help would be very welcome:)


title: What is a good alternative to using $content_width for image optimization?

text: The `$content_width` GLOBAL in WordPress effects many themes and even some plugins by limiting the size of images and embeds in posts, it is a requirement for themes submitted to wordpress.org. It is set by using:               $content_width = 584; // Twenty Twelve example      If you insert a large image (default 1024x1024) into a post it results in:               src="../wp-content/uploads/2013/02/IMG_1390-1024x682.jpg" width="584" height="328"      If instead you remove this global setting and insert the actual image size, set with `add_image_size` it results in:               src="../wp-content/uploads/2013/02/IMG_13901-584x328.jpg" width="584" height="328"       Removing the global and inserting large images, _which is very common_ , often results in a saving of over 2x, in pages with multiple images I see **hundreds of KB** saved on page load. Is using `add_image_size` and removing the ability to insert full size images not a better option? ps. I wrote about it here with more accurate data


title: Odd behaviour with submenu link creation

text: I'm trying to develop a plugin that needs to add two pages to the dashboard side-bar menu. One of these being a main category. Everything is fine, except for the second submenu item for the settings page. After perusing just about as much of the codex and searching the web for similar issues I've come up with no solution. Am I missing something with this? (first submenu is to create the duplicate landing page, of course) ## Code               add_action('admin_menu', 'my_add_submenu');     function my_add_submenu(){         add_menu_page( 'Author Discussion', 'Discussion', 'manage_options', 'author_discuss', 'author_discuss_build_page', plugins_url( 'author-discussion/images/icon.png' ), 999 );         add_submenu_page( 'author_discuss', 'Author Discussion', 'Author Discussion', $menu_capability, 'author_discuss' );         add_submenu_page( 'author_discuss', 'Author Discussion Settings', 'Settings', 'manage_options', 'author_discuss_settings', 'author_discuss_settings_page' );     }          function author_discuss_build_page(){         //do something     }          function author_discuss_settings_page() {          //do something     }      ## Effect One thing I notice, when I go to click on the link in the side-bar it redirects to:   * **/wp-admin/author_discuss_settings**   * instead of **/wp-admin/admin.php?page=author_discuss_settings** I feel like I'm missing something obvious. ## What Have I tried? I followed the final example on the WordPress Codex located here. I have tried changing the action from `admin_menu` to `admin_init` to see if that would change the result. The URL prints as expected then, **/wp- admin/admin.php?page=author_discuss_settings** but throws a "You do not have sufficient permissions error."


title: Share same domain for wp-admin but for different website

text: I have site like   * `http://www.foo.com`   * `http://www.bar.com` And I've a wildcard SSL cert `*.example.com`, instead of buying two SSL certs for the above two domains, can I re-use my existing wildcard SSL cert for wp- admin? e.g.   * `http://foo.example.com`   * `http://bar.example.com` Only for `wp-admin` for better security, is it possible?


title: Adding menu items?

text: I'm having a couple issues I can't resolve with my Wordpress site. First of all, I'm using "Weaver II 1.1.3" theme, free version. I recently installed Role Scoper (http://agapetry.net/news/introducing-role-scoper/), to try to manage the people that update my site. In 'Role Scoper', I can control who edits on each page so I made a group that could edit (not publish), and a group that had control to edit AND publish, both ONLY within their department, thus not giving some people the right to actually publish their content (department heads are supposed to "approve" what has been edited by the people below them). I had all of this set up, and when testing with the lower user level, I edited a page and saved as "Pending Review". When I opened the actual page up, it had added all of the children items underneath that page to my main menu on each page (completely screwing up the whole page). I logged into the next-highest level (department head level), and approved the edit... only for the page to go back to how it used to be (with the edits I made, nonetheless), the menu not messed up anymore. My process is okay... and I accomplished what I wanted, but during that span of time where something hasn't been approved, my menu is going to be adding children items that don't fit, until this is fixed. Any ideas? Sometimes Wordpress has a mind of its own.


title: How to create a dropdown on admin panel and print that value on a page or in a post?

text: Now I am using a custom field for this purpose. But now my client asking some thing like this. Let's say he has to display a car brand on every bottom of a post. **The Car Is : Car Name** Car Name must be replaced by the drop down menu options which is on admin panel.               <select>       <option value="volvo">Volvo</option>       <option value="saab">Saab</option>       <option value="mercedes">Mercedes</option>       <option value="audi">Audi</option>     </select>       If he selects volvo from the admin panel (bottom of the editor) then "car name" must be replaced on the page or in the post where the code applied. How can I do that?


title: Disable Or Redirect WP-login.php

text: Is there a way to prevent visitors, whether logged in or not, from reaching `mysite.com/wp-login.php`? I have a separate login form which is all we need. I know I can re-style the form generated by `wp-login` but I'd rather not have to deal with it at all. I've tried various filters and hooks and I can't seem to get it to redirect. I also tried using a `.htaccess` redirect and I found that this works, but then it prevents my custom login/logout form from working. Ideas?


title: is it possible to force wordpress to always save thumbnails as 'jpg' not 'png'

text: I cant see any settings and cant see much in the php api docs regarding this? for instance if the original file upload is a `png` wordpress converts to `jpg`


title: Google AdSense Ad not showing up in WordPress Blog

text: I cannot get a Google AdSense ad to show up in a WordPress blog I'm working on. The ads have been approved and I entered the code (and double-checked the code to make sure I had it right). The code is as follows:               <div id="ads_sidebar">     <script type="text/javascript"><!--     google_ad_client = "ca-pub-7308560787788569";     /* Makeup */     google_ad_slot = "0956930336";     google_ad_width = 120;     google_ad_height = 600;     //-->     </script>     <script type="text/javascript"     src="http://pagead2.googlesyndication.com/pagead/show_ads.js">     </script>     </div>      The comments (i.e. `<!--`) were part of the code that Google provided. I tried without those as well and it didn't work. The CSS for the div is as follows:               #ads_sidebar{     position:absolute; top:0; left:-190px; background:transparent; font:normal 12px/14px      "Trebuchet MS","Lucida Grande","Lucida Sans Unicode",Arial; padding:20px 20px 30px 5px;      display:inline; float:left; _margin:0 auto; height:600px; width:120px;     }      I know the div shows correctly because I tested the code with a `border:1px solid black;` and it displayed on the screen. I also know that sometimes Google Ads don't show up to the owner of the account if you're signed in so I tried from a different browser. Still no luck. Anybody have any ideas why it hasn't shown up? Thanks.


title: How can set all big title in URL

text: I have error in permalink, I have post that title is big like :-               Tesla will reportedly build its EV battery 'giga factory' in Nevada      Now when open the post in my site i see permalink like :-               www.domain.com/tesla-will-reportedly-build-its-ev--batter      But i set the permalink structure is `/%postname%/`. Why its not get all post title ?


title: Unregistering a Sidebar in Child Theme

text:
I'm working with a handy responsive theme framework (Reverie) and I'm developing my own theme the right way using a Child theme. The Parent theme calls a sidebar called with an ID of 'Footer' and applies some basic styles to it. I want to adjust this in my child theme, so I was looking at perhaps filtering it but in the end I decided it'd probably be easiest to unregister the sidebar and re-register a new one with the proper classes in childtheme's functions.php. Here's the code from the parent theme which declares the sidebar               $sidebars = array('Footer');     foreach ($sidebars as $sidebar) {         register_sidebar(array('name'=> $sidebar,             'id' => 'Footer',             'before_widget' => '

',             'after_widget' => '

',             'before_title' => '
',             'after_title' => '
'         ));     }      Yet, I'm not able to de-register the sidebar. I've attempted it, with the code below, but without any luck..               // Unregisters Reverie footer sidebar      function remove_footer(){         unregister_sidebar( 'Footer' );     }     add_action ('widgets_init, remove_footer', 11);          // Registers new footer array with proper classes          $sidebars = array('Childfeet');     foreach ($sidebars as $sidebar) {         register_sidebar(array('name'=> $sidebar,             'id' => 'Childfeet',             'before_widget' => '

',             'after_widget' => '

',             'before_title' => '
',             'after_title' => '
'         ));     }      My new sidebar with proper classes is of course created, but it seems like my remove_footer() does not do it's job. Any ideas? I have checked out all the other 'unregistering sidebar' posts here in the forums, but these all contain errors in functions which I can't see in my code. Thanks a bunch for your time!


title: How can I search the post title and tag using WP_query of wordpress?

text: I am currently implement a search function to **search the post from wordpress** I would like to **search the post by Tag , by title and return it as JSON** I found a plugin that generate the result as JSON (JSON API) http://wordpress.org/plugins/json-api/other_notes/#2.1.-Core-controller- methods In that plugin , there is a get_posts function that can return the query that support WP_query parameter I tried a query like that ttp://MyWordpressSite.com/?json=get_posts&status=published&orderby=date&order=DESC&lang=en&s=eng&tag=eng&cat=9,10,14,15 where the &s= is the keyword to search while the &tag= is the tag to search However, there are two problem   1. How can I limit the search to title only? http://codex.wordpress.org/Class_Reference/WP_Query#Search_Parameter From the official website, it state search keyword ,but not limit to title only   1. It seems the condition is tag "AND" keywords are match, but what I would like to achieve is tag "OR" keywords are match So, to sum up , the goal is to search the post by Tag , by title and return it as JSON (actually is call the php through JSON), it doesnt matter using the plugin or not, any way achieve the goal is welcomed. Thanks for helping


title: Redirecting same form to different pages after successful submission

text: I am creating a Website in WordPress using Contact Form 7. In my site I have several documents on different pages. In order to access those documents, first the user has to fill out a form and then he/she will receive a mail with a link to access that PDF.   My Question is - how can I redirect the form after successful submission to the original page and please remember that I have different pages and all of them are using the same form...


title: Media Attachment Custom Meta Fields not saving in Media Uploader when using jQuery UI Autocomplete

text: I am trying to write a plugin that adds a custom meta field to image attachments to give images a credit field. I use the 'attachment_fields_to_edit' and 'attachment_fields_to_save' filters.               function hrld_attachment_field_credit( $form_fields, $post ) {      $value = get_post_meta( $post->ID, '_hrld_media_credit', true );      $form_fields['hrld_media_credit']['label'] = 'Media Credit';      $form_fields['hrld_media_credit']['input'] = 'html';      $form_fields['hrld_media_credit']['html'] = '<input type="text" class="text hrld_media_credit_input" id="attachments-'.$post->ID.'-hrld_media_credit" name="attachments['.$post->ID.'][hrld_media_credit]" value="'.$value.'">';      $form_fields['hrld_media_credit']['helps'] = 'If photo was taken by a Herald photographer, use their username. e.g. "Bucky Badger" You should write "bbadger".';          return $form_fields;     }          add_filter( 'attachment_fields_to_edit', 'hrld_attachment_field_credit', 10, 2 );      The above adds the input field.               function hrld_attachment_field_credit_save( $post, $attachment ) {     if( isset( $attachment['hrld_media_credit'] ) )         update_post_meta( $post['ID'], '_hrld_media_credit', $attachment['hrld_media_credit'] );          return $post;     }          add_filter( 'attachment_fields_to_save', 'hrld_attachment_field_credit_save', 10, 2 );      And the above triggers saving the meta data. The issue arises when editing a post and you click the "Add Media" button to add an image. When changing meta data on an image within this media uploader frame, such as caption or alt text, wordpress will auto save the data when the text field will lose focus. My meta data also saves similarly with no issue. I added a filter to 'image_send_to_editor' to automatically add the credit field inside a caption tag if the credit data is present.               function hrld_media_credit_send_editor($html, $id, $caption, $title, $align, $url, $size){         $html = get_image_tag($id, '', $title, $align, $size);         $hrld_credit = get_hrld_media_credit($id);         if(isset($hrld_credit) && !empty($hrld_credit)){             if(get_user_by('login', $hrld_credit)){                 $hrld_user = get_user_by('login', $hrld_credit);                 $html_text = 'Photo by '.$hrld_user->display_name.'.';             } else{                 $html_text = ''.$hrld_credit.'.';             }             if($caption){                 $html = get_image_tag($id, '', $title, $align, $size);                 $html .= $html_text;             } else{                 $attach_attributes = wp_get_attachment_image_src($id, $isze);                 $html = '[caption id="attachment_'.$id.'" align="'.$align.'" width="'.$attach_attributes[1].'"]';                 $html .= get_image_tag($id, '', $title, $align, $size);                 $html .= $html_text;                 $html .= '[/caption]';             }         }     return  $html;     }     add_filter( 'image_send_to_editor', 'hrld_media_credit_send_editor', 10, 7 );      Again so far things work as expected. The functionality I want is to use jQuery UI Autocomplete to suggest user logins as the user types, but I want to keep the input field free form text because an image credit does not have to be a user in wordpress. I use this javascript to add the autocomplete function to each field.               jQuery("body").on("keydown", ".hrld_media_credit_input", function(){     var hrld_media_input = jQuery(this);     hrld_media_input.autocomplete({         source: hrld_user_tags,         select: function (event, ui) {             console.log(hrld_media_input);             hrld_media_input.attr("value", ui.item.value);         }       });     });      The reason i use .on() is that when using the "Add Media" button, it creates the input fields dynamically, so without the .on(), it will only apply the autocomplete on page load, which those input fields wont have existed yet.(I have omitted a bit of php code that queues this script as well as creates the hrld_user_tags variable, which is just an array of usernames). Now, when using autocomplete to select a suggested username, clicking on that name to populate the field, wordpress will not auto save that meta data. If I hit insert to post, it will not be put into a caption tag, as if I never entered a username. However, If I type into the field and see that "example" is a suggestion, if instead of clicking the suggestion to autocomplete the field, i finish typing out "example" by hand, then press "Insert to Post," it saves the metadata "example" and will insert it into a caption tag. I have searched for hours for answers to this problem, looked into wp-includes and wp-admin core files trying to find functions to apply filters or add actions to trigger saving my data, but cannot figure this out. Any help or insights to this problem will be greatly appreciated.


title: Entirely Different Functions.php per Page?

text: Is it possible via conditionals to load entirely different functions? i.e in the functions.php you have a conditional that loads in an include for the old functions, then another that loads in the new? The reason for this is a site is taking on a new look but only page by page, the old styles and functions are a mess and need replacing but i cannot just remove them as the rest of the site will fail.


title: dbDelta ALTER TABLE syntax?

text: Due to some changes in the DB, I need to alter a table to add one column to it, but even though the function is running, the table isn't altered. Here's the ALTER TABLE code that I've written               $sql = "ALTER TABLE " . $packagetable . " ADD COLUMN price decimal(14,2) NOT NULL AFTER description;";     dbDelta($sql);      I couldn't find the syntax for ALTER TABLE with dbDelta anywhere online. EDIT: After looking at the ALTER TABLE statement in gravity forms plugin, I have updated the statement in single line.


title: Translated words not showing child theme

text: I created a child theme for the twentyfourteen theme which I'm also busy translating into Afrikaans. I've named the file > pietergoosen-af_AF.po and placed it into the languages file and I've added the following into my respective files functions.php and wp-config.php                   function pietergoosen_language_file_registration() {         load_child_theme_textdomain( 'pietergoosen', get_stylesheet_directory() . '/languages' );     }     add_action( 'after_setup_theme', 'pietergoosen_language_file_registration' );      and               define('WPLANG', 'af_AF');      All the plugins I've translated shows the Afrikaans words, but my theme not. I've checked out all tutorials and answers on this site, but can't get the thing to work. To assist, here are the headers for my stylesheet and po file                  /*     Theme Name:             pietergoosen     Theme URI:              http://pietergoosen.com     Description:            Spesiaal geskep deur Pieter Goosen vir sy webtuistes.     Author:                 Pieter Goosen     Author URI:             http://pietergoosen.com     License:                GNU General Public License v2 or later     License                 URI: http://www.gnu.org/licenses/gpl-2.0.html     Template:               twentyfourteen     Version:        1.0     */          @import url("../twentyfourteen/style.css");      and                  msgid ""     msgstr ""     "Project-Id-Version: Pieter Goosen v1.0\n"     "POT-Creation-Date: 2014-02-03 19:25+0200\n"     "PO-Revision-Date: 2014-02-03 21:32+0200\n"     "Last-Translator: Pieter Goosen <goosen_p@yahoo.com>\n"     "Language-Team: Private <goosen_p@yahoo.com>\n"     "Language: af\n"     "MIME-Version: 1.0\n"     "Content-Type: text/plain; charset=UTF-8\n"     "Content-Transfer-Encoding: 8bit\n"     "X-Generator: Poedit 1.5.5\n"     "X-Poedit-KeywordsList: gettext;gettext_noop;__;_e;_n:1,2;_x:1,2c;_ex:1,2c\n"     "X-Poedit-Basepath: .\n"     "Plural-Forms: nplurals=2; plural=n != 1;\n"     "X-Poedit-SourceCharset: UTF-8\n"     "X-Poedit-SearchPath-0: ..\n"          #: ../404.php:17     msgid "Not Found"     msgstr "Niks gevind"      Here is the header for my pietergoosen.pot and the first string                msgid ""     msgstr ""     "Project-Id-Version: Pieter Goosen v1.0\n"     "POT-Creation-Date: 2014-02-03 19:19+0200\n"     "PO-Revision-Date: 2014-02-03 19:22+0200\n"     "Last-Translator: Pieter Goosen <goosen_p@yahoo.com>\n"     "Language-Team: Private <goosen_p@yahoo.com>\n"     "MIME-Version: 1.0\n"     "Content-Type: text/plain; charset=UTF-8\n"     "Content-Transfer-Encoding: 8bit\n"     "X-Generator: Poedit 1.5.5\n"     "X-Poedit-KeywordsList: gettext;gettext_noop;__;_e;_n:1,2;_x:1,2c;_ex:1,2c\n"     "X-Poedit-Basepath: ..\n"     "Plural-Forms: nplurals=2; plural=n != 1;\n"     "Language: English\n"     "X-Poedit-SourceCharset: UTF-8\n"          #: ../404.php:17     msgid "Not Found"     msgstr ""


title: Cannot modify a registered custom post type rewrite slug

text: I'm using this function in my child theme to modify the rewrite slug from custom post type that was registered on the parent theme. But it doesn't work.               function change_rewrite_rules() {         global $wp_post_types;         $rewrite = $wp_post_types['holiday']->rewrite;         $rewrite['slug'] = '%holiday_category%';     }     add_action( 'after_setup_theme', 'change_rewrite_rules' );      Is there something wrong here? Ps: I cannot touch the parent theme since it's a commercial one and it will get updated often. **Update:** I also have these functions:               add_filter('post_link', 'territorio_permalink', 10, 3);     add_filter('post_type_link', 'territorio_permalink', 10, 3);          function territorio_permalink($permalink, $post_id, $leavename) {     if (strpos($permalink, '%holiday_category%') === FALSE) return $permalink;          // Get post     $post = get_post($post_id);     if (!$post) return $permalink;          // Get taxonomy terms     $terms = wp_get_object_terms($post->ID, 'holiday_category','orderby=term_order');     if (!is_wp_error($terms) && !empty($terms) && is_object($terms[0]))     $taxonomy_slug = $terms[0]->slug.'/'.$terms[1]->slug; //build here     else $taxonomy_slug = 'not-yet';          return str_replace('%holiday_category%', $taxonomy_slug, $permalink);     }


title: Will I lose the pages I've created within a default Wordpress theme when adding a new theme?

text: Will I lose the pages I've created within the default Wordpress theme when adding a new theme or will a new theme accommodate the same structure and content already created. I'm new to Wordpress and can't find the answer on Google.


title: Backend of the WordPress.com

text: It has been known that PHP is under an impression that its a web low performer. However, the size of WordPress.com says otherwise. Does anyone knows why WordPress.com blogs scale so well even though its in PHP? Where is the PHP's maximum. Lets say capacity of simultaneous user access? Thank You


title: Adding attributes to HTML tags in Contact Form 7

text: I want to validate a phone number and make sure the user enters all 10 digits. This can be done using the HTML5 pattern atribute:               <input pattern=".{10,}" title="10 characters minimum">      How can I add this pattern attribute to my input tag in Contact Form 7 ? This what the mobile number input shortcode looks like: `[text* mobile id:field-mobile]`


title: Menu - custom structure

text:
HOME

back to hompage

PORTFOLIO

view our work

      Is there any way to implement this code into wordpress with this structure ? * * * `header.php` codes:               <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>      `functions.php` codes:               <?php              register_nav_menu( 'primary', __( 'Primary Menu' ) );          ?


title: Function to rewrite URl in Wordpress

text: I need to rewrte this URL `http://example.com/news/?news_id=2` to `http://example.com/news/2` where news is the page and 2 is the `news_id` **I have added following code in functions.php:**               function add_news_rewrite_rule() {         add_rewrite_tag("%news_id%", '([^/]*)');         add_rewrite_rule('^news/([^/]*)/?','index.php?pagename=news&news_id=$matches[1]','top');         }     add_action( 'init', 'add_news_rewrite_rule' );          function my_insert_query_vars( $vars ){         array_push($vars, 'news_id');         return $vars;     }     add_filter( 'query_vars','my_insert_query_vars' );       And I am using **`$wp_query->query_vars['news_id']`** instead of **`$_GET['news_id']`** to pull out the data from database. But this is not working. Please help me.


title: Insert functions-defined constant into get_tags code

text:
I'm using the below code from WordPress' get_tags Function Reference page                   $tags = get_tags();         $html = '
';         foreach ($tags as $tag){               $tag_link = get_tag_link($tag->term_id);                     $html .= "name} Tag' class='{$tag->slug}'>";               $html .= "{$tag->name}";}         $html .= '
';         echo $html;      In my functions.php file I have a number of defined constants.                define('xyz_city','New York');      I need to insert a constant into the tag link title (line 5 of above code). So instead of .....                   title='{$tag->name} Tag'      it needs to be .....                   title='{$tag->name} [insert xyz_city]'      But it's proving beyond my ability. Normally I echo the constants in like this                   <?php echo xyz_city ;?>


title: Adding Categories Through Function

text: I am creating a template theme for WP and am wondering if there is a way of the theme adding new categories to the db, through the functions.php upon activation of the theme. It seems like a fairly straight forward thing to do, and can quite easily be done to post formats. Of course its simple enough to tell the end users what categories they'll need to add once the have activated the theme, but I was wondering if that could be a step we could just miss out. Anyways, thanks for your help, and give me a slap if there is an obvious answer :) Matt


title: Post thumbnail not working after regenerate

text: I have this setting in function.php               add_image_size( 'thumbnail-gallery', 185, 185, true );      It will display a square picture. Everything is fine before I regenerate new size using "Regenerate Thumbnails" plugin. After the process finished, the `<?php the_post_thumbnail( 'thumbnail-gallery' ); ?>` will return the original "big" url instead the regenerate url. it does not crop. original file url. not square.


title: Building Menus with the latest posts included

text: Im looking to build a menu system much like that off the huffington post or washington post, with links on one side and the latest articles or other dynamic content on another. Before i go crazy and try this, does anyone know if there are plugins that provide this functionality, i cannot find any but maybe some of you awesome folks know of some? Thanks in advance,


title: How secure is a wp-config file?

text: Considering the information that is in the wp-config file, how secure is this file? I have password salts in place, but can someone view this file? Or to what level of difficulty can some view the contents?


title: Re-order media links?

text: I'm trying to re-order the links in the media box when selecting an image. I want to move "Use as featured image" above the insert into post button. I also want to rename the "Use as featured image" text? I have done this by editing the media.php file in wp-admin/incudes/media.php but I don't want to edit this everytime I upgrade. Is it possible to re-order the elements without having to re-write the whole function? Thanks in advance. EDIT: Basically I want to move the text above the button and maybe add a label on the left too like the others above. I also want to rename the text "use as featured image". ![enter image description here](http://i.stack.imgur.com/3GOPd.jpg) EDIT Thanks to goto10 for helping me get this far, the code below "works" as it changes the text and location of the featured image. Although as I cannot get the attachment ID, it will not save the image...it works by manually typing in the attachment ID.               function custom_attachment_fields_to_edit($form_fields, $post) {         $form_fields['buttons'] = array(             'label' => 'Banner Image',             'value' => '',             'input' => 'html'         );         $thumbnail = '';         $calling_post_id = 0;         if (isset($_GET['post_id']))             $calling_post_id = absint($_GET['post_id']);         elseif (isset($_POST) && count($_POST))             $calling_post_id = $post->post_parent;              $attachment_id = ???                      $ajax_nonce = wp_create_nonce( "set_post_thumbnail-$calling_post_id" );         $form_fields['buttons']['html'] = $thumbnail = "Set as Banner Image";              return  $form_fields;     }          add_filter('attachment_fields_to_edit', 'custom_attachment_fields_to_edit', 11, 2);       Tried these to get attachment ID :               $args = array('post_type' => 'attachment', 'post_parent' => $_GET['post_id'] );              $attachments = get_posts($args);             if ($attachments) {                 foreach ( $attachments as $attachment ) {                     $attachment_id = $attachment->ID;                 }             }          $attachment_id = get_post_meta($_GET['post_id'], '_wp_attachment_image_id', true);     $attachment_id = get_post_meta($_GET['post_id'], '_wp_attachment_url', true );      Also tried replacing `$_GET['post_id']` with `$calling_post_id` Any suggestions on how to get the attachment ID? I tried copying most of the code from `media.php` without any luck.


title: wordpress settings api add fields

text:
I am trying to add some code to a theme that will allow the user to change the logo or have some text instead. I managed to find some code that otto posted to do the file upload. I have added what I thought was how to add the other fields but they do not save for some reason and I am sure it is something very simple I have missed:               add_action('admin_init', 'ld_admin_init');     function ld_admin_init() {     register_setting( 'ld_options', 'ld_options', 'ld_options_validate' );     add_settings_section('ld_main', 'Upload', 'ld_section_text', 'ld');     add_settings_field('ld_setting_checkbox', 'Use image', 'ld_setting_checkbox', 'ld', 'ld_main');     add_settings_field('ld_setting_string', 'Logo text', 'ld_setting_string', 'ld', 'ld_main');     add_settings_field('ld_filename', 'File:', 'ld_setting_filename', 'ld', 'ld_main');     }          // add the admin options page     add_action('admin_menu', 'ld_admin_add_page');     function ld_admin_add_page() {     $mypage = add_theme_page('Logo', 'Logo', 'manage_options', 'ld', 'ld_options_page');     }          // display the admin options page     function ld_options_page() {          ?>

Logo settings

You can upload a new logo.
     <form method="post" enctype="multipart/form-data" action="options.php">     <?php settings_fields('ld_options'); ?>     <?php do_settings_sections('ld'); ?>
     <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes') ?>" />
     </form>
          <?php     }          function ld_section_text() {     $options = get_option('ld_options');     echo '
Upload your file here:
';     if ($file = $options['file']) {         //var_dump($file);         echo "";     }     }          function ld_setting_filename() {     echo '<input type="file" name="ld_filename" size="40" />';     }          function ld_setting_checkbox() {     $usetext = get_option('ld_options');     if($usetext['chkbox1']) { $checked = ' checked="checked" '; }     echo "<input ".$checked." id='plugin_chk1' name='ld_options[chkbox1]' type='checkbox' />";     }          function ld_setting_string() {     $logotext = get_option('ld_options');     echo "<input id='ld_logo_text' name='ld_options[text_string]' size='40' type='text' value='{$logotext['text_string']}' />";     }          function ld_options_validate($input) {     $newinput = array();     if ($_FILES['ld_filename']) {         $overrides = array('test_form' => false);          $file = wp_handle_upload($_FILES['ld_filename'], $overrides);         $newinput['file'] = $file;     }     return $newinput;     }      I would like to be able to set it up so they can upload the image and if the box is ticked the image is used for the logo else the text is displayed. I jsut need to get the info saved so i can use it in the output.


title: Enqueuing jQuery in plug-ins

text: I want to use jQuery in a plugin. In functions.php of the theme I'm using, I found:               if(!is_admin()) {             wp_deregister_script('jquery');             wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js');      As I understand it, this loads jQuery and I'm ready to go. All I have to do is add this to my plugin's javascript file:               jQuery(document).ready(function($) {              //put jquery code here          })      A) Is that it? Am I missing anything? I did not see this in the header.php:               <?php wp_enqueue_script('jquery');?>     <?php wp_head(); ?>      B) I'd also like to use jquery-ui. In a plugin that came with the theme, I found:               wp_enqueue_script("jquery-ui-sortable");     wp_enqueue_script("jquery-ui-draggable");     wp_enqueue_script("jquery-ui-droppable");       Do I simply do the same as above in own plugin? And then call it in my js file as:               jQuery(document).ready(function($){          }      What if I want to use other bits of the jQuery-UI library? How can I tell which parts of jQuery-UI are included in the theme? Sorry for the basic questions. I want to make sure that I'm set-up properly and I understand what's going on. * * * Additional Info: Let's say I've got a plugin called "myplugin". The plugin works. But, I want to add some jQuery functionality. In myplugin's main function I add:               wp_enqueue_script('myplugin_script', 'http://mysite/wp-content/plugins/myplugin/js/myplugin_script.js');      In myplugin_script.js, I have:               jQuery.noConflict();          jQuery(document).ready(function($) {                         alert("Hello");                                                                          })      Why isn't the alert popping up? Do I need to add the script to a hook? Or will wp_enqueue_script cause it to fire? Thank you. -Laxmidi


title: Is wordpress 3.3.1 compatible with PHP Version 5.2.17?

text: Exactly what it says on the tin, I am having a few problems with my site after a server upgrade and some of it has started to trip out. A lot of my code has also stopped working, despite it doing nothing fancy, mostly just loops and ifs just wondering if because a lot of it is dependant on WP functions.


title: Custom text-only header

text: I am developing a WordPress theme and would like to make use of a custom header on a the homepage (I'm using a custom page template). I would like this header to **not** include an image, but rather an `<h1>` and `<h2>` tag, and a link. So my question is the following - how do I go about providing users with the facility to update the headings and the link in the header from the admin backend? Would `add_theme_support( 'custom-header' );` be suitable for this since I need to add my own fields? And how would I go about completely disabling support for the image and showing the text in my page template?


title: How to add audio files to wordpress blog and making it auto play?

text: How to add audio files to wordpress blog that when someone clicks on a post Music began playing by itself.


title: query single random post works localhost, not on live site

text: I was developing a site on localhost, and just transferred everything over to the live site. The queries are the exact same between the live and staging sites, But the query is not working on my live site. I'm trying to query a random post out of a category to display in my footer. It's a very simple query so I'm not sure why it's not working. It's just showing me the same post every page reload. Localhost, it works as expected and shows a random post from that post type. `<?php $recipesloop = new WP_Query( array( 'post_type' => 'recipes', 'posts_per_page' => '1', 'orderby' => 'rand') ); ?>` This is what is returned:                    WP_Query Object (     [query_vars] => Array (     [post_type] => recipes     [posts_per_page] => 1     [orderby] => rand     [error] =>     [m] =>     [p] => 0     [post_parent] =>     [subpost] =>     [subpost_id] =>     [attachment] =>     [attachment_id] => 0     [name] =>     [static] =>     [pagename] =>     [page_id] => 0     [second] =>     [minute] =>     [hour] =>     [day] => 0     [monthnum] => 0     [year] => 0     [w] => 0     [category_name] =>     [tag] =>     [cat] =>     [tag_id] =>     [author] =>     [author_name] =>     [feed] =>     [tb] =>     [paged] => 0     [comments_popup] =>     [meta_key] =>     [meta_value] =>     [preview] =>     [s] =>     [sentence] =>     [fields] =>     [menu_order] =>     [category__in] => Array (     )     [category__not_in] => Array (     )     [category__and] => Array (     )     [post__in] => Array (     )     [post__not_in] => Array (     )     [tag__in] => Array (     )     [tag__not_in] => Array (     )     [tag__and] => Array (     )     [tag_slug__in] => Array (     )     [tag_slug__and] => Array (     )     [post_parent__in] => Array (     )     [post_parent__not_in] => Array (     )     [author__in] => Array (     )     [author__not_in] => Array (     )     [ignore_sticky_posts] =>     [suppress_filters] =>     [cache_results] =>     [update_post_term_cache] => 1     [update_post_meta_cache] => 1     [nopaging] =>     [comments_per_page] => 50     [no_found_rows] =>     [order] => DESC     )     [tax_query] => WP_Tax_Query Object (     [queries] => Array (     )     [relation] => AND     )     [meta_query] => WP_Meta_Query Object (     [queries] => Array (     )     [relation] =>     )     [date_query] =>     [post_count] => 1     [current_post] => -1     [in_the_loop] =>     [comment_count] => 0     [current_comment] => -1     [found_posts] => 10     [max_num_pages] => 10     [max_num_comment_pages] => 0     [is_single] =>     [is_preview] =>     [is_page] =>     [is_archive] => 1     [is_date] =>     [is_year] =>     [is_month] =>     [is_day] =>     [is_time] =>     [is_author] =>     [is_category] =>     [is_tag] =>     [is_tax] =>     [is_search] =>     [is_feed] =>     [is_comment_feed] =>     [is_trackback] =>     [is_home] =>     [is_404] =>     [is_comments_popup] =>     [is_paged] =>     [is_admin] =>     [is_attachment] =>     [is_singular] =>     [is_robots] =>     [is_posts_page] =>     [is_post_type_archive] => 1     [query_vars_hash] => 79b1d4c4dd907be2bdf06d3b2e4bd2f8     [query_vars_changed] =>     [thumbnails_cached] =>     [stopwords:WP_Query:private] =>     [query] => Array (     [post_type] => recipes     [posts_per_page] => 1     [orderby] => rand     )     [request] => SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.post_type = \'recipes\' AND (     wp_posts.post_status = \'publish\' OR wp_posts.post_status = \'private\'     ) ORDER BY RAND(     ) DESC LIMIT 0, 1     [posts] => Array (     [0] => WP_Post Object (     [ID] => 228     [post_author] => 2     [post_date] => 2014-03-04 11:00:59     [post_date_gmt] => 2014-03-04 16:00:59     [post_content] => Combine flour, salt, pepper and cayenne in a saucepan; gradually add chicken broth and skim milk, stirring with a wire whisk until smooth. Place over medium heat and cook, stirring constantly, until thickened. Add mustard and lemon juice. Allow to cool. Heat margarine and oil in a skillet. Add chicken pieces, green onions and garlic. Sauté until chicken is just firm and cooked through, about 10 minutes. Prepare pasta according to package directions and drain. Combine sauce, chicken and pasta mixture. Put into a 2 ½-quart casserole dish. Sprinkle top with almonds, chopped chives and paprika (     if using     ). Bake at 375° for 10 minutes or until heated through.     [post_title] => Zingy Lemon Chicken Pasta     [post_excerpt] => Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.     [post_status] => publish     [comment_status] => closed     [ping_status] => closed     [post_password] =>     [post_name] => zingy-lemon-chicken-pasta     [to_ping] =>     [pinged] =>     [post_modified] => 2014-03-07 15:07:38     [post_modified_gmt] => 2014-03-07 20:07:38     [post_content_filtered] =>     [post_parent] => 0     [guid] => http://baltimarket.wpengine.com/?post_type=recipes&p=228     [menu_order] => 0     [post_type] => recipes     [post_mime_type] =>     [comment_count] => 0     [filter] => raw     )     )     [post] => WP_Post Object (     [ID] => 228     [post_author] => 2     [post_date] => 2014-03-04 11:00:59     [post_date_gmt] => 2014-03-04 16:00:59     [post_content] => Combine flour, salt, pepper and cayenne in a saucepan; gradually add chicken broth and skim milk, stirring with a wire whisk until smooth. Place over medium heat and cook, stirring constantly, until thickened. Add mustard and lemon juice. Allow to cool. Heat margarine and oil in a skillet. Add chicken pieces, green onions and garlic. Sauté until chicken is just firm and cooked through, about 10 minutes. Prepare pasta according to package directions and drain. Combine sauce, chicken and pasta mixture. Put into a 2 ½-quart casserole dish. Sprinkle top with almonds, chopped chives and paprika (     if using     ). Bake at 375° for 10 minutes or until heated through.     [post_title] => Zingy Lemon Chicken Pasta     [post_excerpt] => Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.     [post_status] => publish     [comment_status] => closed     [ping_status] => closed     [post_password] =>     [post_name] => zingy-lemon-chicken-pasta     [to_ping] =>     [pinged] =>     [post_modified] => 2014-03-07 15:07:38     [post_modified_gmt] => 2014-03-07 20:07:38     [post_content_filtered] =>     [post_parent] => 0     [guid] => http://baltimarket.wpengine.com/?post_type=recipes&p=228     [menu_order] => 0     [post_type] => recipes     [post_mime_type] =>     [comment_count] => 0     [filter] => raw     )     )


title: How to add custom content under plugin row in WordPress admin plugin list?

text: I'm looking to add a custom message under my plugin in the "Plugins" page, much like the following screenshot: ![plugins list available filters and hooks](http://i.stack.imgur.com/GVhxc.png) What action or filter should I use? Thank you!


title: Check for new posts in the loop every x mins/seconds

text: I'm trying to think of a way to check for new posts in the current loop (e.g. author, or tag) using ajax to give a live blog feel without reloading the whole page. Is it possible to 'fire' the loop to check for new posts?


title: List all wordpress categories on page loop

text: I'm trying to build a wordpress theme for a magazine site I plan on launching and I'm kind of stuck on a certain issue. I'm listing my posts in a 3 column layout and I'd like to create a page where I can list all my categories along with a category image in the same style. I was thinking that wordpress had a loop function for listing categories but I must have been mistaken. Is this something that's possible? I plan on having quite a few categories, and I have a custom post type with it's own taxonomy and I'd like to create a page that lists all the categories along with category descriptions. I'm 22 and am very much a novice at coding. Here's the html prototype for the design I'm building in wordpress: http://dl.dropboxusercontent.com/u/455757/headsaflame.com/Headsaflame.com Build6/home.html You can see how I have the posts laid out. What I'm looking to build is a custom page template that will list all my categories in the same format. Any advice or direction you could give me would be awesome! I don't know any other web developers where I'm from. Thanks in advance! -Isaac


title: 403 thrown instead of 404 on iis

text: I am running a wordpress blog (3.4.1) on iis 7.5 with php manager 5.3.13. I cannot configure correctly the 404 page. I have created a 404 page which can be successfully viewed through /404.php. When a request for a page that does not exist is submitted, a 403 error message (with status code) is shown instead of my 404.php page.


title: Impose a Maximum Limit on Image upload size

text: Clients have been uploading huuuge images, then complaining that the server is running out of memory. Ofcourse one could bump the amount of memory, but this just introduces an arms race. What hooks can I add to impose a maximum image size ( dimensions, not filesize ) on files uploaded, e.g. No you can't upload that 8 Megapixel shot, resize it first to < 2 Megapixels. To be clear, I am talking about image size, not file size, aka Image height, and Image width


title: Get Metakey value while saving post

text: I am trying to insert metakey value while saving or updating post but somehow it is not inserting metavalue to `link` column of my custom talbe called `wp_banner_views`               function get_publishing_id($post_id) {         global $wpdb;         global $post;              $post= get_post($post_id);         if ($post->post_type == 'post'           && $post->post_status == 'publish') {                  $meta = get_post_meta($post->ID, 'banner_link', true);                  if(empty ($counter)) {                      $counter = 1;                      $wpdb->insert(                      $wpdb->prefix . 'banner_views',                      array(                          'postid' => $post->ID,                         'link' => $meta,                         'view_count' => $counter,                     ),                     array(                         '%d',                         '%s',                         '%d'                     )                 );                       }                        }     }     add_action('save_post','get_publishing_id');       I am trying to make click and view counter for banner. I have done view counter but trying to create click counter. Any autosuggestion for that would be appropriated.


title: Post comment as different user than logged in

text: When I reply to a comment in the WP backend in the "Comments" section (edit- comments.php) I can only post the reply as the logged in user. Is it possible to select a certain user like in the "Add new post" section (post-new.php) where I have a dropdown with all users that are allowed to write posts?


title: Front-end login problem: requires re-authorization when accessing dashboard

text: I have created front-end login form that allows users to login from front-end. However, when trying to access Admin section (dashboard), WP's default login form is displayed and user authorization is required.               $user_arr = array( 'user_login' => $u_name, 'user_password' => $u_pass, 'remember' => $u_remember );     $sign_user_on = wp_signon( $user_arr, true );      Any idea?


title: How to get value in radio input in post meta box?

text: I use this code when create input box for post meta box:               <input type="text" name="<?php echo $name; ?>" id="x" value="<?php echo $value; ?>" />      Now I need to handle radio box which has 2 inputs with the same name:               <input type="radio" name="option" id="option-current" value="0" />     <input type="radio" name="option" id="option-custom" value="1" />      If use echo $name; and echo $value with radio type, post meta will have 2 value for one key, that makes the radio selection lost meaning. How to get correct result from the radio type?


title: Script or plugin to send activation email automatically again after 2 hours

text: I'd like to set a cron job on my server to run an automated script that would tell Wordpress to:   * Check the users that have signed-up but not logged-in in the last 2 hours.   * Resend the welcome email to only the users who signed-up in the last 2 hours.   * On the next cron job it will ignore the users which have already been sent another welcome email in the previous cron runs - you could even delete the users who haven't logged-in within the 2 hour limit if that's easier. Really appreciate some advice or pointers on how to set this up. I've been searching the net for an answer to no avail. Hopefully someone can help.


title: What data does WordPress theme update pull If there is an update?

text: I'd like to know what WordPress pulls to notify updates from the code. I'm currently facing an issue where my theme happens to have the same name as another theme which is already in the repository and it's notifying me that I'm currently using an older version of the theme. What's even worse, my theme gets replaced with that already existing theme when I click update. So it'll be great if I could just change a code or two to prevent this. I've tried changing the 'Theme Name' in style.css in the root folder (do I have to wait for this to update?) but it's not working. Note: I'm using my theme in MAMP (connected to the internet, of course). Does anyone know how to solve this? Thanks


title: Check if post belongs to any category

text: I've got a custom post type which displays portfolio items. I display the portfolio category on the page using this code:               <?php      $myterms = get_the_terms($post->ID,'portfolio_category');             foreach ($myterms as $myterm ) {              echo $myterm->slug."\n";             }            ?>       Which works fine as long as the portfolio item has a category. If it doesn't I get an error. Is there a way round this? Thanks


title: Help!! I Screwed up my WP

text: I was trying to clear up some empty tables left behind by other previously used plugins. As such i was trying to delete the GD Star rating plugin and now I cannot access my WP admin. i get the `'You do not have sufficient permissions to access this page'` I turned on the debug to true and saw the errors caused by lots of plugins. So I disabled all of them, but nothing helps: This was the query I had run (and then just checked the output and clicked 'Drop' which messed it up.               SELECT *      FROM  `mydomain_main`.`wp_options`      WHERE (     `option_id` LIKE  '%ratings_%'     OR  `blog_id` LIKE  '%ratings_%'     OR  `option_name` LIKE  '%ratings_%'     OR  `option_value` LIKE  '%ratings_%'     OR  `autoload` LIKE  '%ratings_%'     )      Can someone please please advise


title: how do I exclude child categories from a wp_query?

text: I'm doing a category-based search that looks like this:               $feed = WP_Query("category_name=noticias&showposts=3&order=DESC");       The problem is this also brings me posts from the child categories, which I would like to avoid... how do I do this? If I do something like               $feed = query_posts(array('category__in' => array(102)));      Then I am told that $feed is not an object next time I try to do something with it... that's why WP_Query was good for me in the first place.


title: Specify parent page template

text: I don't want to define a template from admin because I have lot of page and so if I change it I might forget my selected template. So I want make that template in page. Here is my page structure > Mango (page) > > -Orange (parent page) > > -- lime (parent page) For my mango and all parent pages I will use the same template, but I don't want to that by selecting one for each from admin. I want that defined in functions.php or page.php with `get_template_part` or any other way. For example, if lime/mango/orange or whatever which is under `mango` page, then `get_template_part` will use `mango` so that my template will be mango.php. Any suggestions to make this work? i am not sure is that make scene or not


title: wordpress function to change post status

text: I'm running the YouTube Video Fetcher plugin at . It fetches videos using the youtube api and displays them on your website. Within the plugin script, there is the following sequence:                   if (empty($items)) {$ret .= " 'No new videos.'";}         else foreach ( $items as $item ) :      Is it possible to change the wordpress post status from published to draft if "No new videos" are found? I am thinking the solution is using the wp update post function and something along the lines of the following:                       <?php             // Update post             $my_post = array();             $my_post['ID'] = $id;             $my_post['post_status'] = 'draft';                  // Update the post into the database             wp_update_post( $my_post );             ?>


title: How to regenerate image thumb with size that is specified in media section

text: I have 500x300 sized images in my all post and want 280x177 sized images to display in index page for all the post. I used regenerate thumbnails and AJAX thumbnail rebuild plugin which builds images using setting in media section but problem is that after building some of the images it stops reacting and just hangs. Why this is happening? Is these plugins not work with more images. I have approximately 2000 images. Please help me. How to rebuild this images. Thanks in advance....


title: Getting posts from multiple users?

text: Using a third party plugin that allows users to follow each other, we can retrieve the users being followed like so (commented):-               <?php if (have_posts()) : ?>             <?php global $userpro_social;                  $following = $userpro_social->following( get_current_user_id() ); //get users the current user is following             print_r($following) ?> // print the array so we can see who we're following                       <?php $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; ?>                  <?php query_posts( array( 'author'=> ??? , 'paged' => $paged, ) ); ?>                        <?php while ( have_posts() ) : the_post() ?>                           <?php if ( has_post_format( 'video' )) {                         get_template_part( 'video-post' );                     }elseif ( has_post_format( 'image' )) {                         get_template_part( 'image-post' );                     } else {                        get_template_part( 'standard-post' );                     }                      ?>                  <?php endwhile;?>                  <?php endif; ?>      So this would output something like this Array ( [24] => 1 [1] => 1 ) ie, we're following users with the ID of 1 and 24, simple enough? The part I'm lost on is this               <?php query_posts( array( 'author'=> ??? , 'paged' => $paged, ) ); ?>         How do I actually output posts from those users, it's already stored in the array so I think it should be easy enough, but I just can't figure it out even after reading the codex.


title: Updating a Wordpress plugins breaks SVN

text: I have a blog with all the plugins I need committed to an internal svn repository. Wordpress is showing that some plugins need to be updated but when I do, Wordpress will delete the folder for that plugin so the .svn files are deleted as well. This will break the repository for that plugin. Any way around this?


title: How to change page location in Wordpress

text: I want to change my page location (link address). My blog page location is:               http://localhost/wordpress/?page_id=1336.       I want to change blog page location `http://localhost/wordpress/?page_id=1336` to `http://localhost/wordpress/` I want to create a option for user "Please select a page for home page". User selected page show as home page. For this reason I need to change page location. Thanks


title: Need to display tag group as first name, last name but sort on last name

text: The reviewers for our site are listed as filtered tags by first name then last name. How would I keep the display list as is but sort by last name? I have now: Aaron Smith Bob Jones Carl Harrison Henry Adams Steven Dunn I would like it to list by last name: Henry Adams Steven Dunn Carl Harrison Bob Jones Aaron Smith


title: A simple form submission but notice : Trying to get property of non-object

text: after 3 hours... I give up and I request the wordpress developers community. I have to create a contest on a site based on Wordpress. There are 3 steps :   1. user enters his information   2. if all the inputs are valid, I redirect to the game page   3. The user plays and then he is redirected to the results page. I created a page "Step 1", "Step 2"... and I associated a template for each page. All the logic is in the templates. I just started the validation of fields, I had this error that I don't understand.               Error : Notice: Trying to get property of non-object in /home/web/www.mysite.com/_online/wp-includes/post-template.php on line 29      Template :               /*     Template Name: QUIZ - Step 1     */          get_header();          if ( isset($_POST['participe'])) {         if (isset($_POST['gender'])             && isset($_POST['lastname']) && !empty($_POST['lastname'])             && isset($_POST['firstname']) && !empty($_POST['firstname'])             && isset($_POST['email']) && !empty($_POST['email'])             && isset($_POST['day']) && !empty($_POST['day'])             && isset($_POST['month']) && !empty($_POST['month'])             && isset($_POST['year']) && !empty($_POST['year'])             && isset($_POST['status'])                 && isset($_POST['place'])             && isset($_POST['newsletter'])             )         {             echo 'ok';           }         else {             echo 'ko';         }     }      When I let all the fields empty, I have the echo "ko" but when I fill all of them I have the previous error...


title: 'Blog Archive' suddenly appeared on custom post type; how to remove

text: I have all of a sudden started seeing `Blog Archives Post navigation` (as below) rather than every post in that custom post type. I changed something in the Wordpress SEO plugin which has since been deactivated. The particular custom post type is a Testimonial from wootheme's testimonials plugin. Does anyone know how i return this to normal rather than showing each post as a page (the page below is p1 of 2 for example)? > Blog Archives Post navigation ← Older posts John, Manchester > > (the content) Great service and really comfortable journey. Would definitely > recommend. Post navigation ← Older posts Archives > > Meta Thanks


title: How can I filter posts by tag on the fly

text: I need to create a catalog of posts that use lots of categories and sub categories but that can be filtered by tags. I have created a custom post type and assigned custom categories and tags to it. All working. So now I create the posts: Item 1 in SPORT > GOLF >> CLUBS with a tag USA and Item 2 in SPORT > GOLF >> CLUBS with a tag GERMANY. If I go to mydomain/my-category/clubs Both Item 1 and Item 2 are there. Great. If I go to mydomain/my-category/clubs?my-tags=usa only Item 1 shows. Great. If I go to mydomain/my-category/clubs?my-tags=germany only Item 2 shows. Great. Now, I have created a custom page template that displays a list of categories from my-category taxonomy. So it shows   * SPORT      * GOLF        * CLUBS What I want to do is add a dynamic drop down menu of my-tags (Countries) so that when a user selects one of them say USA and CLUBS, it filters only the posts with those tags. ie adds `?my-tags=usa` to the end of the category's URL. Can somebody please help me out here before my boss chews my face off.


title: WP_Query array key / value pairs?

text:
I have a WP_Query like this.                   <?php             $quote_args = array(                 'post_type' => 'post',                 'category_name' => 'quote',                 'orderby' => 'rand',                 'posts_per_page' => 1             );                  $quote  = new WP_Query($quote_args);                  if($quote->have_posts()):                 while($quote->have_posts()):                     $quote->the_post();         ?>

                 <?php the_content_rss(); ?>                 <?php echo the_title(); ?>

         <?php             endwhile;             endif;         ?>      It just randomly selects posts that are quotes. My questions is the $quote_args array has a group of key / value pairs: ('post_type' => 'post') Is there a list of the keys that can be used here. Is there a name for these key / value pairs.


title: How can I store page ID in a post instead of other selected permalink?

text: We're using Wordpress as a knowledge base. We just left mediawiki and jekyll for Github pages and reduced the amount of different systems from four to just one. One Wordpress installation for blogging and three for three different knowledge bases for three different products. The advantage is that editors only have to master one system instead of three. We've set the permalinks to /%postname%/ which makes nice and logical weblinks. In most of the pages we're adding links to other knowledge base pages using the editor. In the popup we're selecting the page to link to. The permalink is added to the page. Since we're constantly working on the Knowledge Base it will happen that the postname changes. This will result in an error 404 on an internel Knowledge Base page linking to the changed post. Therefor I would like to add page id's (?p=123) instead of the post name. When the link is clicked on the frontend Wordpress seems to be smart enough to rewrite the page id to the /%postname%/ Advantage is that I don't have to change the links in every page. (or can this be done automatic too?)


title: Change post permalink to external URL from custom field

text: I want to let my users submit links to my website something like reddit and digg. I added a meta_key 'syndication_permalink' which contains link to this post. How could I change the post permalink to link this custom link not to my page?


title: How to config post title to link to an external site like Daring Fireball?

text: Google took me to this plugin but there is a warning: > This plugin hasn't been updated in over 2 years. It may no longer be > maintained or supported and may have compatibility issues when used with > more recent versions of WordPress. Is there a plugin which works well for 3.8?


title: How do I pass an argument to my custom walker?

text:
I've set up a custom walker, and it works as desired when I hard code my variable. What I want is to be able to call my walker and pass it a variable that is used in the walker. For example:                'walker'          => new Plus_walker($refine => 'review'),       The walker I've tweaked to output http://URL/review in order to find posts in the review category for this menu item. But I want to be able to use the same walker for 'previews', 'interviews' and more. Thus far my attempts at inputting variables have just broken the whole thing, 'Parse error: syntax error, unexpected T_DOUBLE_ARROW'. I know I could just rewrite the code and make a few different walkers (Review_walker, Preview_walker etc), but this just seems wrong (and I figure this could be an important thing to know...) My walker code is here:               class plus_walker extends Walker_Nav_Menu {              var $refine;                  function __construct($refine) {                      $this->refine = $refine;             }                     function start_el(&$output, $item, $depth, $args)           {                global $wp_query;                $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';                     $class_names = $value = '';                     $classes = empty( $item->classes ) ? array() : (array) $item->classes;                     $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );                $class_names = ' class="'. esc_attr( $class_names ) . '"';                     $output .= $indent . '
ID . '"' . $value . $class_names .'>';                     $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';                $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';                $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';                $attributes .= ! empty( $item->url )       ? ' href="'   . esc_attr( $item->url     )  . '' : ''; //This is where I want the argument to live.              $modded_url = substr($attributes,0,-1) . '+' . $refine . '"';                      $item_output = $args->before;                 $item_output .= '';                 $item_output .= $args->link_before .$prepend.apply_filters( 'the_title', $item->title, $item->ID ).$append;                 $item_output .= $description.$args->link_after;                 $item_output .= '';                 $item_output .= $args->after;                      $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );                 }     }      And the php call in my templates:               <?php wp_nav_menu( array(                                 'menu' => 'Handheld',                                      'container'       => 'div',                                      'container_class' => 'col_1',                                      //'container_id'    => ,                                     'menu_class'      => 'menu',                                      //  'menu_id'         => ,                                     'echo'            => true,                                     'fallback_cb'     => 'wp_page_menu',                                          'items_wrap'      => '
%3$s
',                                     'depth'           => 0,                                     'walker'          => new Plus_walker(array($refine => 'review')),                        )                  ); ?>      I've tried a bunch of different configurations: 'refine' => 'review, with and without the array, but still no joy, just errors (unexpected '=>' mostly).


title: How I check if the same post slug has not been used before publishing?

text: For an indie rock agenda I created event posts. With the help of javascript, the custom fields values (bands, places and date info picked in select boxes) are copied as the post title when publishing or updating the post.There is also a custom function which update the slug every time the title changes. Problem: if an other user create a new post picking exactly the same custom fields values, then an other post with exactly the same slug is created. And if two posts with the same slug are created, both of them lead to a 404 error page until one of them is manually deleted. My question: is there a way to "validate" the post slug comparing it to the older posts in the database ? Thanks for your help !


title: Add field to all custom post types

text: I know how to add fields to custom post types one at a time. I was wondering if there is a way to add a field to the default post type as well as all the custom post types at once? Thanks


title: Stepping through a foreach loop - adding +1 to the end of it so next time it loops it starts on item 2

text:
I'm creating a custom Google map that plots multiple markers. ## _**View the link as it will make it easier to explain what is happening and what I want_** If you click on each marker it shows company names that are grabbed from the child pages. At the moment it's showing ALL the company names on each marker. How can I show just one company name per marker? Here's the code controlling the little popup:               $pages = get_pages(array('child_of' => 1873, 'sort_column' => 'menu_order'));      $counter = 1;     foreach($pages as $post) {         setup_postdata($post);          $fields = get_fields();         ?>
<?php $counter++; echo $fields->company_name;?>
         <?php     }     wp_reset_query();      Once it's looped through once, the next time it loops through I need it to start on the next child and not show the first one.


title: "operation successful" message

text: i'm writing some custom wordpress pages, and i want that after an action where the user has addess an item to a list (after the user press the submit button and the page reloads showing the updated list) a messagge appears on top of the content area saying something like "the item xxxxxxx has been added." and then fades away after a couple of seconds (or it could stay with an "x" to the right to close it). There is any function in Wordpress that allows meto do that? The fading is optional, but i want to give the customer some kind of feedback (maybe in a green-border on white box or something like that). Also optional but interesting would be to have also the error message, all the same just red border instead of green. The message has to show inside the page, not over and has not to be modal nor an js alert.


title: Author page points to 404 error page

text: I am having a membership site in wordpress where there are more than 10K users. Now when the user having a single word user_nicename ( http://example.com/author/james ) try to access their respective author page, then it works just perfectly fine. But when a user having user_nicename including a space character in between ( http://example.com/author/james bond ), it gets converted to this url ( http://example.com/author/james%20bond ) and redirects them to a 404 Error Page. I have gone through some forums and everybody has suggested to modify the db value for this. Since, in my case I am having more than 10K users, its very time consuming to go to the specific table and edit the value for each particular user and moreover, I'll not prefer this solution. Can anybody suggest me some solution for this issue?


title: Is there any debug toolbar that shows whick hooks are called for the current page in Wordpress?

text: In Django there is a debug toolbar that shows which template files and hooks are called while rendering a page. Is there any plugin that shows which hooks are called for the current page in Wordpress? ![enter image description here](http://i.stack.imgur.com/Me5i4.jpg)


title: Using custom tables for old posts

text: I have a site with about 24,000 posts and 200 posts daily and the database will get huge soon. So I plan to transfer the old posts to custom tables to reduce the database load. There's no need to show these posts on the site. I will keep it for search engines and avoiding `sql_calc_found_rows` problems. These are the three tables I have created:               wp_posts -> wp_custom_posts          wp_postmeta -> wp_custom_postmeta          wp_term_relationships -> wp_custom_term_relationships      I have transferred old posts to these tables manually using phpMyAdmin and use a function to make WordPress use my custom post table instead of `wp_posts` if the post does not exists in it:               function custom_prefix_change($sql) {         global $wpdb,$wp;         $prefix = $wpdb->prefix;         if(is_single()){             //check if the post exists in the genuine posts table             $results = $wpdb->get_results($sql,"ARRAY_A");                  if($results[0]['ID']){                 //if exists then return                 return $sql;             }else{                 //else change the query                 $sql = str_replace("$wpdb->posts","{$wpdb->prefix}custom_posts",$sql);                       }         }         //echo $sql;         return $sql;     }     add_action('posts_request',"custom_prefix_change");      However, my old posts in this case show up with no meta and taxonomies values. How can I do the same with the meta and relationships tables? Any suggestions?


title: get posts from Custom Post Type & Category

text: Ok, I've been frustrated about this one: I've got a category page with the Title + Description of the title. Under it I would like to show all the (custom post type, 'blog') posts related with this category and under it related posts of custom post type 'apps'. When applying the following code it only generates all 'blog' topics with all categories (instead of only the current i'm viewing). I have this for now:               <?php query_posts( array( 'numberposts' => 5, 'category' => 9, 'post_type' => 'blog' ) ); if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>      When using:                <?php if (have_posts()) : ?>        <?php while (have_posts()) : the_post(); ?>      Does anyone know how I can only show all related posts of this category with custom post type 'blog' ?


title: Multiple Tags Issue in Permalinks

text: I have configured `%tag%` for permalinks in wordpress Here is How to use first tag in permalinks. But while posting multiple tags in a post i am facing a kind of problem.   Suppose i have wrote three tags for a post, they are: `Backlinks, All About SEO, Web Promotion`   So here i wanna use the first tag name only in permalinks, but the problem is all tags are sorted by character in a post, so unfortunately in permalink it will use `www.example.com/All About SEO/page/` though i want to use the first `tag` in permalinks,so in this case desired permalink should be like this: `www.example.com/Backlinks/page/`    **So, how to use the first tag name for the permalinks** please help :)


title: Add thumbnails in 'li' list

text:
I'm new to WP so I'm still finding my way around. I want to create a simple list of thumbnails. In html I have done this like so

               In WP I have simply added thumbnails to a page with Upload/Insert and picked thumbnail from the Add Media window. I have used this php to add the content to the page                   <?php if(have_posts()) : while(have_posts()) : the_post(); ?>                                <?php the_content(); ?>                              <?php endwhile; ?>         <?php endif; ?>      This outputs code like this, each img is wrapped in an "p" tag

                        Is it possible to surround each img width a "li" tag instead of a "p" tag so it's like the original html code.


title: Get titles of all posts with current tags except current post

text:
I am trying to print out a bulleted list of all posts in the current posts category (i.e. "siblings") except for the current post itself. I have been able to get the tags of the current bost and print out the list of all posts with the same tags as the current post using the following code. However, I was then trying to add to the loop some logic to compare the name of the current post with the posts as they loop, and only if they don't match generate the bullet item (I know currently the if statement does nothing, I am trying to debug the loop). The problem is once the loop starts it seems to erase the variable I assigned the current post's title to.               <?php             // declare array to hold tags             $current_tags =  array();             // get the tags on the current post             $posttags = get_the_tags();             if ($posttags) {               foreach($posttags as $tag) {                 // add to tags array                 $current_tags[] = $tag->name;               }             }             // convert the array to comma-delimited string             $tags = implode(',', $current_tags);                     ?>
             <?php             // get the current page's title             $page_title = the_title();             echo $page_title; // "Spicy Lemon Chicken"                  $args = array( 'post_type' => 'recipe', 'tag' => $tags );             $loop = new WP_Query( $args );             while ( $loop->have_posts() ) : $loop->the_post(); ?>                  <?              $t = get_the_title(); // get current title in the loop             echo '$t = '.$t;             echo '$page_title = '. $page_title; // empty string                  if ( $t != $page_title) { }; ?>
<a href="<? the_permalink(); ?>"><? the_title(); ?>
            <? endwhile; ?>


title: $wpdb->posts is not correct

text: I have a problem with the value of `$wpdb->posts`. I have a WordPress multisite instance, and the following code is the one that is confusing me:               function order_to_post_id($order_id) {         global $wpdb;         global $blog_id;         error_log('create order query in blog id ' . $blog_id . ' and dbprefix ' . $wpdb->prefix . ': ' . sprintf("SELECT ID FROM {$wpdb->posts} WHERE post_name = %s AND post_type = 'mp_order'", $order_id));         return $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE post_name = %s AND post_type = 'mp_order'", $order_id));     }      This logs the following to the apache log file:               create order query in blog id 61 and dbprefix wp_: SELECT ID FROM wp_posts WHERE post_name = 0e172924e918 AND post_type = 'mp_order'      I am expecting `$wpdb->posts` to be `wp_61_posts`. Has somebody seen this before?


title: How do I add Javascript and CSS files into WordPress?

text:
I have the following html code:

      How can I add the used Javascript (or CSS) file into my new page ? Do I have to copy and paste the files through FTP ?


title: Passing variable from filter

text: I have this filter:               function wpa_filter_nav_menu_objects( $items){         global $count4footer;              foreach( $items as $item ){                  $count = countPosts($item->ID);             if($count!==false){                 $item->title = $item->title." ($count)";                 $count4footer[$item->ID]=$count;             }         }              return $items;     }     add_filter( 'wp_nav_menu_objects', 'wpa_filter_nav_menu_objects' );      I need to pass variable to the footer, but is printing `null`, I added `global $count4footer;` to the function , but to no effect.   How can I access this value later?


title: What is your best practice to execute one-time scripts?

text: # The Problem We all have been in a situation like this, and a lot of questions on this site need a solution like this. You either have to update a database, insert a lot of data automatically, convert `meta_keys`, or something similar. _Of course, in a running system based on best practises this should not happen._ But as it does, I would love to hear your personal solution to this problem, and why you chose yours. # The Question How do you implement one-time scripts in your (running) WordPress install? The issue here is mainly because of the following reasons:   * Scripts that insert data should not run more than one time   * Scripts that require a lot of ressources should not run at a time when they can not be monitored   * They should not be run by accident # The Reason I ask I have got my own practise, I am going to post it in the answers. As I do not know if it is the best solution out there, I'd like to know about yours. Also, this is a question that is asked a lot of times in context of other questions, and it would be great to have a ressource collecting the ideas. **looking forward to learning from you :)**


title: Can't load a class into WordPress post editor's content field

text: Following to **THIS WordPress QUESTION** we tried some tweaks and got some nice solutions, hope we can public them after some good active codes-snippets. According to our procedures, we correctly enqueued the necessary "conversion- js" into the admin area and can load our `js` into the post title and on keyboard action or mouse action we convert the texts into the same field. According to our Inspect Element in Chrome: ![WordPress editor with Inspect Element](http://i.stack.imgur.com/eq8kq.png) With Inspect Element we can see, in default blank view WordPress editor is loading it's content area with an `<iframe>`. And inside the `<iframe>` there is a blank `<p>`. We are targeting our `js` to that `<p>` tag. So we need a class or an Id to pass to that `<p>` tag. **HERE** is the jQuery we are trying to get into the `<iframe>` to load a class to the `<p>` tag. We took assistance from _THIS StackOverflow QA_. So the question-in-brief can be:   * How to load a class into a `<p>` tag enclosed with `<iframe>`?


title: WordPress Custom Post Type Delete Permissions

text: We've been developing a site recently that is going to have a lot of users and varying levels of permissions for those users. For this we went with Role Scoper but it seems to have a few issues in particular can't seem to set it so users from a particular group can't delete a custom post type. The issue is recognised on the Role Scoper support forum here but the registration is disabled for the forum it seems so can't sign up and follow up there. So I was thinking a quick solution would be to just remove the delete capacity from the role using the following               add_action('after_setup_theme','my_add_role_function');          function my_add_role_function(){         $role = get_role('user_group');         if($role){             $role->remove_cap ('delete_posts');             $role->remove_cap ('delete_custom_post_type');         }     }      however it doesn't seem to do anything. Could anyone shed any light on this do I need to override it at a different point perhaps? Thanks in advance.


title: Dynamically name array in Wordpress loop - add/get values

text: I have a page set up like Page One, Page Two, Page Three Each page has a tag of 'content'. In the Wordpress loop I would like to create an array for each page with the page title as the array name. I would then like to add and get values from the array using the array name. I have some demo code here. If I try to get the length of the array using the array name it returns '0' and the keys/values are not returned.                   <?php             $mt_test_args = array(                 'post_type' => 'page',                 'tag' => 'content',                 'order' => 'ASC'             );                  $mt_test_loop = new WP_Query($mt_test_args);                  if($mt_test_loop->have_posts()):                 while($mt_test_loop->have_posts()):                     $mt_test_loop->the_post();                    // create array for each page                $arr_name = get_the_title();             $arr_name = str_replace(' ','_',$arr_name);             $$arr_name = array();// The page array                  // Add text and color keys to array             $$arr_name[$text] = 'Page Text';             $$arr_name[$color] = 'red';              ?>                <option><?php the_title(); ?></option>              <?php endwhile; endif; ?>              <?php wp_reset_postdata(); ?>              <?php              print_r($Page_One);             echo count($Page_One); // no echo             echo $Page_One[$text]; // no value         ?>


title: Multi language site with same content

text: I want to make a site in 2 languages, but all the content will be absolutely the same (all posts will not be translated).   The only difference will be in things like theme messages (like 'Search', 'The page not found') that will be translated according to `WPLANG`. Also I have to have an ability to make some conditions in theme, according to `WPLANG`.   The multite solution is not good for me, as I don't want to copy all the post and taxonomies on two sites.   I thought to add a identification via URL (like `www.mysite.com/?lang=en`), to define `WPLANG` according to this, and store this variable in `session`, and, by this way, use it in theme.   But may be there is a better solution?


title: Show content if page is a grandchild of top level page

text: I'm looking to show a certain block of content if the current page is a grandchild of a top level page. This is my current page heirarchy;               - Top Level Page         - Child Page             - Grandchild Page             - Grandchild Page             - Grandchild Page         - Child Page             - Grandchild Page             - Grandchild Page             - Grandchild Page         - Child Page             - Grandchild Page             - Grandchild Page             - Grandchild Page      So the top level page has 3 children, each of which have 3 children of their own. How can I target ONLY the grandchildren?


title: Creating a post from data returned from HTML form

text: I am trying to write a WordPress plugin and I have hit a bump. **The Background:** I have some data in a mySQL DB that I am using (each row has a unique ID and some other information I have added). I am able to search the DB using               $heads = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}costumesdb WHERE location = 'head'", ARRAY_A);      And display some of the information to the user in a form using (this is one of 5 different drop-downs but they are all created in the same way)               <form id="createacostume" action= "admin-ajax.php" method="post">     Head: <select name="head">     <?php foreach ($heads as $head) { ?>             <option value="<?php echo $head['id'] ?>"><?php echo $head['shopName'] . " - " . $head['pieceName'] ?></option>     <?php } ?>     </select>     <input type="submit">      The script to submit the form data to the server is:               <script type='text/javascript'>         jQuery.ajax({     type: "POST",     url: ajax_url,     data: { action: 'my_action' , param: 'st1' }     }).done(function( msg ) {          alert( "Data Saved: " + msg.response );     });     </script>      In my php file serverside is:               add_action('wp_ajax_my_action', 'my_ajax_action_function');     function my_ajax_action_function(){          $reponse = array();     if(!empty($_POST['param'])){          $response['response'] = "I've get the param a its value is ".$_POST['param'].' and the plugin url is '.plugins_url();     } else {          $response['response'] = "You didn't send the param";     }          header( "Content-Type: application/json" );     echo json_encode($response);          exit();      **The Problem:** If I set action= "admin-ajax.php" in the form I get booted to the admin-ajax.php page with a "0" response. How do I get data from a form in WordPress admin page and process it?


title: Cart shortcode is not working in cart66 WordPress plugin

text: I have installed cart66 plugin in my WordPress site and created one demo cart66 post. When I click on the 'add to cart' button I get redirected to the cart page, which is blank. So I guess the problem is with the 'cart' shortcode. Does anyone have any idea about what could be the problem?


title: How to extend a class in WordPress?

text: I am ussing bbPress and want to extend the BBP_Shortcodes class in order to replace a function with my own. Here is my basic snippet which seems to do nothing:               class WPTUMBLE_Shortcodes extends BBP_Shortcodes {                   /**          * Display an index of all visible root level forums in an output buffer          * and return to ensure that post/page contents are displayed first.          *          * @since bbPress (r3031)          *          * @param array $attr          * @param string $content          * @uses bbp_has_forums()          * @uses get_template_part()          * @return string          */         public function display_forum_index() {                  echo 'Yo Adrian';         }          }               function wptumble_register_shortcodes() {         global $bbp;              // Bail if bbPress is not loaded         if (is_a($bbp, 'bbPress')) return;              $bbp->shortcodes = new WPTUMBLE_Shortcodes();     }          add_action( 'bbp_init', 'wptumble_register_shortcodes',    25  );      Looking at the bbpress functions setup it says:               add_action( 'bbp_init', 'bbp_register_shortcodes',    18  );      What am I missing? *I have tried every priority from hooking to init at priority 1, all the way through where I posted above, but none seem to do anything. Even stranger: I basically paste that code into a plugin file I called xyz and I receive no errors, just nothing happens when I view what should be outputted. Meaning I get the original output for display_forum_index() instead of my new one. Here is where it gets even worse: Instead of simply creating a plugin with that code in it, I place the code into my 'full' plugin. I use the following:               include_once (WPTUMBLE_PLUGIN_DIR.'twentyeleven-bbpress-child/inc/tumble-core-shortcodes-single.php');      I then have the WPTUMBLE_Shortcodes class pasted into the file above. *Trying to keep things clean so separating my different functions into different files in my custom plugin What happens is when I do that I end up with a fatal error saying BBP_Shortcodes is not defined. The ONLY difference is I am putting the code into a file that is include_once.. What in the world could be going on there? Either I get nothing happening when it's a single plugin file, or I get fatal error if I include_once and place the code in another file. Soooo confused now.


title: What does a security risk in a plugin look like?

text: My server was hacked this weekend. By the Russians! Of the 50+ domains on my server, every single one had a hacked .htaccess file which was redirecting search results and a few other things to a russian site. I'm assuming that one of the many, many wordpress installs has a plugin with a security flaw. Two questions:   1. Is it possible for a security hole in one plugin to allow someone access to other sites on the same server?   2. What would a security flaw look like that might give someone access to the .htaccess file a directory or two above? It's possible that the issue was someone else, that Dreamhost (my host) has bigger issues. But, I'm exploring the option that it's my fault. Thoughts?