title: Inline-Table under TwentyTwelve not working

text:
I recently wanted to add a comfortable way to automatically add users to a page within small boxes including information an an image. So I followed this tutorial an customized the code: http://www.wpbeginner.com/wp-tutorials/how- to-display-an-author-list-with-avatars-in-wordpress-contributors-page/ On the active page, which is using a horribly old and annoying framework by Pagelines, this works just fine. The elements are aligning just the way they should. (http://www.dreadfactory.de/testseite/) But when I try to add excatly the same code to a simple page with a twentyTwelve Childtheme, the layout is messed up. It has to be some problem with the TwentyTwelve css, because when I remove the TwentyTwelve css import, the boxes are fine (But of course then the rest is messed up. ;) ) You can see how the code takes effect in TwentyTwelve here: http://it.marvin- pollock.com/test Edit 1: Added page code The page template so far is very simple:               <?php     /*     Template Name: Profilseite     */     ?>     <?php get_header(); ?>

<?php contributors(); ?>

     <?php get_footer(); ?>      The code in functions.php               // --- Creates List of Users (Needs Plugin "user Photo") --- //     // --- To exclude a Profile set display_name = inactive --- //     function contributors() {         global $wpdb;              $authors = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users WHERE display_name <> 'admin' AND display_name <> 'inactive' ORDER BY display_name");              foreach ($authors as $author ) {                 echo "
";                     echo "ID);                     echo "'>";                     echo userphoto($author->ID);                     echo "";                     echo '
';                         echo "ID);                         echo "'>";                             echo "
";                             the_author_meta('first_name', $author->ID);                             echo "
";                         echo "";                         echo "ID);                         echo "'>";                             echo "
(";                             the_author_meta('last_name', $author->ID); //TODO: Change to 'city'                             echo ")
";                         echo "";                         echo "
";                         echo "
";                             the_author_meta('description', $author->ID);                         echo "
";                         echo "
";                         echo "ID);                         echo "'>";                             echo "Termine und Kontakt ->";                         echo "";                                     echo "
";                 echo "
";         }     }


title: Is it possible to change the images source that are shown in the admin side?

text: All of my images are in a CDN. On the website that's where the images are coming from but on the admin side it is pulling them from the server. Is there a filter or action I can use to change the source of the images that are shown in the WYSIWYG and in the Media admin section?


title: permalink %year% of pre-written posts to be published next year, in the mysterious future (*)

text: I am pre-writing some posts that will be published next year. My permalink structure is               /%year%/%postname%/      After setting the post title, the permalink says it will be               http://www.amazeaweek.net/2011/spiral-out/      which reflects the year I'm writing it. But I'd like it to be               http://www.amazeaweek.net/2012/spiral-out/      because it will be published in 2012. I tried setting the publish date _before_ writing the title, but the permalink still says it will be 2011, even though the publish date is set to be next year. **How can I make the permalink reflect the publish year instead of the current year?** (*) I tried to make my question title include all the keywords I used trying to search for this answer. After reading the note after this answer regarding scheduling posts, I wonder if I simply have to wait until next year...


title: Localizing methods for jQuery append prepend wrap parent

text:
So I am serializing some options in WordPress and then localizing them to be used in my jQuery script, however what I am trying to do next isn't working.               jQuery('.advert')+ lu_ban_object.method +('
Hello World
')      So in my db I've got some values serialized; following is the data that is being localized to used as method chosen by the user > s:6:"method";s:5:".wrap";} Essentially what it should do is;               jQuery('.advert').wrap('
Hello World
')      The user can also append, prepend, wrap, etc but it is just not working, the methods are being localized and serialized so it should work, but it isnt. I have tried the following as well;               jQuery('.advert')lu_ban_object.method('
Hello World
')     jQuery('.advert')jQuery(lu_ban_object.method)('
Hello World
')      Is just not working.... anyone know how to solve this. or am I doing it the wrong way? I just have a list in the settings page and each has a value for a different method such as;               <select name="lu_ban_data[method]" id="lu_ban_data" />             <option value=".append">Append</option>             <option value=".prepend">Prepend</option>             <option value=".wrap">Wrap</option>             <option value=".parent().parent().wrap">Parent</option>      **update: var dump**               array (size=4)       'title' => string 'My custom title' (length=15)       'msg' => string 'My message' (length=10)       'image' => string 'http://i.imgur.com/3tPjx4l.png' (length=30)       'method' => string '.prepend' (length=8)      I tried the bracket solution but still nothing, `jQuery('.advert')[lu_ban_object.method]("<div>Hello World</div>")` I am getting the following error: `Uncaught TypeError: Object [object Object] has no method '.prepend'` So I added the plus symbols and the message went away but the div was still not being added to the page `+[lu_ban_object.method]+` following is my localized data that is being printed in the header


title: Can I develop a social networking Site using WordPress and its Plugins?

text: I am completly new to WordPress. I have a requirment where I need to develop a site where people will form communities and will blog around. They will make friends and send friend request. So its much a combination of social Networking Stuff combined with Blogging Stuff. Can somebody suggest that if I should go for WordPress or look for some other option like. ELGG.


title: Custom taxonomy page not working

text:
I've created a custom taxonomy 'animal-species' that I want to filter out my 'animals' custom post type. The idea is that a user can go to the main animals page and filter them out by cats, dogs etc. I've created a taxonomy-animals- animal-species.php page, but the domain.com/animals/?animal-species=cat (or dog or whatever) still lists all of the animals, not just the ones that match the taxonomy. I've tried re-naming the taxonomy page to every variation that I can think of with no success. Does anyone have any ideas on how to fix this? TLDR: domain.com/animals/?animal-species=cat and domain.com/animals/ give the same results Code for both the animal-listing.php page and taxonomy-animals-animal- species.php pages               <?php                 $page_link = get_permalink();                 $animal_species = get_terms( 'animal-species' );                      $args = array();                 $args['post_type'] = 'animal';                 if ( isset( $_GET['animal-species'] ) ) {                     $args['animal-species'] = $_GET['animal-species'];                     $page_link = add_query_arg( 'animal-species', $_GET['animal-species'], $page_link );                 }                      if ( is_array( $animal_species ) ) {                     echo '
';                     echo '
Show all animals
';                     foreach ( $animal_species as $animal_species ) {                         echo '
slug, $page_link ) ) . '">' . $animal_species->name . 's
';                     }                     echo '
';                 }             ?>
                         <?php                              $animals_per_page = 10;                                  if( function_exists( 'ot_get_option' ) )                             {                                                                $animals_per_page = intval(ot_get_option('animals_per_page'));                             }                                  $args = array(                                         'post_type' => 'animal',                                         'posts_per_page' => $animals_per_page,                                         'paged' => $paged                                     );                                  $query = new WP_Query( $args );                                  $i = 0;                                                  if ( $query->have_posts() )                              {                                      while ( $query->have_posts() ) :                                           $query->the_post();                                      $i++;                                              ?>                                                                   <div class="animal-item <?php if ($i % 2 == 0) { echo "even"; } ?>" >                                             <?php get_template_part( 'inc/display-animal' ); ?>
                                                                    <?php                                      endwhile;                             }                     ?>


title: English version of my site show french strings

text: This is a weird one : http://www.famille-labruyere.com/ is the french version of the site http://www.famille-labruyere.com/en/ is the english one The problem is that the english version show theme strings in french. I have no idea why. Infos : i use WPML and the network of websites wordpress features.


title: getPost() method and Pagination

text:
i am creating a related post article feature for my wordpress enabled site.being new to php and wordpress facing some issue. though i can user wordpress build in feature to show related post of author but since site is hosting articles of authors who don't have any profile with us and there are many such authors so when a new post is being created for the author we tend to save a custom field as author_email. so based on this we want to show all post being published of a particual author.i tried using get_posts() method               <?php              $args = array( 'meta_key' => 'author_email', 'meta_value' => 'XYZ@XYZ.com');             $authorposts=get_posts($args); ?>
         <a href="<?php echo get_option('home'); ?>/">Home » <?php the_category(', ') ?>         <?php if (count( $authorposts ) > 0) {         foreach ( $authorposts as $post ): setup_postdata($post)            ?>
             /*               showing post tilte with image and some part of it             */

         <?php endforeach;  ?>

<?php previous_posts_link('‹ Previous Page') ?>

<?php next_posts_link('Next Page ›') ?>

        <?php                         } else {                             echo '
No articles by this user
';                         }                                ?>
      it showing the first 5 results and a link to the next page but when i click on the next page it show me that it has gone to second page as its also visible on the URL but its showing the same 5 results what it has shown in the first page. i am an idea that the query i have written on the same page is getting executed again from the beginning but not sure how to fix it. since i am using cutom fields to get posts i can use simple query to fetch post based on the limit or offse etc. can any one help me to fix the things or can point me hw to do it in right way thanks in advance


title: wpdb get_var is not returning any result (verified mysql query returns only one value)

text: I'm trying to modify a wordpress plugin to make it more adaptable for our needs. I have a custom user_meta called practice and we separate our users based on practice, so we need to separate quiz results also based on practice. My issue is that I cannot get my query to return the practice. Can someone look at this and tell me what I'm doing wrong?                   function save_score( $json, $user_id = null, $practice = null )         {             global $wpdb, $data;             $db_name = $wpdb->prefix . 'plugin_slickquiz_scores';                       $data    = json_decode( stripcslashes( $json ) );             $set     = array();             $now     = date( 'Y-m-d H:i:s' );             $user_id = $user_id ? $user_id : get_current_user_id();             $practiceKey = 'user_practice';            // $practice = $wpdb->get_results( "SELECT meta_value FROM $usrmeta WHERE user_id = $user_id AND meta_key = 'user_practice'" );            // $usrlevel = $usrlevel ? $usrlevel : $wpdb->get_var( "SELECT meta_value FROM $usrmeta WHERE user_id = '".$user_id."' AND meta_key = user_practice_level" );                  $userMeta = $wpdb->prefix . `usermeta`;             $sql = $wpdb->prepare( "SELECT meta_value FROM %s WHERE user_id = %d AND meta_key = %d",$userMeta,$user_id,$practiceKey );             $practice = $wpdb->get_var( $sql );                  $set['name']        = $data->name;             $set['score']       = $data->score;             $set['quiz_id']     = $data->quiz_id;             //$set['createdBy']   = $user_id;             //$set['createdDate'] = $now;             $set['usr']         = $user_id;             $set['usr_practice'] = $practice;                                 $wpdb->insert( $db_name, $set );         }          }     }      Everything inputs fine except $practice which does not put a value. Help?


title: How to update custom image sizes?

text: I've added multiple custom image sizes using the `add_image_size` function. The problem here is when I need to update the proportions of these sizes, the changed sized won't apply.   My guess is that wordpress inserts those sizes in the database and it fails to update them upon code change.   How can I update the image size?


title: How to add php within jquery

text: I want to add php code within jquery. I know that the file then cannot be saved as a js file but must be saved as a php file to execute the php code. If we save it as a php file then it can also not be enqueued within function.php.               jQuery(document).ready(function() {     jQuery('#a, #b').change(function () {         var $this = jQuery(this), // Get a handle on the checkbox we just clicked.             $a = jQuery('#a'),             $b = jQuery('#b'),             $c = jQuery('#c'),    // Get a handle on the textbox.             $d = jQuery('#d'),    // Get a handle on the textbox.             $e = jQuery('#e'),    // Get a handle on the textbox.             $f = jQuery('#f'),    // Get a handle on one of our default values.             $g = jQuery('#g');    // Get a handle on one of our default values.          if ($this.attr('id') == 'a' && $this.is(':checked')) {        // Clicking checkbox a will add the content of c and f and place it in e        // It will also uncheck checkbox b.             $e.val( <?php echo stripslashes(get_option('m')); ?> );        $b.removeAttr('checked');     } else if ($this.attr('id') == 'b' && $this.is(':checked')) {        // Clicking checkbox b will add the content of d and g and place it in e        // It will also uncheck checkbox a.             $e.val( <?php echo stripslashes(get_option('m')); ?> );        $a.removeAttr('checked');     } else {        $e.val('');     }     });     });      So how can I add php within my jquery and integrate it within my function.php theme file. Also please be noted that the php echo will return a javascript code so will it be possible that this code will be just added as a text and not echo as an executed code. Please help.


title: How to add jquery to my custom post type wp plugin

text: I want to include a jquery to my wordpress custom post type plugin which i have created. i have two doubt,,,   1. the jquery script will work only on widget options (i.e) Sidebar. So when i use the widget option the jquery script have to work. i am using the script to slide my custom post contents. so it will have to work only on sidebars?   2. How do i display meta box contents in widgets? Can any one suggest me. Thanks .


title: Wordpress DATABASE Update Manually?

text: I have a multisite WP and I'm now trying to update my WP to latest version. In the WP Administration Panel, there is a Network Update page at:   * Updates > Available Updates _(.../wp-admin/network/update-core.php)_ There i was able to do press the `[Update Now]` button. Then it updated the CODE BASE. So far ok. Then after that i need to upgrade the **DATABASE** again for network, as shown in:   * Updates > Update Network _(.../wp-admin/network/upgrade.php)_ Then it critically FAILED. It is showing:               Warning! Problem updating http://www.example.com/site1. Your server may not be able to connect to sites running on it.      Error message: Peer certificate cannot be authenticated with known CA certificates      In this post, i won't be asking for "how to solve this" particular problem. _(I'm asking "why/how" inanother post)_   Now, alternatively, my another question would be:   * HOW TO **UPGRADE THE WP DATABASE "MANUALLY"** ? _(As like we can upgrade the CODEBASE manually,shown here)_


title: Navigational error

text: Basically I have an image for a header and I changed the link behind that to go to the main website and was planning on making a news option in the menu to link to the blogs main page, after changing the link of the image I no longer had a link to the main blog page which because of that created an extra menu option called "Home" which goes to the main blog page but I cannot figure out where this is to change as its not in the menu with the rest of my navigational buttons. In short, how to change the Home page to be called "News" and have a different place in the menu? If you need to see the blog to see what I mean then it's on blog.lendfair.co.uk. http://wordpress.org/themes/constructor/


title: Why are images not displaying?

text: Server: IIS 6   WordPress version 3.1.1   Multisite using SubFolders I'm able to upload images to the server, but thumbnails and full size images do not display. If I try to edit the image, the preview displays. The file exists in blogs.dir. I'm using ISAPI Rewrite to create a httpd.conf file, which contains the block of code listed under Subfolder Example on the Create a Network page in the Codex. WordPress says the file is here: http://blogs.nvcc.edu/test/files/2011/04/facebook6.jpg. Actual location is here: http://blogs.nvcc.edu/wp- content/blogs.dir/32/files/2011/04/facebook6.jpg So many clues... I just can't put it together. Any help is greatly appreciated --Damon


title: Performance disadvantge of second installation instead multisite feature?

text: Is there any (performance-)disadvantage when I run two installations of wordpress instead of using the multisite feature? My question refers only to the difference of multisite / two installations. I'm aware of that there will be more load etc.      ### Some explanations (when necessary) I run a private blog on a vhost.   I want to run a different wordpress instance on the same host. Both sites are completely independent of each other - means different themes, plugins etc. The private blog is a single-user. The new site could have many users and will move onto a single vhost when it will be successful enough.


title: AJAX function needed (toggle text)

text: I am looking for a function that will toggle text exactly as shown by pressing the "Phone" button on this website. Any help would be much appreciated.


title: Show taxonomies from specific CPT

text:
I want to show a simple list of taxonomies associated with my CPT. The taxonomies are "skills". I have the following code:
Skills
                 <?php $taxonomy = 'skill';                    $taxonomy_terms = get_terms($taxonomy);                    foreach ($taxonomy_terms as $term) {                    echo '~ '.$term->name .'
';                  } ?>      But it's spitting out ALL skills that are added to that CPT, not just the ones selected. I believe the taxonomy code is correct in the functions file because on my CPT listing in the dashboard, it shows the correctly selected skills associated with the corrosponding post. All help is greatly appreciated!


title: Only show content if current page is NOT one of 2 page templates

text: I've been using this `if` conditional statement to only show content if the current page is NOT using a certain page template;               if (! is_page_template('template-custom.php')) {         <!-- show some content  -->     }      which has been working fine. Only now I need to amend the statement to show content if the current page is NOT using one of 2 templates (So if the current page uses `template-custom.php` or `template-custom2.php` do NOT show the content). I tried this;               if (! is_page_template('template-custom.php') || is_page_template('template-custom2.php')) {         <!-- show some content  -->     }      and this;               if (! is_page_template('template-custom.php') || ! is_page_template('template-custom2.php')) {         <!-- show some content  -->     }      but to no avil. Any suggestions?


title: Custom Registration Form with Validation

text:
I am trying to create a custom modal registration form, but I'm experiencing difficulties with validating the form. Basically what I have managed to do was to use CSS3 to validate the fields based on the `pattern="..."` or`required` markup used in the `<input>` tags. This validation covers simple stuff like checking for password's min. chars and email address syntax. However, what's missing, and very important, is a way for the form to check back with the database to see if the email address a new user wants to register with, is already registered with the website...and if so trigger `<i class="icon-attention invalid"></i>` to display and if possible make the submit button disabled.

Sign up for a new account
                 <form enctype="multipart/form-data" method="post" class="frm-show-form " id="form_registration">
                   <input type="hidden" name="frm_action" value="create">                   <input type="hidden" name="form_id" value="10">                   <input type="hidden" name="form_key" value="registration">
                      <input type="text" id="field_first_name" class="input" name="item_meta[85]" value="" placeholder="First Name" required>

                      <input type="text" id="field_last_name" class="input" name="item_meta[86]" value="" placeholder="Last Name" required>

                      <input type="email" id="field_email_address" class="input" name="item_meta[87]" value="" placeholder="Email" required>

                      <input type="password" id="field_password" class="input" name="item_meta[88]" value="" placeholder="Password" pattern=".{6,}" required>
                  <input type="hidden" id="field_r5tog4" name="item_meta[89]" value="" />                  <input type="hidden" name="item_key" value="" />                  <input type="hidden" name="frm_register[username]" value="-1" />                  <input type="hidden" name="frm_register[email]" value="87" />
                <input type="submit" value="Register" formnovalidate="formnovalidate" class="button-full">                </form>

      Is there some PHP script that can be used to help with validation here, or is the entire form wrong? I've tried testing it and user registration works but if the email is taken, the page just refreshes without registering anything. If it is a valid new email being used, registration works.


title: How to register a post type so I have archive page, but don't have single pages?

text: I think the question is straight forward. I want to have archive page, but want the single pages gone. Is there a way with custom post type options?


title: Filter posts with meta_query NOT IN where value has multiple values

text: I would like to use a `meta_key` to store multiple values in that key. Thereafter, I would like to filter away posts that do not contain a specific value in the key. In other words, just show posts that do not contain a specific value. This, however, does not seem to be possible. I am writing this question here to see if anyone has come to the same conclusion or if I am just missing something. Here is the code I have used:               // The values in key "_no_interest" are: 1,2,3     add_action( 'pre_get_posts', 'custom_pre_query' );     function custom_pre_query( $query ) {         if( $query->is_main_query() && !is_admin() && $query->is_post_type_archive( 'my_custom_post_type' ) ) {             $meta_query = array(                 array(                     'key'       => '_no_interest',                     'value'     => '3',                     'compare'   => 'NOT IN'                 )             );             $query->set( 'meta_query', $meta_query );             $query->set( 'posts_per_page', -1 );             $query->set( 'post_status', 'publish' );             $query->set( 'orderby', 'date' );            }     }      This will not work and neither will it if I use the `'!='` operator. However, if I set compare to be equal to `'IN'` or `'='`, then it will work. Can anybody confirm this or am I missing something here?


title: Adding a custom image upload size and making it selected by default?

text: How can I add a custom image upload size with a width of 550px and make it selected by default in the Add Media page? Currently, there are 4 sizes available: `Thumbnail`, `Medium`, `Large` and `Full Size`. The `Full Size` option is selected by default. Anyone knows a working solution to this?


title: Translate theme only

text: I think I'll lose my hair over this... Here's my situation:   * I have a WP MU running on my server   * I have several sites in english Now I want to add a blog in a different language under the same WP install, which will be using a twentyfourteen child theme, but I want everything else to stay in english. I downloaded both the global WP and 2014 translations. I've tried to put one or both of these into my functions.php:               add_action('after_setup_theme', 'my_theme_setup');     function my_theme_setup(){         load_theme_textdomain( 'nwnsablog', get_template_directory() . '/languages');     }          add_filter( 'locale', 'my_theme_localized' );     function my_theme_localized( $locale )     {         return 'sk_SK';     }      I put these files: `sk_SK.mo, sk_SK.po, [themename]-sk_SK.po, [themename]-sk_SK.mo` into the `languages` folder in my theme root. I also put the first two into the `languages` folder inside `wp-content`. At this point, it's still all in english. If I change the `define('WPLANG', 'sk_SK');` line in wp-config, most of the strings are translated, but it also translates them outside the theme, which I don't want. I could get to a point where a different part of strings was translated (I'm guessing they were theme specific), but I can't reproduce that. Anyway, it wouldn't be very useful, as it's only a halfway translation. Anyone can help?


title: How do I paginate search results for custom post types?

text: I have a Custom Post Type called "cars" that stores several custom fields along with the standard Title/Description fields. I need users to be able to search through the CPT based on the custom fields matching the user's criteria. I figured that part out and it works, but the problem is pagination. I figured out how to paginate the CPT based on code I found on Google, and it works, but once you leave page 1, you no longer have the search data submitted with the form. I just need to know how I should store this or pass it along. In regular PHP I would just use a session to store the data, but I've been told not to do that with Wordpress. So, what is the best option? I've been told Transients are the WP version of sessions, but I'm not sure how to efficiently use them for this and how to keep them separate for each user. I'm not asking for anyone to write this for me -- I just need some help understanding the best concept for this.


title: jQuery does not work in widget backend

text: I created a widget which should use jQuery for switching between two views and implement the jQuery UI date picker. I was wondering why my jQuery code does not work as I noticed that the date picker isn't working either. The console neither throws errors nor warnings. This is my code inside the widget class:               function form($instance) {         wp_enqueue_script('jquery-datepicker', get_bloginfo('template_url').'/styles/jquery-ui-1.10.4.custom.min', array('jquery', 'jquery-ui-core'));         wp_enqueue_style('jquery.ui.theme', get_bloginfo('template_url').'/styles/jquery-ui.css');     }      Is there any known issue? Or do I have to take something into account? **EDIT** And this is in a main backend script:               $(document).ready(function() {         $('#widget-so_calendar_excerpt-range_from').each(function() {             console.log(this);             $(this).datepicker({dateFormat: 'dd.mm.yyyy'});         });     });      Something quite strange is going on here. When I reload the admin panel, every time the console log changes. It looks like this (each line one page reload):               [Log] <input class="widefat hasDatepicker" id="widget-so_calendar_excerpt-range_from" name="widget-so_calendar_excerpt[range_from]" type="text"> (backend.js, line 28)     [Log] input#widget-so_calendar_excerpt-range_from.widefat (backend.js, line 28)     [Log] <input class="widefat hasDatepicker" id="widget-so_calendar_excerpt-range_from" name="widget-so_calendar_excerpt[range_from]" type="text"> (backend.js, line 28)     [Log] input#widget-so_calendar_excerpt-range_from.widefat (backend.js, line 28)     [Log] <input class="widefat hasDatepicker" id="widget-so_calendar_excerpt-range_from" name="widget-so_calendar_excerpt[range_from]" type="text"> (backend.js, line 28)     [Log] input#widget-so_calendar_excerpt-range_from.widefat (backend.js, line 28)      In the DOM, the new class `hasDatepicker` never get's added.


title: Change admin logout URL

text: My site is using a short vanity URL. This is working across all of the custom theme pages. The only problem is when I logout in the admin it redirects to the long URL, which then 404s. My General Settings (which I can't change) are: WordPress address (URL): The long URL Site address (URL): The short URL Looks like the logout link is generated from wp-includes/general-template.php, but I hate to edit core, non-theme, WordPress files. Any ideas how to solve this logout 404 problem is greatly appreciated.


title: How to hide custom fields added by a plugin?

text:
I want to hide unnecessary custom fields added by the plugin "All in one seo" to the Post Edit screen. To do this I added the following code to functions.php:               function my_remove_meta_boxes() {       remove_meta_box('aiosp_noindex_wrapper', 'post', 'normal');       remove_meta_box('aiosp_nofollow_wrapper', 'post', 'normal');       remove_meta_box('aiosp_noodp_wrapper', 'post', 'normal');       remove_meta_box('aiosp_noydir_wrapper', 'post', 'normal');       remove_meta_box('aiosp_disable_wrapper', 'post', 'normal');       remove_meta_box('aiosp_disable_analytics_wrapper','post', 'normal');     }     add_action( 'add_meta_boxes_post', 'my_remove_meta_boxes', 10, 2 );      But this doesn't work as expected. The `$id` parameters given to `remove_meta_box` functions above are taken from id attributes of the html div elements of the corresponding custom fields. For example:

     ...
      **Update** Following the instructions by bueltge, here is a solution using jquery: Put the following function into functions.php:               function remove_all_in_one_seo_fields() {         $screen = get_current_screen();         if ( $screen->parent_file != "edit.php" )             return;              wp_enqueue_script( 'custom', get_template_directory_uri() . '/js/custom.js', array(), null, true );     }     add_action( 'admin_footer', 'remove_all_in_one_seo_fields', 10, 2 );      Here is js/custom.js file:               ( function( $ ) {         // hide "all in one seo" fields         ( function() {             $('#aiosp_noindex_wrapper').remove();             $('#aiosp_nofollow_wrapper').remove();             $('#aiosp_noodp_wrapper').remove();             $('#aiosp_noydir_wrapper').remove();             $('#aiosp_disable_wrapper').remove();             $('#aiosp_disable_analytics_wrapper').remove();         } )();     })( jQuery );


title: Edit a custom admin page

text: I have created a custom admin menu page with: `add_menu_page` This page uploads a form to the wp_options table in the database.   Basic save with `update_option` like:               function addressbook_save (){     if(isset($_POST['Submit'])) {     // get the option     $customer = get_option( 'customer' );     // add new data to the option     $customer[] = $_POST['customer'];     // save it back to the db     update_option( 'customer', $customer );     }      I also show the data from that form on the same page with a foreach-loop. Here comes the problem:   I want to be able to create a button that let's me eddit the uploaded data. Maybe I'm just working on this to long to understand why I can't get this to work


title: Blocking Plugin Css to load custom in template directory

text: What is the most popular method to stop/block a plugin from loading their css styles ( located in the plugin directory) so that I can use the custom copy I made (located in my template directory). I ask this because I have one css document ( complied using sass,scss and grunt) that a visitor of my website loads. I want to add the plugin css to that document ( and to use the sass variable functions). Many thanks.


title: Can change twentytwelve_entry_meta "by-author" links?

text: In the Twenty twelve theme, the `twentytwelve_entry_meta()` function shows "by-author" links (i.e., the ones that have the title "View all posts by xxxx") by using `user_nicename`. So when a "difficult" admin username is chosen, that link can look something like:               John Smith      Is there any way to change that `twentytwelve_entry_meta()` function, and keep the link to the author's other posts, but use something other than the "user_nicename" in the body of the link? E.g.:               John Smith      **update** : My (slightly altered from default) `twentytwelve_entry_meta()` function:               function twentytwelve_entry_meta() {     // Translators: used between list items, there is a space after the comma.     $categories_list = get_the_category_list( __( ', ', 'twentytwelve' ) );          // Translators: used between list items, there is a space after the comma.     $tag_list = get_the_tag_list( '', __( ', ', 'twentytwelve' ) );          $date = sprintf( '<time class="entry-date" datetime="%3$s">%4$s</time>',     esc_url( get_permalink() ),     esc_attr( get_the_time() ),     esc_attr( get_the_date( 'c' ) ),     esc_html( get_the_date() )     );          $author = sprintf( '%3$s',     esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),     esc_attr( sprintf( __( 'View all posts by %s', 'twentytwelve' ), get_the_author() ) ),     get_the_author()     );          // Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name.     if ( $tag_list ) {     $utility_text = __( 'Posted on %3$s by %4$s', 'twentytwelve' );     } elseif ( $categories_list ) {     $utility_text = __( 'Posted on %3$s by %4$s', 'twentytwelve' );     } else {     $utility_text = __( 'Posted on %3$s by %4$s', 'twentytwelve' );     }          printf(     $utility_text,     $categories_list,     $tag_list,     $date,     $author     );     }      The rewrite function from the apparently duplicated question:               // add our custom rewrite rules for author archives     add_action('author_rewrite_rules', 'my_author_rewrite_rules');          function my_author_rewrite_rules() {     $author_rules['author/([0-9]+)/?$'] = 'index.php?author=$matches[1]';     $author_rules['author/([0-9]+)/page/?([0-9]{1,})/?$'] = 'index.php?author=$matches[1]&paged=$matches[2]';     $author_rules['author/([0-9]+)/(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?author=$matches[1]&feed=$matches[2]';     $author_rules['author/([0-9]+)/feed/(feed|rdf|rss|rss2|atom)/?$'] = 'index.php?author=$matches[1]&feed=$matches[2]';     return $author_rules;     }      After this I re-saved permalinks. Following this, the author URL hasn't changed; furthermore, clicking the URL now returns a 404. Not sure if I have to further modify the `twentytwelve_entry_meta()` function after adding the `my_author_rewrite_rules()` function ?


title: preselected custom fields in custom post type

text: I have a custom post type called "stock" and each post is going to have a stock_id, stock_name, stock_description and stock_available fields,...I would like to have defaults for these fields so the user doesn't have to load them on each new item. Is there a way?


title: Make plugin uninstalable on older versions of WordPress

text: So, if a plugin should not ever be installed on an older version of WordPress, whats the best way to go about it? What I normally do is something like this:               if ( ! function_exists( 'get_post_format' ) ) {         $error_handler = set_error_handler( 'my_plugin_die' );         trigger_error( '', E_USER_ERROR );     }          function my_plugin_die( $errno, $errstr, $errfile, $errline ) {         global $wp_version;         exit( 'This plugin requires WordPress version 3.0 or greater. You are currently using version ' . $wp_version . '. Please upgrade to the latest version of WordPress before installing this plugin.' );     }      I place this straight in the plugin file - outside of any class. It seems to work well in all of my testing, but seems rather harsh. Is there any chance of a plugin having this code will ever be activated? How to you deal with situations like this? There seems to be absolutely no documentation on this kind of thing.


title: Display custom posts randomly in custom taxonomy archive

text: I'm trying to get a random output in the taxonomy archive for my custom taxonomy "areas" I have the taxonomy-areas.php in which I have a standard loop. This one displays the posts from 3 custom-post-types: Hotels Pubs Restaurants As soon as I try to get them randomly with               <?php query_posts("orderby=rand"); ?>      it stops working, and starts to display standard posts as in index.php. I've tryed to add parameters to query posts, but it degenerates the loop, that doesn't displays anymore the right archive for the taxonomy of course. How can I fix it? I would like to avoid to create a taxonomy-aree-$term.php for each and every single area I'm going to define in my custom-taxonomy...! After some attempts I've tried with this one,               <?php query_posts("posts_per_page=24&orderby=rand&areas=north-east"); ?>      and tried to make it dynamic within the current taxonomy with this:               <?php query_posts("posts_per_page=24&orderby=rand&areas=$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); echo $term->slug;"); ?>      But with a blank output. Thanks and best regards.


title: add_post_meta to repeatable metabox from frontend

text: I'm creating new post from wordpress frontnend. I have managed to create post using `wp_insert_post` & added single metabox values using `add_post_meta` successfully. but I'm unable to set values of repeatable metabox fields from front end. Those repeatable fields have keys as follow :               edd_variable_prices[0][name]      edd_variable_prices[1][name]     edd_variable_prices[2][name]     edd_variable_prices[3][name]     & so on...      I'm using `add_post_meta($pid, 'edd_variable_prices[0][name]', 'Some Price', true);` to enter their values but it didn't work. How to add repeatable metabox values from frontend ?


title: Multiple Domain Names - One WP Install (non-Multisite) - Default Each Domain name to Category Archive

text: Use case is somewhat simple - here goes:   1. Five people share a single wordpress install - not multi-user    2. Each person blogs and puts their posts in a their own unique category   3. Each person has their own domain name   4. All domain names are pointed or parked to same WP install folder   5. Each person's domain name only shows the posts from their category, i.e.     * http://blogger1.com would return category archive of Blogger1's posts,      * http://blogger2.com would return category archive of Blogger2's posts,     * etc.   6. Google friendly indexing for each domain name    7. Prefer rewrite solution rather than redirect but redirect is acceptable   8. A"master" account would be able to post or edit any of the bloggers posts via the "main" domain login.    9. Bonus - if this could be extended to custom post types Environment   1. One installation of latest version of WP (not multi-user)   2. Pretty Permalinks    3. Cpanel - to set up domain parking    4. No subdomains   5. Access to `.htaccess`   6. Access to `functions.php`


title: How to make certain content of the post noindex and no follow. not entire post?

text: in my woocomemrce website i am trying to embade faqs which are generated using a short cut code . these faqs are common for all products which may lead to serious duplicate content issue . how to make only the faqs content to noindex and make the remaining part of the product like description and photos under follow and index ?


title: How do I change the language of only the login page?

text: My wordpress blog is set up as `de_DE`. This means that my login page is also displayed in `de_DE`. I would like to **only** have the login page in `en_US`. So, **How would I programmatically change a single page's language?** **Note** : I have WPML but I don't wish to use it, I only want to change one page on the whole site.


title: how would i create a password protected some pages using one common password?

text: i have created 5 pages.but home page and one sub pages viewing public pages, other three pages set password protect using one common password. if i enter password three password protect will be viewed. but now support every page set individual password. how would do common password?


title: How can a wordpress plugin generate pages without posts?

text: I would like to hidde all posts in a wordpress home page, so I need to remove `loop_start` or `the_post`. I tried the `remove_action` function, but this does not remove posts. Any ideas how a plugin can generate empty pages?


title: Custom Post Type Permalink / Rewrite not working immediately

text: Hitting a brick wall with the following: I have:   * 1 custom post type called `cpt_community`   * 1 custom taxonomy called `tax_community` If I set `'rewrite' => true` in my CPT registration, then permalinks to an entry for this CPT are of the form of `http://<domain>/cpt_community/test_item/`, and I get a 404 when browsing to it. If I set `'rewrite' => false`, then permalinks are `http://<domain>/?cpt_community=test_item/`, and this works fine. So, I'm obviously doing something wrong/stupid - the question is, what? [Update]   * After every change I'm flushing rules by going to Settings > Permalinks (and saving)   * After leaving everything alone for an hour, things have started working correctly - so why the delay?  * * * **Code** CPT Registration               function community_post_type() {       $labels = array('name'  => 'Community');             $args = array(           'labels' => $labels,           'public' => true,           'publicly_queryable' => true,           'show_ui' => true,           'show_in_menu' => true,           'query_var' => true,           'rewrite' => false,           'capability_type' => 'post',           'has_archive' => true,           'hierarchical' => false,           'menu_position' => null,           'has_archive' => true,           'supports' => array('title','editor','excerpt','custom-fields','comments','revisions','thumbnail','author','page-attributes')        );             register_post_type('cpt_community', $args);     }       add_action( 'init', 'community_post_type' );      Custom Taxonomy Registration               function community_tax_type() {       register_taxonomy(         'tax_community',         'cpt_community',          array( 'hierarchical' => false,            'label' => 'Community Content Type',            'show_ui' => true,'query_var' => true,            'rewrite' => true,            'singular_label' => 'Community Content Type',            'capabilities' => array('assign_terms' => 'edit_community_tags')            )        );        # allow roles to add community taxonomy tags to a community CPT        $roles = array("subscriber","contributor","author","editor","administrator");             foreach ($roles as $role_name) {          $role = get_role($role_name);          $role->add_cap("edit_community_tags");        }        }     add_action( 'init', 'community_tax_type' );


title: How do I add a widget from an Android phone?

text: Currently my only internet access is via my phone, and I need to add a widget to a Wordpress site. This requires dragging and dropping the widget to the sidebar, which I cannot do via the web browser on the device. Is there some way to get around this?


title: Wordpress Pagination Not Working - Always Showing First Pages Content

text: I am working on a website where I have a blog but I also have a custom post type to allow me to drop in some videos. I would like to use pagination so that if there are more then 9 videos displayed, then pagination occurs. The first part of this works. The videos are indeed limited to 9 per page and the pagination correctly shows up at the bottom. However when I click on the link for the second page, even though the URL changes, the first pages videos are displayed. For my 'normal' blog posts, pagination is working exactly as intended. This is the current code that I am using for my custom post type:               <?php if ( have_posts() ) : ?>     <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts('post_type=videos&posts_per_page=9&paged=$paged'); ?>              <?php /* Start the Loop */ ?>         <?php while ( have_posts() ) : the_post(); ?>      Any help would be greatly appreciated.


title: "Preview Changes" giving 404

text: Post Preview works fine, but after a post has already been published and changing the content and "previewing changes" before updating it again, it gives a 404. I think I've found out why this is happening, but not sure how to fix it. the url for the 404 is this: news/article/sdf- gsdfg/?preview=true&preview_id=3480&preview_nonce=1259e265ea&post_format=standard but removing the post_format from the url to make the url for the 404 is this: news/article/sdf-gsdfg/?preview=true&preview_id=3480&preview_nonce=1259e265ea does not give a 404 and shows the changes. I have no idea why this is happening or how to fix it. Other posts that I've seen don't even have the post_format string in the url. Any help is appreciated, thanks.


title: How to edit posts with the new wp_editor api?

text: I am using bbPress 2x and modified the plugin to use the new wp_editor in place of the textarea for adding new topics and replies. This part works beautifully. Where I am stuck is when a person clicks edit for a topic or a reply. The post content is not showing up in the editor. I'm probably just missing something really stupid, and hoping someone can chime in on how to fix this last piece. Here is what I am using: `               $tabindex = bbp_get_tab_index();     $settings = array(         'wpautop' => true,         'media_buttons' => true,         'editor_class' => 'tumble',         'tabindex' => $tabindex     );                              wp_editor( '', 'bbp_topic_content', $settings ); ` thanks **EDIT** Just got an answer to my question, and it works great Thanks go out to: http://soderlind.no/archives/2011/09/25/front-end-editor-in- wordpress-3-3/#comment-207831 `               $post = get_post($post_id, 'OBJECT');     wp_editor(esc_html($post->post_content), 'textarea01', $settings); `


title: How to list Tags using get_tags in an html table?

text:
Any suggestions on the simplest way to display tags using get_tags in an html table (4 columns across) ? Example:   Tag 1 | Tag2 | Tag 3 | Tag 4   Tag 5 | Tag 6 | Tag 7 | Tag 8 I'm using the following code to display tags, I found it in codex.:                     $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;


title: Default timezone hardcoded as UTC?

text: While debugging a plugin I was writing, I noticed that on line 36 of wp- settings.php, the default timezone is hardcoded to UTC with a call to the date_default_set_timezone() function. This means any call to the PHP date/time functions will work with UTC as the local time. Can someone please explain to me why this is a sane design choice by the Wordpress team? I understand if they want to store and manipulate times internally as UTC, but wouldn't a better alternative be to explicitly switch to a "UTC mode" when they need to do such logic? Assuming you know to set your server's php.ini's timezone setting, this hardcoded UTC basically invalidates php.net's description of the date() function: > date — Format a _local_ time/date Which strikes me as a bad thing, no?


title: How the mu-plugins Folder Works in a Multisite Installation?

text: I'm a little confused about when I should be placing plugin files into mu- plugins. I know it's Must-Use plugins and I know that they are automatically enabled. In the network setting, though, does this force the plugin file to be enabled in all child blogs? Makes sense that it would, so is that the only time I should put a plugin file THERE in a network? When I want the plugin code to be run in each child blog? For example, if I wanted to automatically set a new thumbnail size, should I do this there? Or are there other examples. And what about network activate?


title: Getting the Product object in a custom loop

text: I am currently building a Theme for a site that is using `WooCommerce` to provide a shop to Customers. I have just started on it, and I am currently working on the Product Category pages. I have hit a road block trying to fetch the Product object. I have read that using the variable `global $product` should return the WC_Project object, but when I do `the_post(); var_dump($product)`, `NULL` is returned. I tried to then create a Product object by doing `the_post(); $product = new WC_Product(get_the_ID())`, but when I did the `var_dump($product)` on that, it gave me general information about the product (`post_name`, `post_description`, etc), but nothing further than if I called `get_post()`. Can someone tell me what I have missed please?


title: register_nav_menus, then create menus programatically

text: I have a `register_nav_menus` call in my theme's functions.php:               //register nav menu and footer nav.     register_nav_menus(         array(             'main-nav'   => 'Main Navigation',             'footer-nav' => 'Footer Navigation'         )     );      This works fine, but I'd like to take the extra step of programatically creating a menu and assigning it to 'main-nav', set to automatically add new pages. This theme is being used as a starting point for a wordpress install, so I'd like to include this functionality to save a little bit of time on the repetitive tasks such as manually creating these menus via appearance -> menus. Does anyone know how to do this?


title: Remove comment section from new page

text: I am taking over a wordpress website at work. All of the pages currently do not have a 'Leave a Reply' comment section. When I make a new page, this section exists on the new page. How do I remove it? As far as I can see all of the options as far as the page goes are the same. I have already tried to uncheck 'Allow people to post comments on new articles' but it didn't do anything


title: wp_localize_script not create variable in head section

text: I try to make an ajax function in wordpress and I enqueued my script and declared my variables like this in `functions.php`:               function my_enqueue_scripts() {         wp_enqueue_script(             'load_post',              get_template_directory_uri() . '/js/load_post.js',              array( 'jquery' ),              '1.0',              1         );         wp_localize_script(              'load_post',              'wp_ajax',             array(                  'url' => admin_url( 'admin-ajax.php' ),                  'nonce' => wp_create_nonce( 'ajax_nonce' )             )         );     }     add_action('wp_enqueue_scripts', 'my_enqueue_scripts');      load_post.js :               jQuery(document).ready(function($) {               jQuery('#next-container').click(function($) {                  var $container = jQuery('#isotope-container');             var IDs = [];             jQuery(".element").each(function($){ IDs.push(this.id); });                  jQuery('#next-container').html('loading');                  jQuery.ajax({                 type: 'POST',                 url: wp_ajax.url,                 dataType: 'html',                 data: {  action: 'load_post',                            ajax_nonce: wp_ajax.nonce,                          post_ids: IDs,                         },  //{'post_ids[]': IDs },                 success: function(data) {                         jQuery('#next-container').html('');                          $container.isotope( 'insert', $(data));                          }             })         })     })      However in my `load_post.js` I can't get `wp_ajax` variable. I don't see any variable added in the head section of my source code in google chrome or IE. Where comes from my problem? Do I miss something?


title: pre_get_posts action doesn't work

text: I'm trying to load only two types of posts ( 'news' and 'reviews' ) in `home page` using `pre_get_posts`:               // Load Home Page Posts( reviews and news )     function search_home_posts( $query ) {         if( $query->is_home() && $query->is_main_query() && !is_admin() ) {             $query->set( 'post_type', array( 'reviews', 'news' ) );         }     }     add_action( 'pre_get_posts', 'search_home_posts' );      But it doesn't seem to do nothing, since all post types and pages are shown in the `home page`. Any idea of what is happening?


title: post var problem with shortcode loop

text:
I have a function to display the children of the page in the sidebar php file using wp_list_pages:               global $post; ?>
             <?php if($post->post_parent)             $children = wp_list_pages("sort_column=menu_order&title_li=&child_of=".$post->post_parent."&echo=0"); else             $children = wp_list_pages("sort_column=menu_order&title_li=&child_of=".$post->ID."&echo=0");             if ($children) { ?>
             <?php echo $children; ?>
      I have also created a shortcode that shows a custom post type using query posts:               function casestudy_shortcode()         {         extract(shortcode_atts(array(                 'type' => 'case_studies',                 'limit' => '1',                 'case' => '',                 'size' => 'small'                 ),$atts));                           //The Query             query_posts('post_type='.$type.'&showposts='.$limit.'&p='.$case);                  //The Loop            if ( have_posts() ) : while ( have_posts() ) : the_post();                        //return sb_post_image('100','100');                     //the_post_thumbnail('portfolio');                      return  "
".get_the_title()."" . get_the_excerpt() ."
";;                        endwhile; else:         endif;                       wp_reset_query();                          }         add_shortcode('casestudy', 'casestudy_shortcode');      The problem I have is that when the shortcode is in a page it makes the sub pages not show up. I assume it is overriding the $post variable. I have tried using wp_query and get_posts for the shortcode but i get the same result. Is there a way around this?


title: Adding a category at even positions on main loop with modified pagination

text: I have different categories showing over main loop. I want to add a specific category post at even positions of main loop. Example current post list with categories: cat1 cat1 cat1 cat1   required: cat1 catA cat1 catA cat1 catA cat1 catA I am using this to skip present category post, but couldn't add the desired category post into its place.               <?php if($wp_query->current_post%2==1 && in_category('cat1')) continue; ?>      Being amateur with wp my knowledge is limited. How can I do it? **UPDATE:** My logic is to use two loops on index.php, one with category and another excluding that category as this:                               <?php for($y=0;$y<5;$y++) { ?>                     <?php $off_num = ($paged-1)*5+$y; ?>                     <?php if(is_home()) query_posts("posts_per_page=1&cat=-1&offset=$off_num"); ?>                     <?php while ( have_posts() ) : the_post(); ?>                     <?php get_template_part( 'content', get_post_format() ); ?>                                      <?php endwhile; ?>                          <?php if(is_home()) query_posts("posts_per_page=1&cat=-1,-10&offset=$off_num"); ?>                     <?php while ( have_posts() ) : the_post(); ?>                     <?php get_template_part( 'content', get_post_format() ); ?>                                      <?php endwhile; }?>      Altogether this code shows 10 posts, do I need to add `wp_reset_query` or any other function like this? My Pagination too got messed up. Earlier their used to be 577 pages and now after this code, there are 2350 pages and those after 577 give 404 error. How change I remove above problems?


title: Using a number for limiting registering or banning on multisite

text: I want to ban people or limit registering on unique national ID (You can think it as 11 digit number). Is there any plugin or a code snippet you know? Site will based on MultiSite + BuddyPress. **Update:** I am not looking for IP ban. You can think it like phone number.. And every user must have 1 unique phone number and i need to ban that phone number if need. (Sorry for bad english)


title: WordPress book for graphic designers?

text: Is there a good WordPress book intended for graphic designers? I've started working with a friend in an arrangement where he designs a site and I build it in WordPress. This works great since I have the design sense of a blind monkey. He would like to learn more about WordPress and how best to design for it. I'm familiar with several good WordPress books, but most of them are intended for designer/developers. I'm looking for something that will serve as a guideline, offering suggestions for design conventions that are well suited to WordPress. Are there any such books? If there's not a book specifically aimed at designers, which other book would you suggest?


title: Close a wordpress blog - keep site as it is but prevent hacks

text: Last summer I created a travelling-blog on my webspace to document my journey. Now the journey is over and I won't put any new posts in this blog. I also don't whish to have any new comments. How can I close the blog (to make in invulnerable to external hacks, even if I don't install any new upgrades) but keep all posts, comments, pictures, etc. as they are? What I found is   * https://github.com/megumiteam/staticpress (however, although the resulting static page contains all the blogged content, the design is really messed up.)   * https://github.com/aral/wordpress-migration-tools (I couldn't try this one, because it is written in python and I don't know any python.) ~~Is one of them recommendable?~~ Is there another way to prevent all interactions with the page, so there's no need to take care about wordpress (or plugin) updates, while still keeping the site secure?


title: Script to get a list of all images that are detached?

text: In my functions.php, I have a need to list all images in the uploads folder which are not currently attached to a post in the WP database. It appears that every time an image is uploaded to the WP uploads folder (via FTP or via Media Manager), a records gets inserted in the WP database, right? How can I obtain a list of all images that are not currently attached to any post?


title: How to splice in wp_links links into the loop?

text: I want to create a loop where 2 or 3 items from my blogroll are spliced in like this:               <loop>         <post1>         <post2>         <blogroll1>         <post3>         <blogroll3>             </loop>      I'll be using images and excerpts for the loop, and the goal is to get the `wp_links` links to display EXACTLY like the `wp_posts`, so if I can actually splice in the links to the `$post` variable somehow and loop over them AS IF they were posts, that would be great. Getting the posts via `get_bookmarks` is easy, but how would I fake WP into thinking they're `$posts` and how would I splice them into the `$post` object?


title: Best Practices for Creating and Handling Forms with Plugins?

text: I'm writing a plugin that creates and handles a simple form. This has been my approach sofar, but it's turned out to have some major flaws: 1) On plugin activation, create a blank page for the form at mysite.com/form, and another blank page to process the form at mysite.com/processform. (They need to be separate pages with distinct URLs so that submissions can be tracked via google analytics. Otherwise, I'd just do all this via AJAX. I know, I know... not my decision.) 2) On the "wp" action, check to see what page we're on. 2a) If it's my form page, add a "the_content" filter to render the form (it needs some dynamic hidden elements like a nonce, which is why I didn't just include the form markup when I created the form page originally). 2b) If it's my processform page, add a "the_content" filter to process the POST and render any feedback. The major problem is with my POST handling. I'm hooking it to the "the_content" filter (because I need it to supply feedback), but this filter is sometimes run multiple times during a page load, causing the POST to be handled multiple times. I've included what I have below, but I can't help thinking I'm completely on the wrong track with my approach. How would you create and handle a form with your plugin if you needed it to hit a success URL (ie. not via AJAX)? My code:               <?php              // On activation, create the blank pages         function my_form_install() {                  // CREATE THE FORM PAGE             $page_markup = '';                  $arr_page_options = array(                 'post_status' => 'publish',                 'post_type' => 'page',                 'post_author' => 1,                 'post_title' => 'Form',                 'post_content' => $page_markup,                 'comment_status' => 'closed'             );                  // CREATE THE FORM PROCESSING/SUCCESS PAGE             $success_page_markup = '';                  $arr_success_page_options = array(                 'post_status' => 'publish',                 'post_type' => 'page',                 'post_author' => 1,                 'post_title' => 'Form Process',                 'post_content' => $success_page_markup,                 'comment_status' => 'closed'             );              }         register_activation_hook(__FILE__,'my_form_install');                   // On the wp action, check to see if this is one of our pages. If so, add our filters.         function check_current_page($obj_wp) {                  if(isset($obj_wp->query_vars["pagename"])) {                 $page_name = $obj_wp->query_vars["pagename"];                      switch($page_name) {                          case "form":                         add_filter('the_content', 'my_render_form');                         break;                          case "form-process":                         add_filter('the_content', 'my_process_form');                         break;                      }                     }              }         add_action('wp', 'check_current_page');              // Function to render the form         function my_render_form($page_markup) {                       $page_markup .= '<form method="post" action="/form-process">             <input type="text" name="some_input_field" />             <input type="submit" value="submit" />             </form>';                  return $page_markup;              }              // Function to process the form         function my_process_form($page_markup) {                  if($_POST) {                      // Do the form processing. This would involve many possible returns,                  // but I've just included one to simplify thigns.                 $page_markup .= 'Your form has been processed.';                  }                  return $page_markup;              }          ?>


title: Putting Text in the Search Box. eg- "Search My Site"

text: I would like to add some text in my blank search box for my blog. My Blog: www.bornsquishy.com Current searchform.php code:               <form method="get" id="searchform" action="<?php bloginfo('home'); ?>">         <input type="text" value="<?php the_search_query(); ?>" name="s">        <input type="submit" value="Go">     </form>      I'm sure it's a simple fix, but I no absolutely nothing about php. EDIT - Here's how I solved the problem:               <form method="get" id="searchform" action="<?php bloginfo('home'); ?>">        <input type="text" placeholder="Search My Site" value="<?php the_search_query(); ?>" name="s">        <input type="submit" value="Go">     </form>


title: Duplicate Posts using Feedwordpress

text: Feedwordpress has an issue with creating duplicate posts. This duplication does not happen predictably, however, so it is hard to debug it. I need to be able to reproduce duplicating posts before I can go any further. Has anyone been able to reproduce duplicate posts when a feed is updated using feedwordpress? If so, what steps did you follow to force a duplicate of a post to be created during an update to the feed? As an additional note, I do know that the GUID database field is not set in the duplicate post. This is one of the ways I am able to distinguish duplicates from the original. There could be 5 duplicates, all of which have no GUID set, but only one original with the GUID set.


title: Why is print_r returning $classObj->userObj in several places on site

text: I'm trying to learn how to interpret results from print_r for a bridge plugin I'm developing. **Background** My first issue was setting editor capabilities receiving administrator capabilities. While working on it, I realized that only the first two capabilities in the array were being added. This is now fixed. However, **Moving Forward** I've now started to go back and look at the calls being made and inserting in wp_die, var_dump, and print_r in places to see if the results are as expected. Now comes the question. **The results are not as expected and maybe someone can explain why**. **The Code** A file includes the function get_userdata( $user_id ). Within this file, there is a check for is_numeric, empty, and if !$user_id return false. Next, if !$user then to call a class which a method called fillUserData. The fillUserData is as follows:                   public static function fillUserData($visitor, $classObj, $user_id) {         if( $user_id != 0 ) {                  global $XF;                  $userModel = $XF->getModelFromCache('XenForo_Model_User');                  $user = $userModel->getUserById($user_id, array('join' => XenForo_Model_User::FETCH_USER_FULL));                  $classObj->userObj = $user;                      echo '<pre>';                 echo $user_id;                 print_r( $classObj->userObj[username] );                 echo '</pre>';                 //die();                  if( $user_id == $visitor->get('user_id') ) {                           // doing stuff                      return $classObj;                  } else {                      // doing stuff                      return $classObj;                  }         }               // return false;         echo 'This is a mess';          }         At this point I'm confused. I was expecting only one array returned. But several are returned within the theme (including default themes, etc). This first one shows at the top left of the theme and is absolutely the one I expected. [Update: To clarify, this array is definitely for the currently logged in user]                   Array     (     [user_id] => 3     [username] => Albert     [email] => albert@tuxreports.com     [gender] =>      [custom_title] =>      [language_id] => 1     [style_id] => 0     [timezone] => Europe/London     [visible] => 1      This next one is above the first post done by a different user. This totally is not what I was expecting. [Update: This array shows even when no one is logged into the site]                   Array     (     [user_id] => 1     [username] => LPH     [email] => lph@tuxreports.com     [gender] =>      [custom_title] =>      [language_id] => 1     [style_id] => 0     [timezone] => Europe/London     [visible] => 1     [user_group_id] => 2      These arrays are being returned above another post done by a different user .... and not what I expected since there is a if `( $user_id != 0 )` conditional. If I go into a single page then the print_r shows for that author of the post and not the user I'm logged in as ... **My question are:** Am I using $classObj->userObj = $user wrong? Why is the author of WordPress blog posts showing in a print_r when $user conditional suggests it should not? Hopefully that is enough information for someone to explain to me why this is not working as expected. My knowledge is very weak (at best). Of course, if I should not be calling the class within a pluggable function then please suggest a better method. Thank you!


title: Return function only on certain pages

text:
I'd like this function to only return on certain pages. How might i do that?               // Retreats Accordion     function retreats_accordion() {       ?>
          <?php             global $post;             $c = 0;             $class = '';             $args = array( 'posts_per_page' => 6, 'post_type'=> 'slide', 'slideshow'=> 'retreats');             $myposts = get_posts( $args );             foreach( $myposts as $post ) :  setup_postdata($post);             $c++;             if( $c == 6 ) $class .= ' last'; ?>             <a href="<?php echo get_post_meta($post->ID, "slide_url_value", true); ?>">                 <?php the_post_thumbnail('quickfinder'); ?>                          <div class="slide<?php echo $class;?>" style="width:200px;">
<?php the_title(); ?>
                 <?php the_content(); ?>
          <?php endforeach; ?>
                      <?php      }          add_action('nktframework_abovecontent', 'retreats_accordion', 10);      I've tried adding this to the function but it doesn't seem to work.               if( is_page(107) )         return;


title: Links to plugin files not resolving

text: Has anyone seen an issue where links to plugin files can't be resolved and results in 404 errors? For example, I have a plugin that drops a page template into the active theme directory, and this template file references a reset.css file. The reset.css file is found in the /wp-contet/plugins/[plugin-name]/templates folder. Everything is fine until you create a new page with the template and then view the page; the layout is wrong. When viewing the source, I see that the link to the reset.css file is correct (http://site.com/wp-content/plugins/plugin- name/templates/reset.css), but when I put that URL in the browser it results in a "page not found" error. I've tried deactivating other plugins, checked permissions, and turned on the debug log, but so far nothing has helped. Any ideas? o


title: How to switch between the Primary Menus programmatically?

text: Lets say i created 2 Different Primary Menus (in the Appearance > Menu .. section). Then in the (Theme Location > Primary Navigation) Section, i can set 1 Menu to be activated. So how can i switch between these Primary Menus at the runtime (Programmatically from the Frontend .. WITH A BUTTON CLICK or something) ?


title: How to retrieve a value via get_option when the option_value is stored in a multi-dimensional array?

text: I'm trying to determine how to retrieve custom values from wp_options when the values are stored in a single options array. For example, I've got the following data in wp_options for option_value where option_name = "my_category_fields_option". The i:n value represents the category id of the category that holds the custom "my_title" data] a:2:{i:10;a:1:{s:8:"my_title";s:48:"Iced Tea: A Great Choice for Cooling Refreshment";}i:20;a:1:{s:8:"my_title";s:30:"Black Tea is Good for the Soul";}} How would I retrieve the value for "my_title" (which should be "Hello World") when I'm viewing the category archive page for this category?


title: Filter any HTTP request URI?

text: I want to filter any HTTP request URI done through the HTTP API. Use cases:   1. The WordPress update check goes to http://api.wordpress.org/core/version-check/1.6/, but https://api.wordpress.org/core/version-check/1.6/ works too, and I want to use this always.    2. The new WordPress file is taken from http://wordpress.org/wordpress-3.4.2.zip, but https://wordpress.org/wordpress-3.4.2.zip works too.   3. Sometimes I want to debug requests and redirect those temporary to a custom domain on my local server.   4. Some plugins make requests to other servers, and I want to replace these requests when the external server goes down. The update requests are the most important ones for now, because there is still the unfixed bug 16778 (more information), and HTTPS requests lower the risk of a Man-in-the-middle attack. I have searched thoroughly, I have studied the core code … but ended up like Nacin two years ago: > I thought for sure you could filter the URL of an HTTP request, but now I > can't find one. What did I miss? Did I? :)


title: Is it possible to create relational metabox values in a custom post?

text: I have a custom post type (`'Model'`) for a sports modelling agency, and it requires the model to enter sports they are competent at, and also rank their ability from 1 to 5. For example, given the information: `Model: Joe Soap.   Football: 4.   Archery: 2` I would store this in the custom_post_type `'model'` with the fields: `Model Name: Joe Soap.   Sports: Football, Archery (taxonomy).   Rank: 4, 2. ` How do I associate `4` with `Football` and `2` with `Archery` using a metabox, where different models may have different sports in their lists ?


title: What is the difference between the "wp_footer" and "get_footer" actions?

text: I am working on developing a plugin, and I am trying to add a line of text to the bottom of the page, I see there are two actions that seems reasonable, `wp_footer()` and `get_footer()`. wp_footer sounds like it may more suited towards code that needs to go at the very end of the page (like JavaScript files), but get_footer didn't have any documentation on its wordpress codex page. Which should I use for something like this?


title: Why does this check to see if user is authorized to edit a post fail for all but super admins?

text: I'm trying to determine if a piece of content can be edited by a user. I would like all roles contributor and above to be authorized by a single check. Here's my code:                   if( empty( $post_id ) || !current_user_can('edit_post', $post_id) ) { return; }      Unfortunately, the only users that don't get the `return` are super admins. Any idea why?


title: add custom class to wp_nav_menu using filter hook nav_menu_css_class

text: I have a custom post type in my wordpress theme. I want to add a custom class to the nav menu for the pages created in that custom post type. I read that you can use a filter hook: "nav_menu_css_class", but my php chops are pretty limited. How do I set up that filter hook to apply only to my custom post type pages in the nav menu and give them a custom class?


title: Disqus: Get recent 5 comments

text: is it possible to get recent 5 comments of a specific disqus-account without using the (aweful) plugin? I want to put them into a content-slider and don't find any bit of API for that! Thaanks!


title: Get Current Custom Taxonomy ID by Post ID

text: If I know the current post id that i have in the variable $pid I use $terms = get_the_terms($pid, 'custom_category'); How do I get just the term id/term_taxonomy_id if I var_dump $terms I see what I want...but I have no idea how the heck to return just the id, not an array, just the id. Bare in mind...I less than 1/2 know what I'm doing...just face rolling keyboard to get what I want...but learning more everyday. Cheers, Brian


title: migrate comments from old database to new database

text: i recently created a new wp site with some of the same content from my old wp site. is there a way to migrate comments from my old database to me new database? i tried importing old the wp_comments table into my new db via phpmysql. they did import and appeared in my wp admin, but they weren't associated with the correct posts and categories. looking at the .sql file i'm guessing that this didn't work because the old comments all have different comment_post_IDs from my new db. is there a way around this or another way to migrate the old comments? thanks!


title: Trigger scheduled cron events upon logged-in user visit

text: I am building an entirely private site where only the wp-login.php page can be viewed by non-logged-in users. After an entire day of debugging I've come to realize that non-logged-in user visits are what trigger wp_cron scheduled actions. Even though none of the documentation suggests this, and neither did I even find anything about this when reading the core code, my testing is very consistent in showing this result. My question is: **how can I fire cron jobs created with wp_schedule_event on a site that does not allow non-user visitors?** * * * -EDIT-  It turns out that my privatizing script was causing the issue because I was loading on the "init" action hook. Checking for is_logged_in on "parse_request" kept the site secure while still allowing cron to run. The issue was that wp_cron runs on "init" also.


title: Options page for widget

text: I started developing a plugin which only required a few options. But over time the number of settings grew, and I want to move most of them to a separate page. I've seen quite a few tutorials about options pages and about widgets, but I couldn't find one that explained how to create an options page for a particular widget. How can this be achieved ? I intend to keep only a couple of settings that would affect individual instances, and the rest would be global, and on the options page.


title: Multiple pages on one with different HTML

text:
I am a bit confused on how this may be achieved. I have a website that I have coded already with static HTML/CSS and I am trying to incorporate it into wordpress. The challenge though is that the website is single page index.html file with 4 "sections". I want each section to be a page that can be accessed by anyone to edit the content at a later date. I have figured out how to get the page to loop out my four pages through other stackoverflow resources, however the challenge I am facing is the HTML markup. Is there a way to make each section loop out different HTML for that given section? Each section is formatted differently. For example, section one may have 4 divs, while section three has one div and it is a different ID. The current loop only will loop out the same kind of HTML. I've read about custom fields which I plan to incorporate for specific parts of the sections, but from a wider scope, I can't figure out how to get different HTML markup for each section first.               <?php $pages = get_pages();       foreach ($pages as $page_data) {       $content = apply_filters('the_content', $page_data->post_content);       $title = $page_data->post_title;     $slug = $page_data->post_name;          echo "
";     echo "
$title
";     echo $content;     echo "
";     }     ?>


title: How to speed up a wordpress function with multiple loops?

text:
![enter image description here](http://i.stack.imgur.com/laOV6.jpg) I am a PHP novice and wrote this function. It is an alphabetical navigation which shows only the letter that have posts in both that letter and the currently filtered "genero" taxonomy term. I use multiple taxonomy queries to find "artistas" posts that, for example, are tagged as both "rock" and "funk". The function works perfectly and outputs exactly what I want it to, but... The multiple loops are really lagging the load time and, being the n00b that I am, am uncertain of how to optimize the function. Any pointers or guidance would be **VERY** much appreciated. If you want I can trade time for time (i write some mean CSS) :) thank you!               <?php         function bam_artist_alfa() {                 $taxonomy = 'alfa';                   $uri = my_url();                 $home = 'http://buenosairesmusic.com/';                      // save the terms that have posts in an array as a transient                 if ( false === ( $alphabet = get_transient( 'bam_archive_alphabet' ) ) ) {                     // It wasn't there, so regenerate the data and save the transient                     $terms = get_terms($taxonomy);                          $alphabet = array();                     if($terms){                         foreach ($terms as $term){                             $alphabet[] = $term->slug;                         }                     }                     set_transient( 'bam_archive_alphabet', $alphabet );                 }                       if(strstr($uri, '/artista/') ) {                     $uri = str_replace('/artista/','/?alfa=', $uri);                     $uri = substr_replace($uri ,"",-1);                 }                      $all_link = removeqsvar($uri, 'alfa');                 $last = $all_link[strlen($all_link)-1];                       if($last == '?') $all_link = substr_replace($all_link ,"",-1);                      if($all_link == $home)                      $all_link = $home.'artistas';                      if( isset($_GET) && isset($_GET['alfa']) ) {                     $is_alfa = (!is_tax('alfa') && !$_GET['alfa'] ? false : true );                 } else {                     $is_alfa = (!is_tax('alfa') ? false : true );                 }                      $all_current = ($is_alfa == true ? null : ' bg1 round-res' );                       ?>
                             <li class="all-link<?php echo $all_current; ?>">                             <?php if(!$is_alfa) { echo 'A–Z'; } else { ?>                                      <a href="<?php echo $all_link; ?>">A–Z                             <?php }?>
         <?php             $query = $_SERVER['QUERY_STRING'];             $genre = null;             $orden = (isset($_GET) && isset($_GET['orden']) ? '&orden=fecha' : null);                  if( strstr($uri,'/genero/') ) {                 $genre = str_replace('/genero/','/?genero=', $uri);                 $genre = substr_replace($uri ,"",-1);                 $genre = explode('/',$genre);                 $genre = end($genre);             } elseif( isset($_GET) && isset($_GET['genero']) ) {                 $genre = $_GET['genero'];             }                  if(!empty($genre)) {                 $spaces = strpos($genre,' ');                 $genre = ($spaces === false ? $genre : explode(' ', $genre) );             }                  function has_artists($i, $genre) {                      if(empty($genre)) {                     $termquery['tax_query'] = array(                         array(                             'taxonomy' => 'alfa',                             'terms' => $i,                             'field' => 'slug',                         ),                     );                          $termquery['post_type'] = 'artistas';                 } else {                     $alfaquery[] = array(                         'taxonomy' => 'alfa',                         'terms' => $i,                         'field' => 'slug',                     );                          if(is_array($genre)) {                         $genres[] = array(                             'taxonomy' => 'genero',                             'terms' => $genre,                             'field' => 'slug',                             'operator' => 'AND'                         );                           } else {                         $genres[] = array(                             'taxonomy' => 'genero',                             'terms' => $genre,                             'field' => 'slug',                               );                     }                     $termquery['tax_query'] = array_merge($genres, $alfaquery);                     $termquery['tax_query']['relation'] = "AND";                     $termquery['post_type'] = 'artistas';                 }                      $has_artists = get_posts($termquery);                      if($has_artists) {                     return true;                 } else {                     return false;                 }             }                  foreach(range('a', 'z') as $i) :                       $current = ($i == get_query_var($taxonomy)) ? "bg1 round-res" : "menu-item";                      if(empty($genre)) {                     $link = $home.'?alfa='.$i.$orden;                 } else {                     $genrestring = (is_array($genre) ? implode('+',$genre) : $genrestring = $genre );                     $link = $home.'?alfa='.$i.'&genero='.$genrestring.$orden;                 }                      if ( has_artists($i,$genre) && $i != get_query_var($taxonomy) ){          ?>                                  <li class="<?php echo $current; ?>">                                 <?php printf('%s', $link, strtoupper($i) ) ?>
             <?php } else { ?>                                  <li class="<?php echo $current;  if($i != get_query_var($taxonomy)) {echo ' empty';} ?>">                                 <?php echo strtoupper($i); ?>
             <?php                  }                 endforeach;             ?>
         <?php } ?>


title: Echo author ID in author.php

text: This is probably a super simple question. But how do I echo the ID of a user on author.php? I've tried               the_author_meta('ID')      But it didn't seem to want to work. I want to echo it at the end of a URL, for example; http:///www.domain.com/author/sampleauthor-id Obviously, where "id" is that particular author's ID Any ideas?


title: Get wordpress stored cookies for custom login

text: I've created a custom login box. I'm using `wp_signon()` method. Everything works well. Also i have a Remember me checkbox so i can remember user credentials next time. I know i can do it my own way of handling cookies but i want know is there any wordpress builtin method to get cookies. This is my code so far:               $creds['user_login'] = $user_login;     $creds['user_password'] = $user_pass;     $creds['remember'] = ($remember_me === "true") ? true : false;          $user = wp_signon( $creds, false );      I can see `auth` cookies on Firebug Cookies tab but they are appended with hashes. How can i decrypt them or any safer method to get cookies. I've also seen in `utils.js` and there are some methods to get and set cookies but it only gets plain text cookies. (Correct me if iam wrong). Simply i want the data that Wordpress has stored in the cookies when logged in. After logout and return to my login box it can fill my login box with username and password (Like wordpress default login page).


title: Login from Mobile Phone

text: I use the "Member Access" Plugin to restrict the content of my Blog to registered users only. This works from a PC with no problem. But if I want to login from my Android Phone the login page always displays no matter if I input correct credentials or not. I don't get logged in. I deactivated all other plugins and used the TwentyEleven Theme. How can I login from a mobile device?


title: which action to hook to in order to perform post-publish action

text: I have some functionality I've written in order to post the title and link for the post to twitter whenever a post is published. I'm wondering which wp function to hook this to? save_post has no real reference documentation. Basically I just want to run an action when a post is successfully published. Thanks very much.


title: Tag-post relationship problem

text: tag is not working in wordpress like it is supposed to. When I add tag to a custom post type it shows up in tags list and the relationship can be seen in the `term_relationships` table and the tags are seen in the posts when I edit the page.But the post count for tag remains zero and the link of the tag does not give me the posts related to the tags.For example               mysite.com/tag/mytags      does not give me the posts related to this tag. I have tried this manually as in i have used these also wp_insert_term and wp_set_post_term and the problem is same. this problem is only when I use custom post type.But when I use post type:post.This works perfectly.Is there somethig that I am missing? Thanks in advance


title: Can i merge 2 new WP_Query($variable) 's?

text: I am running a multisite network and i have setup a sql query that uses swith_to_blog(); and queries the posts. Is there a way that i can declare the query inside a new WP_Query and actually merge that query with another? Basically if i do this:               $number1 = new WP_Query($multisitequery);      Can i merge it with:               $number2 = new WP_Query($normalquery);      `$normalquery` holds settings like pagination, per page, excerpt, title etc... on a portfolio shortcode. I would like it to include queried posts from my new `$multisite` query. Can this be achieved? Just wanting to save me from creating a whole new shortcode setup lol Many thanks in advance. Rory _**EDIT========_** What i have is:               $portfolio = array();     $portfolio = $settings;      Further down my portfolio function "after all the $settings['options']" i have:               $portfolio_query = new WP_Query( $portfolio );      the `$portfolio_query` uses a loop on a page template. I want to add an extra query into this like so:               global $wpdb, $blog_id, $post;          $blogs = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM wp_blogs ORDER BY blog_id" ) );          $globalcontainer = array();          foreach ($blogs as $blog){             switch_to_blog($blog->blog_id);             $globalquery = query_posts($args);             $globalcontainer = array_merge( $globalcontainer, $globalquery );             restore_current_blog();     }      where i assume that `$globalcontainer` would be the array to merge into the `wp_query();`. So taking onboard what you have replied with, in theory i could simply:               $mergedqueryargs = array_merge($portfolio , $globalcontainer);     $portfolio_query = new WP_query($mergedqueryargs);      Would that be correct? Second, regarding the array_merge array key overwrite..... How would i go about stopping an overwrite?


title: How to filter the role selector?

text: I know that roles in WordPress are not hierarchical, but I'm wondering if there is any type of capability to "assign users to roles". All I can see if being able to add users or not. The real kicker here is, I've used Justin Tadlock's Members plugin to create a new role, called "Clients" which removes all the stuff they should either not need to see, or shouldn't be able to control - which works great.   But, if I give them the ability to create a new user, they can also choose my "super admin" role, which can see everything. So, in a way, they kinda cheat the system a little bit. Is there anyway to "hide" a certain role from showing up in what a user can set a new user/edit a user to? Or, possibly remove the role identifier from the add/edit user screen based on their role?   I know it sounds a bit off of what WordPress is mean to do for user permissions, but from an administrative stand-point, it sounds useful - at least in my head ;) Thanks!


title: wp_nav_menu: show menu only if one exists, otherwise show nothing

text: I'm trying to use wp_nav_menu to only display a menu if one exists, otherwise, display nothing. If I delete the menu, it will output a list of the pages. My functions.php file contains:               if (function_exists('register_nav_menus')) {     register_nav_menus (     array('main_nav' => 'Main Navigation Menu'));}      How can I use wp_nav_menu to only display a menu if one exists, otherwise show nothing?


title: Convert javascript running xml files to wordpress platform

text: I have a website I want to convert over to the wordpress platform. On the existing site I use some javascript to pull in images and text from xml files. Can I still get this to work in a wordpress template? Website: http://www.icdesign.co.nz/index.php


title: Get template part vs locate template function

text: I'm in single.php where I'm trying to get related-posts.php template. The problem is that when using get template part the related-posts.php isn't getting custom taxonomy name from single.php in `wp_Query`. The solution is getting the wp post terms once again in related-posts.php in order to use `get_template_part`. But technically it shouldn't be required since parent (single.php) is already having it. But when I use locate template function it works fine. I feel that this method would be slower than `get_template_part`. What should I do?


title: get category name in admin screen

text: I want to get the name of the category that I am editing posts in. So I have this code that I found here                function add_custom_submenus() {       global $submenu, $post;       $submenu['edit.php'][] = array(     __('Back'), // menu title     'edit_posts', // menu cap     'edit.php?category_name=' . $category_name // menu link       );     }      My link shows great. I know the page that I need to go back to. I am just having trouble finding the name of the page. The admin screen shows                edit.php?category_name=band-member      band-member is the name of the category that I am editing posts in. So I was trying to create a link back to the band-member posts page. I can't figure out the php to get the name of the category of the current post that I am editing.


title: Querying two taxonomies

text: I've got two taxonomies: "type of guide", and "tools". They look something like this: **Type of guide**               - Article     - Video     - Cheat sheet      **Tool** — Learning Management System   * Quiz Tool              - Hide a grades column (article)     - Creating a Gradebook (article)     - Long Answer Question Steps (article)     - Matching Questions (article)     - True or False (article)          - Using the Quiz Tool (video)          - Using the Quiz Tool (cheat sheet)        * Notifications tool   * Grades Tool The screenshot outlines the problem perfectly: I need to limit that tax-query to include only items that are tagged with "Quiz Tool". Screen: http://cl.ly/0t3J143q0A1X2w2y2X2n I'm trying to do it with a tax_query, with an AND relation:               $args = array(             'tax_query' => array(                 'relation' => 'AND',                  array(                     'taxonomy' => 'guide-type',                     'field' => 'slug',                     'terms' => 'video'                 ),                 array(                     'taxonomy' => 'tool',                     'field' => 'slug',                     'terms' => what do I put here to get the current tool (Quiz tool)?                      )             )         );         $query = new WP_Query( $args );      But I just can't figure out how to limit to only list items that are tagged with "Quiz Tool". Note the, "what do I put here" part. Help appreciated. UPDATE: It just occurred to me that I don't have to query both taxonomies, instead exit the tax_query and use a 'get_the_category()' as part of the $args:               // The Query         $args = array(             'tax_query' => array(                 array(                     'taxonomy' => 'guide-type',                     'field' => 'slug',                     'terms' => 'self-paced '                 )             ),              'category_name' => get_the_category()      Something like that? Any ideas how I could limit that 'category_name' to be the current one I'm looking at (Quiz Tool). Terry


title: Wordpress installed in subdirectory - Apache serves 404s

text: I am developing a series of sites (for multi language purposes) installed with one instance of Wordpress in the server root, then further instances in country-code subdirectories. So there are installs at the following example URLs:               http://example.com     http://example.com/en     http://example.com/fr      etc. The root directory install has a theme to deal with language detection and forwarding to relevant sub directory, as well as various other redirection functions. The problem is that when trying to access a "pretty" permalink on one of the sub-installs, eg http://example.com/en/page-name, Apache intercepts and serves a 404 before the subdirectory install gets a chance to decipher and redirect the permalink. The odd thing is that on my localhost dev setup (MAMP), this setup works fine and these links resolve to the correct pages on the subdirectory WPs. This site is on AWS running Amazon Linux AMI release 2014.03. I suppose the question is essentially, is it possible to stop Apache trying to deal with 404s within certain subdirectories and leave this entirely to WP, or, some way of changing one of the .htaccess files to achieve similar. The suggestion at http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory#Using_a_pre- existing_subdirectory_install won't work due to WP also being installed in root. Thanks.