title: Notice: Trying to get property of non-object in : custom fields category

text:
I have custom fields in my category. I'm using this tutorial to add custom fields to my categories. I'm trying to output one of the custom fields on my category.php template but I'm unable to do so. The code I added to my template is:               <?php      $term_slug = get_query_var( 'term' );     $taxonomyName = get_query_var( 'taxonomy' );     $current_term = get_term_by( 'slug', $term_slug, $taxonomyName );     $term_id = $current_term->term_id;     $saved_data = get_tax_meta($term_id,'text_field_id');     echo $saved_data;     ?>      I have turned on debugging on and it shows error: > Notice: Trying to get property of non-object in > /var/www/animedownloads.nu/public_html/wp- > content/themes/twentytwelve/category.php on line 26 Here's the template code:               <?php     /**      * The template for displaying Category pages      *      * Used to display archive-type pages for posts in a category.      *      * @link http://codex.wordpress.org/Template_Hierarchy      *      * @package WordPress      * @subpackage Twenty_Twelve      * @since Twenty Twelve 1.0      */          get_header(); ?>

                          <?php if ( have_posts() ) : ?>
<?php printf( __( 'Category Archives: %s', 'twentytwelve' ), '' . single_cat_title( '', false ) . '' ); ?>
     <?php     $term_slug = get_query_var( 'term' );     $taxonomyName = get_query_var( 'taxonomy' );     $current_term = get_term_by( 'slug', $term_slug, $taxonomyName );     $term_id = $current_term->term_id;     $saved_data = get_tax_meta($term_id,'text_field_id');     echo $saved_data;     ?>                             <?php if ( category_description() ) : // Show an optional category description ?>
<?php echo category_description(); ?>
                             <?php endif; ?>                                                               <?php                             /* Start the Loop */                             while ( have_posts() ) : the_post();                                          /* Include the post format-specific template for the content. If you want to                                      * this in a child theme then include a file called called content-___.php                                      * (where ___ is the post format) and that will be used instead.                                      */                                     get_template_part( 'content', get_post_format() );                                  endwhile;                                  twentytwelve_content_nav( 'nav-below' );                             ?>                          <?php else : ?>                             <?php get_template_part( 'content', 'none' ); ?>                     <?php endif; ?>

          <?php get_sidebar(); ?>     <?php get_footer(); ?>      Anyone know how to fix this?


title: Create XML sitemap in wordpress

text: This question has already been asked before, however, I cannot reply to those comments because I am a new user. Therefore, I will post my question here. I am trying to create a XML sitemap for my wordpress site. Someone on this site suggested that a duplicate of the XML export file be made. This file is located here. How can I modify this file in my theme so that it is updated automatically? Where will the exported file be located?


title: when FS_METHOD = 'direct' is chosen?

text: According to the Wordpress Codes `FS_METHOD = 'direct'` is chosen when **appropriate**. > (Primary Preference) "direct" forces it to use Direct File I/O requests from > within PHP, this is fraught with opening up security issues on poorly > configured hosts, This is chosen automatically when appropriate. http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants What is the criteria to be appropriate?


title: wp_mail_from not changing from address

text: I wish to use the wp_mail_from hook to change the from email address submitted through a form which sends an invitation to a friend by email (I am writing my own plugin to do this). I am using the following code to at present but I cannot see what I am doing wrong as the from email address is not set at all and goes to the default:               function() {         $this->from_email = $_POST['your_email'];              add_filter( 'wp_mail_from', array( $this, 'set_from_email' ) );              wp_mail( $to, $subject, $message);     }          function set_from_email() {         return $this->from_email;     }      As far as I can tell this should work flawlessly and out of the box but I have tried for hours at no avail hence, my question. FYI I am using this function inside a class but I do not think that should change anything. Many thanks, nav


title: Bug in wp_insert_post script and form, probably something simple I am not seeing

text:
OK, I have been working on debugging this script for 2 and a half days now and am coming up empty. Basically, this is a front end form that will insert posts based on the script that I wrote for it at the top of the template page. I am getting a blank screen every time the page loads and no debug output at all and there are no lines in debug.txt ( do have the proper settings in wp- config). Usually when I work this hard on debugging it ends up being something simple or stupid that my mind is blocked to, here is the code:                   <?php     /*     Template Name: Create Group Pages     */     ?>          <?php     if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) &&  $_POST['action'] == "new_post") {              // Do some minor form validation to make sure there is content         if (isset($_POST['submit'])) {                 $error = "";                  if (!empty($_POST['title'])) {                 $title = $_POST['title'];          } else {             $error .= "Please add a title
";         }                  if (!empty($_POST['cat'])) {                 $post_category = $_POST['cat'];          } else {             $error .= "Please select a school.
";         }                  // ADD THE FORM INPUT TO $new_post ARRAY             if (empty($error)) {                 'post_content'      =>  '',/**MUST STAY BLANK!**/                 'post_name'         =>  $post_title,                 'post_title'        =>  wp_strip_all_tags( $_POST[ 'post_title' ] ),                 'post_status'       =>  'publish',                 'post_type'         =>  'page',                 'ping_status'       =>  'closed',                 'post_parent'       =>  $post_parent, /**Needs to be changed to capture data from parent selections**/                 'post_password'     =>  '12345',                 'comment_status'    =>  'closed',                 'post_category'     =>  wp_strip_all_tags( $_POST[ 'cat' ] ),                 'page_template'     =>  'Teacher Group Page Template'             );                  //SAVE THE POST             $pid = wp_insert_post($new_post);                  //REDIRECT TO THE NEW POST ON SAVE             $link = get_permalink( $pid );                  } // END SAVING POST         } // END VALIDATION     } // END THE IF STATEMENT THAT STARTED THE WHOLE FORM          //POST THE POST NOW     do_action('wp_insert_post', 'wp_insert_post');     ?>          <?php get_header(); ?>

                          <?php                             if (!empty($error)) {                                 echo '
Your page was NOT created
 The following error(s) returned:
' . $error . '
';                             } elseif (!empty($success)) {                                 echo '
' . $success . '
';                             }                         ?>
             <form id="new_post" name="new_post" method="POST" action="" enctype="multipart/form-data">                                  <fieldset name="name">                     Post Title:                     <input type="text" id="post_title" value="" tabindex="5" name="post_title" />                 </fieldset>                                       <fieldset class="category">                     School:                     <?php wp_dropdown_categories('orderby=name&hide_empty=0&exclude=1&hierarchical=1'); ?>                 </fieldset>                                       <fieldset class="parent">                     Pick the school this class is from:                     <?php $parent_args = array( 'depth' => 1 , 'child_of' => '1094'); wp_dropdown_pages( $parent_args ); ?>                 </fieldset>                      <fieldset class="submit">                     <input type="submit" value="Create Page" tabindex="40" id="submit" name="submit" />                 </fieldset>                      <input type="hidden" name="action" value="new_post" />                 <?php wp_nonce_field( 'new-post' ); ?>             </form>

                <?php get_footer(); ?>      I have narrowed it down to the code between the opening php tag and the `<?php get_header(); ?>` because when I remove that section, the form loads, not styled, but it loads. Anything obvious I am missing here? **_EDIT - NEW CODE_** OK, so I basically did more research and started from scratch nearly and took out nearly all of the validation for now to make things simpler. It actually creates the page now, but there are problems...it seems as though it is not passing some of the variables to the page creation. For example, it is passing the fact that it is password protected but nothing else really - no title (it is actually blank), no page template, I believe it does actually get published. So it seems I am getting a little closer. Oh, and another issue is that once it creates a page, it redirects to another page that is actually the parent page of the page I am creating, though the URL is still the one listed above. If I hit refresh, it prompts me to resubmit form, and it will create a new page upon each refresh. Here is the new code:               <?php     /*     Template Name: Create Group Pages     */     ?>          <?php          $post_title_error = '';          if ( isset( $_POST['submitted'] ) && isset( $_POST[ 'post_nonce_field' ] ) && wp_verify_nonce( $_POST[ 'post_nonce_field' ], 'post_nonce') ) {              if ( trim( $_POST['post_title'] ) === '' ) {             $post_title_error = 'Please enter a title.';             $has_error = true;         }          }          $new_post = array(         'post_content'      =>  '<?--All handled by template file, no need to type anything here -->',/**MUST STAY BLANK!**/         'post_name'         =>  wp_strip_all_tags( $_POST[ 'post_title' ] ),         'post_title'        =>  wp_strip_all_tags( $_POST[ 'post_title' ] ),         'post_status'       =>  'publish',         'post_type'         =>  'page',         'ping_status'       =>  'closed',         'post_parent'       =>  wp_strip_all_tags( $_POST[ 'post_parent' ] ), /**Needs to be changed to capture data from parent selections**/         'post_password'     =>  '12345',         'comment_status'    =>  'closed',         'post_category'     =>  wp_strip_all_tags( $_POST[ 'cat' ] ),         'page_template'     =>  'Teacher Group Page Template'         );              $new_pid = wp_insert_post( $new_post );              if ( $new_pid ) {             wp_redirect( home_url());             exit;         }     ?>               <?php get_header(); ?>          <?php if ( $post_title_error != '' ) { ?>         <?php echo $post_title_error; ?>

     <?php } ?>          <form action="" id="create-class-groups-form" method="POST">              <fieldset>             Post Title:             <input type="text" name="post_title" id="post_title" class="required" value="<?php if ( isset( $_POST['post_title'] ) ) echo $_POST['post_title']; ?>" />              </fieldset>
School:
             <?php wp_dropdown_categories('orderby=name&hide_empty=0&exclude=1&hierarchical=1'); ?>
What Class is this school from:
             <?php $parent_args = array( 'depth' => 1 , 'child_of' => '1094'); $post_parent = wp_dropdown_pages( $parent_args ); ?>              <fieldset>             <input type="hidden" name="submitted" id="submitted" value="true" />             <?php wp_nonce_field( 'post_nonce', 'post_nonce_field' ); ?>             <button type="submit">Add Class</button>         </fieldset>          </form>           <?php get_footer(); ?>


title: How to load a post into an empty div tag anywhere across the pages?

text: Absolute beginner question: I need to load text into specific div tags across the page. On my html mockup its a lorem ispum text box waiting for wordpress to load the real content. So, how do i control the real content and its relation with the div box text on the page? Can it be a post, so i can manage it from the dashboard? Thanks in advance.


title: Use Ajax To get posts from custom post type?

text: I am using isotope to show post from post type. But the problem is i have paging and i cannot filter post by using isotope, its only filter in one page, and cannot get post from other page, So, i need now to change this query by ajax               $wp_query = new WP_Query( array(                    'posts_per_page' => 12,                     'post_type' => 'interviewdoctor',                     'paged' => $paged                      ,'meta_key' => 'category_interviewdoctor' ,                     'meta_value' => '89915'                 ) );         this query must change when select any cat from this :-                 <?php          $rests = get_posts("post_type=catinterview&showposts=-1");                  if(!empty($rests))                  {                     foreach($rests as $rest)                     {                         ?>                         <a href="#" data-filter=".<?php echo $rest->ID?>"><?php echo $rest->post_title?>                         /                                               <?                               }                  }                        ?>      What can i do??


title: WordPress Featured Image on Custom Import

text: I'm working on customizing import plug-in and I'm facing hardness assigning a featured image while importing the data. I'm uploading the images to a custom folder via FTP and each post in the CSV import file is assigned with image file name that is already uploaded in my **/root/wp-content/uploads/p** folder.                       $id = wp_insert_post($new_post);                  $arrExt = array(                 "gif"  => IMAGETYPE_GIF,                 "jpg"  => IMAGETYPE_JPEG,                 "jpeg" => IMAGETYPE_JPEG,                 "png"  => IMAGETYPE_PNG             );             if (substr($data['csv_post_url'], -1) !== '/')              {$url_location = $data['csv_post_url'].'/';}              else {$url_location = $data['csv_post_url'];}                  $thumbnail_name = $data['csv_post_thumbnail'];             $ext = pathinfo($thumbnail_name, PATHINFO_EXTENSION);             $wp_filetype = image_type_to_mime_type($arrExt[strtolower($ext)]);             $attachment = array(                 'guid' => $url_location . $thumbnail_name,                  'post_mime_type' => $wp_filetype,                 'post_title' => preg_replace('/\.[^.]+$/', '', basename($thumbnail_name)),                 'post_content' => '',                 'post_status' => 'inherit'             );                  $attach_id = wp_insert_attachment( $attachment, $thumbnail_name, $id );                  // you must first include the image.php file             // for the function wp_generate_attachment_metadata() to work             require_once ABSPATH . '/wp-admin/includes/image.php';             $attach_data = wp_generate_attachment_metadata( $attach_id, $thumbnail_name );             wp_update_attachment_metadata( $attach_id, $attach_data );             add_post_meta($id, '_thumbnail_id', $attach_id); // adds the featured image      The post is getting imported and the image post is being imported in the "wp_posts" table and the "_wp_attached_file" and the "_thumbnail_id" are being imported in the "wp_postmeta" table and I don't know why it's not displaying the photo. The thumbnails are not being generated.I don't see the "_wp_attachment_metadata" imported, how do I generate and import that meta record? What am I missing?


title: WP Bootstrap Horizontal Menu for Child Items

text:
I have bootstrap 3 integrated into my custom WP theme. I am using navwalker and WP's built in menu. Everything is working great, but I would like the child items of my parent level to be displayed in horizontal lists rather than the default. Something similar to what you see here on the DropDown button. http://bootsnipp.com/snippets/featured/large-dropdown-menu I'm really not sure where to begin. I'm not sure if this can simply be accomplished through some added CSS or if I need to tap into Wordpress more. This is my current menu code:
         <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">           Toggle navigation                                          </button>          Menu

             <?php             wp_nav_menu( array(     'theme_location' => 'topmenu',     'depth' => 4,     'container' => false,     'menu_class' => 'nav navbar-nav nav-justified',     'fallback_cb' => 'wp_page_menu',     //Process nav menu using our custom nav walker     'walker' => new wp_bootstrap_navwalker())     );             ?>


title: WooCommerce Variable Product Price - Where is "From" text generated from?

text: The following code from github will add "- [max price]" to all variable products displayed in product archives. I am wondering how I could also remove the "From" text inside the same filter.               add_filter('woocommerce_variable_price_html', 'custom_variation_price', 10, 2);          function custom_variation_price( $price, $product ) {               $price = '';               if ( !$product->min_variation_price || $product->min_variation_price !== $product->max_variation_price ) $price .= '' . _x('From', 'min_price', 'woocommerce') . ' ';               $price .= woocommerce_price($product->get_price());               if ( $product->max_variation_price && $product->max_variation_price !== $product->min_variation_price ) {               $price .= ' ' . _x('-', 'max_price', 'woocommerce') . ' ';                    $price .= woocommerce_price($product->max_variation_price);          }               return $price;     }      I noticed this question answers how to remove the From text using the same filter parameters, but I haven't been able to figure out how this works.


title: Session alternative for plugins (due to caching)

text: I'm building a plugin that picks a random post from the database and delivers the result dynamically to the user. For certain aspects I need to know the post ID that's been randomly selected. Session data would work perfectly for this if it weren't for website caching. When a site is cached, the post that is supposed to load dynamically, based on the session data, doesn't load anything. What alternatives do I have to using `$_SESSION`?


title: How to hide title on 'highlights' - Themify feature

text: I am using Themify's Flat theme and in the Highlights I want to hide the title of my highlights. Any ideas on how to do this? Thanks in advance.


title: Wordpress cannot see that plugins require new update

text: My Wordpress installation is using two plugins that it cannot see actively require an update. I am using several plugins, but the Stop Spammer Registration plugin and the S2member plugin cannot see that there is an update available to them. I am using Wordpress version 2.7.1, which I know uses the auto-update feature, but I don't think this has anything to do with my issue. My plugin update process is to first update the plugin on my localhost, then to merge this code into my master branch with GIT. Then I run the updates on live and pull in the new code. This lets me run a series of tests to make sure the new plugin updates will work, but right now, my localhost is not aware that these plugin updates exist. I can see from the Stop Spammer Registration and the S2member sites that there is a new version of each of these plugins. Is there a way to jump start Wordpress so that it knows to look for these plugins? Are these updates just so new that my machine has not checked for them yet today? I want to be able to update these plugins but I'm not sure how to get Wordpress to let me do this. Thank you to anyone that can help.


title: Define Mutiple Header Images Using the Theme Customization API

text: The Header Image control from the Theme Customization API allows for a **single** header image to uploaded and used sitewide. Using this control, is it possible to save to a custom setting to allow for **multiple** header images?               $wp_customize->add_control(         new WP_Customize_Header_Image_Control(             $wp_customize,             'one_of_many_great_header_images',             array(                 'label' => 'One of Many',                 'section' => 'a_custom_section_id',                 'settings' => 'my_very_own_setting',                 'priority' => 10,             )         )     );      The hope is that this would work similar to the `WP_Customize_Image_Control`, but with the added header image functionality (like using `register_default_headers()` and enforcing dimensions).


title: Cannot access WordPress login pages

text: I cannot access either wp-admin, or wp-login.php on a wordpress site. I'm **not** getting a 404, or a redirect, it simply says cannot connect in firefox. I have tried everything relevant on this guide and also this guide, but nothing helps, still the same error.


title: How to retrieve the options from this options page?

text:
I like to write a plugin with an options-page from the WordPress-Codex, but I cannot retrieve the options. `get_option('your_option');` does not work. Here is the options page code:               <?php     class MySettingsPage     {         /**          * Holds the values to be used in the fields callbacks          */         private $options;              /**          * Start up          */         public function __construct()         {             add_action( 'admin_menu', array( $this, 'add_plugin_page' ) );             add_action( 'admin_init', array( $this, 'page_init' ) );         }              /**          * Add options page          */         public function add_plugin_page()         {             // This page will be under "Settings"             add_options_page(                 'Settings Admin',                  'My Settings',                  'manage_options',                  'my-setting-admin',                  array( $this, 'create_admin_page' )             );         }              /**          * Options page callback          */         public function create_admin_page()         {             // Set class property             $this->options = get_option( 'my_option_name' );             ?>
                 <?php screen_icon(); ?>
My Settings
                            <form method="post" action="options.php">                 <?php                     // This prints out all hidden setting fields                     settings_fields( 'my_option_group' );                        do_settings_sections( 'my-setting-admin' );                     submit_button();                  ?>                 </form>
             <?php         }              /**          * Register and add settings          */         public function page_init()         {                     register_setting(                 'my_option_group', // Option group                 'my_option_name', // Option name                 array( $this, 'sanitize' ) // Sanitize             );                  add_settings_section(                 'setting_section_id', // ID                 'My Custom Settings', // Title                 array( $this, 'print_section_info' ), // Callback                 'my-setting-admin' // Page             );                    add_settings_field(                 'id_number', // ID                 'ID Number', // Title                  array( $this, 'id_number_callback' ), // Callback                 'my-setting-admin', // Page                 'setting_section_id' // Section                        );                        add_settings_field(                 'title',                  'Title',                  array( $this, 'title_callback' ),                  'my-setting-admin',                  'setting_section_id'             );               }              /**          * Sanitize each setting field as needed          *          * @param array $input Contains all settings fields as array keys          */         public function sanitize( $input )         {             $new_input = array();             if( isset( $input['id_number'] ) )                 $new_input['id_number'] = absint( $input['id_number'] );                  if( isset( $input['title'] ) )                 $new_input['title'] = sanitize_text_field( $input['title'] );                  return $new_input;         }              /**           * Print the Section text          */         public function print_section_info()         {             print 'Enter your settings below:';         }              /**           * Get the settings option array and print one of its values          */         public function id_number_callback()         {             printf(                 '<input type="text" id="id_number" name="my_option_name[id_number]" value="%s" />',                 isset( $this->options['id_number'] ) ? esc_attr( $this->options['id_number']) : ''             );         }              /**           * Get the settings option array and print one of its values          */         public function title_callback()         {             printf(                 '<input type="text" id="title" name="my_option_name[title]" value="%s" />',                 isset( $this->options['title'] ) ? esc_attr( $this->options['title']) : ''             );         }     }          if( is_admin() )         $my_settings_page = new MySettingsPage();


title: Post migration - images do not display

text: Here is migration quandry - going from one host to another. The blog domain name is unchanged.   * backed up the file system with everything to a .bz2   * backed up the SQL DB   * ftp'd the file system bz2 to the new host   * unpacked the file system with cPanel   * locations and permissions appear okay   * created db on new host with mysqladmin under cPanel   * imported the sql backup, seems okay   * adjusted wp-confg.cfg for db name. DB password is correct. Now that the domain has moved the blog on the new host works perfectly EXCEPT pictures in the posts no longer display - just box and the image file name. The pics are where they should be in wp-content/uploads. The references in the post look correct but no joy when viewed. As an experiment I inserted one of the pics into a new post. Same result. Further, in the media menu the picture also does not display but the names show as there. Makes me nuts! Any help greatly appreciated. The site is at http://www.thoughtpaths.com/


title: Woocommerce Show Single Product on Homepage

text: I am currently learning PHP & how to customize Wordpress. I have a shop that I set up on Wordpress using the Woocommerce plugin. The shop holds only a single item. Since I only have 1 item to sell, I would like to show the product on my homepage in such a fashion where the complete product page is shown on the homepage. Here is some code i've been trying to get to work (this is placed in the home.php file):               $prodpage = array(     'post_type' => 'product',     'posts_per_page' => 1,     'taxonomy' => 'banner',     'term' => 'banner'     );     $featured_query = new WP_Query( $prodpage );          if ($featured_query->have_posts()) :                 while ($featured_query->have_posts()) :                     $featured_query->the_post();                    $product = get_product( $featured_query->product->ID );                // Product Info Output Here          endwhile;            endif;            wp_reset_query(); // Query Reset      I have also tried using query_posts in this manner:               if ( is_home() ) {     query_posts( 'p=31' );     }      The good news is that I don't get flagged for any syntax errors. The bad news is that I am afraid my logic is off somewhere as I get a page with only the WP header and footer. The mid section where the product should show up is not showing up. I really appreciate any guidance you guys are able to give! :)


title: Showing the next post's title, even if it's an unpublished post

text: At the bottom of each post I need to either:   * Offer a link to the next post (if the next post is published); or   * Display the title of the next post with the date it will be published (if it's a future post) Suggestions?


title: Memory issue only in dashboard

text: Though I've been using my website's dashboard the last few days without installing any plugin nor touching any piece of code, today my dashboard (but not my website) is unavailable with a message "Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 30720 bytes) in /home/.../public_html/mysite.com/wp-includes/class-wp-admin-bar.php on line 36". The define('WP_MEMORY_LIMIT', '64M'); was already present in wp-config.php. Considering that I haven't touched anything, what could be the cause and how to fix it?


title: WP Query group/order by category name

text: I have a requirement for displaying a list of custom post types grouped by category, but in addition to this, each custom post is linked with a meta value (in this example lets say we have a custom meta value of "TEST1"). Basically, my goal is to display a list, grouped by category for all custom posts with a code of "TEST1". The way I am currently doing this is by simply getting all categories linked to my custom post type (ignoring empty), then looping through each category to get all posts within it that have a code of "TEST1". Now this is great, it works fine, however it is **extremely** inefficient. At the moment this isn't an issue but I fear that it won't scale very well as the number of categories increases overtime - because each iteration equals another DB hit (and join to the post meta table). I have had a good look across the web but I am unable to find anything but was wondering if it is possible to perform a WP_Query call that would return all posts with the custom meta value of "TEST1" grouped or ordered by their category name? This would be a lot more efficient (basically 1 DB hit I would assume). If anyone can advise anything here I would be really grateful, if it is not possible then I assume my only way to achieve this would be to do a direct query to the database from within my plugin (which from what I've read is not advised when working with plugins).


title: Twenty Ten Theme: Replace the Logo by a picture without moving the code

text: I would like to replace the twenty ten's theme logo (text) by a picture, Is there any plugin allowing me to do that. I know how to do it, but every time wordpress gets updated (often) the code comes back to how it was before I changed it. Thanks in advance.


title: Using Image insert control in code

text: I am adding additional pages to wordpress backend and I would like to use the built-in image uploader and browser. I couldn't find any examples on how to add it to my form. Assuming that I have a text input or something similiar - what do I have to do to allow users pick a previously uploaded image so that the image link would show up in the textfield? edit: I've created an iframe that's loading media-uploader.php but now I have no idea how to get the picked image to go to my textfield.


title: Why does blog page not reveal it's template?

text: I've got a CMS style setup. The blog part is not on the home page. I'm trying to add certain things to the side-bar according to which template the page is using. That all works fine, except for the blog page, which does not even reveal its template name.               echo get_post_meta($post->ID,'_wp_page_template',true);  // produces nothing for blog template blog-page.php, but does show standard-page.php          if ( is_page_template('blog-page.php')) {      // show blog sidebar stuff.... never gets called     }     if ( is_page_template('standard-page.php')) {      // show blog sidebar stuff.. this works     }      What else can I use to check if the page is a blog page rather than then template? UPDATE Doesn't seem to be actually using blog-page.php, but index.php instead... what if statement can i use to check if its a blog-style page?


title: Any advantage to using get_header() over include('header.php')?

text: The basic theme - in fact every theme I've looked at - uses get_header() to include the header file, but I don't see any reason for doing so. What's are the advantages of using `get_header()` instead of a simple `include('file.php')`?


title: Hide Trackbacks/Pingbaks if none exists

text:
I managed to get my comments numbered and then to separate the comments from the pingbacks and trackbacks. The only problem I have now is that I don't want to show the title of this section (where the trackbacks/pingbacks are) unless there are any. This is the code I'm using in comments.php:

Trackbacks/Pingbacks:
             <?php                wp_list_comments(array(               'callback'=>'list_pings',               'style'=>'ol',               'type'=>'pings',             ));             ?>
      And this is the code from functions.php:               <?php     function list_pings($comment, $args, $depth) {     $GLOBALS['comment'] = $comment;     ?>     <li id="comment-<?php comment_ID(); ?>"><?php comment_author_link(); ?>     <?php } ?>     <?php     add_filter('get_comments_number', 'comment_count', 0);     function comment_count( $count ) {     if ( ! is_admin() ) {     global $id;     $comments_by_type = &separate_comments(get_comments('status=approve&post_id=' . $id));     return count($comments_by_type['comment']);     } else {     return $count;     }     }     ?>      I think I should do an `if/else` statement but I can't figure out where to start.


title: Minimal custom permalink structure

text: I'm aware that there are posts discussing this issue already (e.g. http://wordpress.stackexchange.com/questions/1364/what-is-the-best-permalink- structure-for-seo) but I have a specific set of requirements according to my wordpress site structure, namely:   1. 6 pages   2. A small number of posts (~ 3 at launch, maybe 1 new one per month) I'd like to include the post name in the URL (for both SEO and easier stats analysis), but I've seen references to 'problems' arising from using _just_ the post name.   * Would this be the case, even on such a small site?   * Would `/%post_id%/%$postname%/` be a 'better' alternative? I notice that, even with this configuration, the Pages don't use the post_id in their URL.


title: WordPress UPME plugin shortcode problem

text: I have a problem with wordpress(3.9.2) UPME plugin. Shortcodes, that I'm supposed to add to a page, break those pages. All of them except,[upme_login]. The pages show only header and page title and nothing else below, including other content and footer. I tried to put [upme_login] too on other pages, it works only if [upme_login] is placed above other shortcodes, if it's placed below other shortcodes, same blank space appears. I tried to activate various themes, it is always the same. I deactivated all other plugins, nothing's change ...


title: Get userdata inside custom build plugin

text: So I am working on a custom plugin which will get the option to set Roles & Capabilities per user to enable/disable certain pages/parts inside the plugin. So I wanted the get the logged in users roles value by using `get_userdata()`but this trows in an error `Call to undefined function get_userdata()`, I have seen that this is an common issue but I haven't found any solution for this. So how do I get the user data inside a plugin?


title: Obtaining the original unchanged Theme

text: Quite a few months back, I had used a third party theme v 2.9 in my wordpress site. I made a few custom changes to css/.php based on my needs. Now, I plan to upgrade the theme to v3.8. Before doing that, I wanted to get the diff of changes that I had made to ver 2.9. As I didn't have a copy of the original theme, I contacted the developers of the theme; unfortunately, they also don't seem to have a copy of that. What are my options to obtain the diff, get an original copy of the theme? Does wp store a copy of original theme somewhere? My site is hosted on bluehost. Thank You.


title: Replace audio links with jplayer using the_content filter

text:
I am attempting to use :               add_filter( 'the_content', 'filter_function_name' );      To find all of the anchor tags in my post which link to a .mp3 file, and then replace them with a jplayer instance that would play the file, instead of just having the link to be file being displayed. So, I am trying to get all of the anchors tags that are output by the_content to be replaced by instances of the following html and js: html:

play

pause

stop

mute

unmute

max volume

repeat

repeat off

Music Player

             Update Required             To play the media you will need to either update your browser to a recent version or update your Flash plugin.

      Javascript:                     Any help is appreciated. Thanks.


title: if (is_page(**PAGE ID**)) not working

text: I'm following this tutorial on adding Google Content Experiments code to `header.php`. I added the following code to `header.php`:               <?php if (is_page('346') ):?>         <!-- Google Analytics Content Experiment code -->             ...         <!-- End of Google Analytics Content Experiment code -->     <?php endif; ?>      This didn't produce the content experiment code on the front end. I tried:               <?php if (is_page(346) ):?>         <!-- Google Analytics Content Experiment code -->             ...         <!-- End of Google Analytics Content Experiment code -->     <?php endif; ?>      This didn't work either. Can you see why this code is not working? Thanks.


title: WP_List_Table inside metabox not working on submit

text:
I'm trying to display a WP_List_table inside a metabox. The metabox is for a custom taxonomy called 'service' which is registered to a custom post type called 'office'. The table columns contain input fields which manipulate the taxonomy and allow me to link additional data to each individual taxonomy term. I don't think the fact that I'm trying to this for a custom taxonomy which is on a custom post type edit screen is relevant. I only merely mention to for clarity sake. What's happening is that it all looks fine until I click the Publish/Update button on the custom post type edit screen. If the WP_List_Table has bulk actions it will redirect back to the /wp-admin/edit.php page, it I remove the bulk actions then it displays a Wordpress Failure Notice "Are you sure you want to do this? - Please try again", which is a nonce validation error. And in both cases, the none of the data I change for the post is saved. I've included a link below to the full script that registers the taxonomy, creates the table and saves the metabox data. Feel free to fiddle with it to get it working if you like. http://www.writeurl.com/text/aawwgq1od5913fmyfjyu/0y84g3vcyptvrkvvfxq4/0dow449a06lj6ctkqjqo **A NOTE TO THE STACKOVERFLOW EDITORS:** I have already checked through questions suggested while I type mine and also all questions tagged with wp- list-table plus scoured the depths of Google and none of them seem relevant to my situation. **UPDATE:** If possible I'd prefer to not to have to use any bulk_actions. I've no need for them on this table. I only added the delete action for testing purposes. And the class method "process_bulk_action" doesn't even get called on submit anyway.               <?php     if(!class_exists('WP_List_Table')) {         require_once(ABSPATH.'wp-admin/includes/class-wp-list-table.php');     }          class servicesTable extends WP_List_Table {         private $allServices;         private $currentServices;         private $currentServicesData;              public function __construct(){             parent::__construct(                 array(                     'singular' => 'service',                     'plural' => 'services',                     'ajax' => false                 )             );         }              private function table_data() {             $this->currentServices = wp_get_object_terms(get_the_ID(),array('service'),array('fields' => 'ids'));             $this->currentServicesData = (array) maybe_unserialize(get_post_meta(get_the_ID(),'currentServices',true));             $this->allServices = array();             foreach((array) get_terms(array('service'),array('hide_empty' => false)) as $service) {                 $this->allServices[] = array(                     'id' => $service->term_id,                     'serviceTitle' => $service->name,                     'attachments' => array_key_exists($service->term_id,$this->currentServicesData) ? explode(',',$this->currentServicesData[$service->term_id]['attachments']) : array(),                     'lastServiced' =>  (array_key_exists($service->term_id,$this->currentServicesData) && strlen($this->currentServicesData[$service->term_id]['last_serviced']) > 0) ? date('Y-m-d',strtotime($this->currentServicesData[$service->term_id]['last_serviced'])) : '',                     'nextService' =>  (array_key_exists($service->term_id,$this->currentServicesData) && strlen($this->currentServicesData[$service->term_id]['next_service']) > 0) ? date('Y-m-d',strtotime($this->currentServicesData[$service->term_id]['next_service'])) : '',                     'invoices' => ''                 );             }             return $this->allServices;         }              public function column_default($item,$columnName) {             return array_key_exists($columnName,$item) ? $item[$columnName] : print_r($item,true);         }              public function get_columns(){             return array(                 'cb' => '<input type="checkbox" />',                 'id' => 'ID',                 'serviceTitle' => __('Title','brokertech'),                 'attachments' => __('Attachments','brokertech'),                 'lastServiced' => __('Last Service Date','brokertech'),                 'nextService' => __('Next Service Date','brokertech'),                 'invoices' => __('Invoices','brokertech')             );         }              public function get_hidden_columns() {             return array('id');         }              public function get_sortable_columns() {             return array(                 'lastServiced' => array('lastServiced',true),                 'nextService' => array('nextService',true)             );         }              private function sort_data($a,$b) {             $orderby = empty($_GET['orderby']) ? 'nextService' : $_GET['orderby'];             $order = empty($_GET['order']) ? 'asc' : $_GET['order'];             $result = strcmp($a[$orderby],$b[$orderby]);             return ($order === 'asc') ? $result : -$result;         }              public function prepare_items() {             usort($this->table_data(),array(&$this,'sort_data'));             $this->_column_headers = array($this->get_columns(),$this->get_hidden_columns(),$this->get_sortable_columns());             $this->items = $this->allServices;             wp_enqueue_script('services',JS_URI.'servicesSelector.js',array('thickbox','media-upload'));             wp_enqueue_style('thickbox');             wp_localize_script(             'services',             'servicesData',                 array(                     'editAttachment' => __('Edit'),                     'removeAttachment' => __('Remove')                 )             );         }              public function column_cb($item) {             return sprintf('<input type="checkbox" name="services[%s][enable]" value="%s" %s />',$item['id'],$item['serviceTitle'],checked(true,in_array($item['id'],$this->currentServices),false));         }              public function column_id($item) {             return sprintf('<input type="hidden" name="services[%s][id]" value="%s" />',$item['id'],$item['id']);         }              public function column_attachments($item) {             $html  = sprintf(                 '<input type="hidden" name="services[%s][attachments]" value="%s" class="listAttachments" />',                 $item['id'],                 empty($item['attachments']) ? '' : implode(',',$item['attachments'])             );             $html .= sprintf('<input type="button" value="%s" class="button button-secondary addServiceAttachment" data-service-id="%s" />',__('Add'),$item['id']);             $html .= " ";             if(empty($item['attachments'])) {                 $html .= sprintf('<input type="button" value="%s" class="button button-secondary clearAll" data-service-id="%s" disabled="disabled" />',__('Clear'),$item['id']);             }             else {                 $html .= sprintf('<input type="button" value="%s" class="button button-secondary clearAll" data-service-id="%s" />',__('Clear'),$item['id']);                 $html .= "

";                 foreach($item['attachments'] as $attachment) {                     if(is_numeric($attachment)) {                         $html .= sprintf(                             "
%s
%s<input type='button' class='removeServiceAttachment button button-secondary' value='%s' style='float:right;' />

",                             get_the_title($attachment),                             get_admin_url(get_current_blog_id(),'post.php?post='.$attachment.'&action=edit'),                             __('Edit'),                             __('Remove')                         );                     }                 }             }             return $html;         }              public function column_lastServiced($item) {             return sprintf('<input type="date" name="services[%s][last_serviced]" value="%s" />',$item['id'],$item['lastServiced']);         }              public function column_nextService($item) {             return sprintf('<input type="date" name="services[%s][next_service]" value="%s" />',$item['id'],$item['nextService']);         }              public function column_invoices($item) {             $html  = sprintf(                 '<input type="hidden" name="services[%s][invoices]" value="%s" class="listInvoices" />',                 $item['id'],                 empty($item['invoices']) ? '' : implode(',',$item['invoices'])             );             $html .= sprintf('<input type="button" value="%s" class="button button-secondary addInvoice" data-service-id="%s" />',__('Add'),$item['id']);             $html .= " ";             if(!empty($item['invoices'])) {                 $html .= "

";                 foreach($item['invoices'] as $invoice) {                     if(is_numeric($invoice)) {                         $html .= sprintf(                             "
%s
%s<input type='button' class='removeInvoice button button-secondary' value='%s' style='float:right;' />

",                             get_the_title($invoice),                             get_admin_url(get_current_blog_id(),'post.php?post='.$attachment.'&action=edit'),                             __('Edit'),                             __('Remove')                         );                     }                 }             }             return $html;         }     }          function saveServices($postID) {         if(empty($_POST) || (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)) {             return;         }         $servicesData = array();         $services = array();         foreach($_POST['services'] as $service) {             if(isset($service['enable'])) {                 $services[] = (string) $service['enable'];                     $servicesData[$service['id']] = $service;             }         }         empty($servicesData) ? delete_post_meta($postID,'currentServices') : update_post_meta($postID,'currentServices',$servicesData);         wp_set_object_terms($postID,$services,'service');     }     add_action('save_post','saveServices');          function servicesMetaBox() {         $servicesTable = new servicesTable();         $servicesTable->prepare_items();         $servicesTable->display();     }          $serviceTaxonomy = new brokertechPostType;     $serviceTaxonomy->createTaxonomy(         'service',         array(             'office'         ),         __('Service'),         __('Services'),         array(             'public' => true,             'hierarchical' => false,             'query_var' => true,             'update_count_callback' => '_update_post_term_count',             'show_ui' => true,             'rewrite' => array(                 'slug' => __('services')             ),             'meta_box_cb' => 'servicesMetaBox'         )     );          function addServicesTaxonomyPage() {         add_submenu_page(             'edit.php?post_type=company',             __('Services'),             __('Services'),             'edit_posts',             'edit-tags.php?taxonomy=service&post_type=office'         );     }     add_action('admin_menu','addServicesTaxonomyPage');          function changeServicesMetaBoxPosition() {         global $wp_meta_boxes;         unset($wp_meta_boxes['office']['side']['core']['tagsdiv-service']);         add_meta_box(             'tagsdiv-service',             __('Services'),             'servicesMetaBox',             'office',             'normal',             'low'         );     }     add_action('add_meta_boxes','changeServicesMetaBoxPosition',0);


title: Remove default post types on all sites except primary blog. WPMU

text: I'm trying to come up with a solution that would allow me to remove the default post types (pages, posts, comments, links, etc) from all the multi- site blogs EXECEPT the primary blog. It will remain fully functional. My purpose is to apply a custom post type to all the multi-site blogs to replace the defaults. Any help in the right direction would be much appreciated. -Phil


title: How do I paginate a list of categories?

text: I recently added thumbnails for my categories, which has had the side effect of making the page they are listed on unbearably long. Because of that, I am hoping to paginate the list of categories. Here is what I am using to generate the list of categories and thumbnails (unstyled):               <?php      $args=array(       'orderby' => 'name',       'order' => 'ASC'       );     $categories=get_categories('child_of=504&order_by=name&style=none&title_li=');       foreach($categories as $category) {        echo '       term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '> '. get_the_term_thumbnail ( $category->term_id, category, $size = 'medium', $attr = '') . '        term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'';       }      ?>      In trying to find a solution, I came across another question ( How to paginate a list of tags ) regarding tags that seems to do exactly what I am hoping, but have been unsuccessful merging the two together so far. Any help would be wonderful, Thank you


title: Short messages widget

text: i'm looking for a widget that can show short news messages in the sidebar sorted by date (sticky's would be nice too) and manageble in the backend. I don't want to create posts because these messages are max 200 characters and don't need a dedicated page. Is there something like this? My english is giving me problems finding it, or maby it just doesn't excist? PV


title: get parent fields title, content excerpt etc

text: can't seem to get this but how can i load info in a child's page from its parent? ie, i'm looking at an attachment and i can get the parents ID easy enough but not sure how to get the parents title, excerpt etc.               // attachment content above here then want to get and show some parents' content          echo $parent = get_post_field('post_parent', $id);          echo the_title(); // this still shows the childs title...      any help appreciated! Dan


title: Integrating plugins in themes

text: I could not find a thread discussing this, so starting this one. I am currently working on a rather elaborate theme for 3.1+, and by elaborate I mean that in addition to styling and regular front-end functionality, I am including plugins at the core of the theme, both for back-end and front-end. So, to keep this a little more organized, I split this into three questions:   1. Is integrating plugins a common practice?   2. What are the implications/complications in regards to auto-updating the theme/plugins?   3. What would be the most optimized way of including each plugin without breaking pre-existing functionality?


title: Reason for Lowercase usernames

text: I can see `validate_user()` calls `sanitize_user()` with strict argument as true, which means uppercase letters are not allowed too. In source code, I found this comment               // If strict, reduce to ASCII for max portability.         if ( $strict )             $username = preg_replace( '|[^a-z0-9 _.\-@]|i', '', $username );      I would like to know how does this affect portability?


title: How to display blog posts on a dedicated page?

text: I'm in the middle of moving to WordPress from another CMS. I definitely have to keep the links intact, which are like this:   * example.com (Redirects to /blog)   * example.com/blog (The blog, displaying all the articles)   * example.com/blog/article (A specific article)   * example.com/about (A static page)   * example.com/portfolio (Another static page) Right now, however, only the static pages work as expected. I cannot figure out how to create a new custom "blog" page and display the blog posts on that, and how to remove the front page alltogether, making it redirect to the blog instead. Furthermore, I'm using the zBench theme, which always displays the "Home" tab which will lead to the front page. Instead, I want my tabs like this: "Blog", "About", "Portfolio" - no "Home". A similar question has been asked before: How to get the list of posts in a static page other than front page? But this seems like a hack, and not really the same problem I have. I do want to display the blog on the front page, I just want to rename it in both URL and on the tab.


title: Change media attachment author via mysql query

text: How does one bulk change the media attachment author via an sql query? I have hundreds of media attachments that need to be moved to another author so the original author can be deleted; but that author has no posts, only media attachments. (The images were attributed to the author when importing and running a query to take the first post image and make it a featured image.) I think I need to specify the `post_type' in a query, like this: `update wp_posts and post_type = ‘attachment’` **Update:** As answered below, this works `UPDATE wp_posts SET post_author = [NEW_ID] WHERE post_author = [OLD_ID]` with or without the `AND post_type = 'attachment'`


title: Back up uploads folder outside of wp-content?

text: I've changed the default uploads location to mysite/media instead of wp- content/uploads because the url looks better. That said, backup programs like WP Clone seem only to backup media when it's in wp-content/uploads. Is it possible to backup the uploads folder wherever it may be within the installation?


title: How do you force a sidebar widget to have a container div around all child widgets?

text:
My theme creates several widget areas for the end user. However, I've got a slight problem in that, if multiple widgets are dropped onto any sidebar container, the resulting code in "view source" is not wrapped in a single container div. For example, here's what it looks like Start of a single widget container:

Widget title

             contents of widget 1

Widget title

             contents of widget 2

      What do I need to do to the way I'm creating this widget so that a single wrapper div encloses all of the widgets added to the container?               if ( function_exists('register_sidebar') )     register_sidebar(array(         'name' => 'Inside Header Area',         'id' => 'inside-header-widget',         'before_widget' => '
',         'after_widget' => '
',          'before_title' => '
',         'after_title' => '
',     ));


title: The simplest way to let clients edit pages

text: I'm building a wordpress site for a client. I want to let him edit pages (just so he won't bother me), but I know that going to /wp-admin and entering a password, and than navigatin in the dashboard is way beyond his reach. I need to think of a really simple way to let him edit pages. preferably something on the page. But of course, I don't want anything weird to appear to regular users... Any thoughts?


title: Have a Custom Post Type index page display taxonomy items instead of posts

text: I have a CPT registered that is called `lessons` with a custom taxonomy (category) that is called `courses`. I want the `/courses` page (archive- courses.php?) to display the individual courses (i.e. "online marketing", "paid advertising") and not the individual posts (lessons). Would this mean I'd just customize the loop, or a complete custom WP_Query?


title: sub.menu's not working

text: working on a wordpress install that is in a subdirectory of another wordpress install (( thecloud99.info has wp in the root )) there is a folder in the root called clients w/ another wordpress install in chamber :: http://thecloud99.info/clients/chamber/ the problem i'm running into is that the sub.menu under members shows up correctly but doesn't actually take me to the page, instead it returns me to the home page. ??


title: Default .htaccess file for wordpress?

text: My .htaccess files are intercepting with wordpress .htaccess files, which modules and which settings (specified by .htaccess) are required for WD site to work? In other words, where can I find default WD .htaccess file?


title: How to prevent posts duplicating when viewing a custom taxonomy term

text: My question is fairly basic. I have an archive.php and inside I have the main loop like so:               <?php if (have_posts()) : while (have_posts()) : the_post(); ?>          Do stuff here          <?php endwhile; endif; ?>      Works fine for categories but not for custom taxonomies. I have a custom taxonomy called "Type". I go to the WordPress menu and add the term "Spa Break" from the "Type" taxonomy. This works, however I get about 10 of each post for every post. All the ID's for the duplicate posts are the same, it just decides to list 10 of each. I have added no custom queries or anything like that. Any clues to what might be happening? Here is my taxonomy:               function build_taxonomies(){     register_taxonomy("type", array("venue"), array("hierarchical" => true, "label" => "Types", "singular_label" => "Type", "rewrite" => array('slug' => 'type')));       } Here is my post type code:               function create_post_type()      {         $labels = array(             'name' => __( 'Venue' ),             'singular_name' => __( 'Venue' ),             'rewrite' => array('slug' => 'venues'),             'add_new' => _x('Add New', 'venue'),             'add_new_item' => __('Add New Venue'),             'edit_item' => __('Edit Venue'),             'new_item' => __('New Venue'),             'view_item' => __('View Venue'),             'search_items' => __('Search Venue'),             'not_found' =>  __('No venues found'),             'not_found_in_trash' => __('No venues found in Trash'),              'parent_item_colon' => ''           );                $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,              'query_var' => true,             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => null,             'supports' => array('title','editor','thumbnail', 'custom-fields', 'comments')           );                 register_post_type('venue',$args);     }      Thanks in advance.


title: How do I display a friendly URL link in the frontend?

text: I'm creating a separate (simple) directory that does not use any internal WP permalinks or pretty link structure. I've been studying how to make my own custom SEF URLs for _this_ part of my site, and almost have it (or thought so). I have a separate table with records like this:               id   |   section    |  category   | co_name     1    |  Consulting  | Innovation  | Innocentive.com     2    |   Tasks      | Employment  | Microtask.com     ....      The directory shows a page of all the sections & categories from the database at this URL: dailycrowdsource.com/companies/ (I did this with a companies.php file & created a 'page' with the slug 'companies') I want this URL to display all the 'employment' category listings: dailycrowdsource.com/companies/tasks/employment/ I can handle the php & mySQL, but I don't know how to make the links pretty. This works http://dailycrowdsource.com/companies/?category=poll This helped using an extra parameter in an URL, & I think I got it working, but I couldn't figure out how to convert the < a href=.... into the SEF link. I prefer to do this in my functions.php file, as I haven't written a plugin yet. I've done this in Joomla with the router.php file. In my research ( Need help with friendly URL's in Wordpress, Custom Post Type Rewrite Rule for Author & Paging?, Rewrite API ), I'm seeing a lot of the same tags & buzzwords, but no one explains how to change the actual link. Does WP do it automatically? (In Joomla you have to do: JRoute::_('index.php?var1=great&var2=more'); for the conversion to take place.) I realize the first answers will tell me to use some built in taxonomy of WP, but I need this to be updated easily. And by adding a record to the database with a brand new section or category, my directory needs to be instantly updated (that's why I've chosen this method - no administration). I would appreciate someone showing me how to add in hooks/filters/etc to make a custom SEF URL. (All URLs will start with dailycrowdsource.com/companies/ ). (I'm hoping Mike Schinkel reads this - as I got a lot of help from his responses to similar posts) Thank You -David


title: remove a single post_meta

text: I created a plugin that has multiple meta boxes. One meta box saves a single record by using `update_post_meta()`. Another meta box saves multiple record by using `add_post_meta()`. I do not have revisions turned on in the post_type. How would you `delete_post_meta()` a single specific record in the meta box that uses `add_post_meta()`? Best practice advise is needed. If you're going to send the whole `$post->ID` and it will get the array of records, how can I detect the specific `meta_key` set to be deleted? Here is the code on github: https://github.com/fritzdenim/stec- events/blob/62d5c641622f75a610da09462260f09713f0abab/index.php


title: Add menu item to edit specific page

text: I have pages setup and want a top level menu item to direct to editing a specific page. I'm reading through add_menu_page and it doesn't list how to get to specific pages or posts edit page. ie `post.php?post=FOO&action=edit`. Is this possible?


title: Expected snippet value not showing

text:
I have a code snippet like this one,

                                                                                Home                             Any Description Here Manual/Auto

      And Im getting the list of menu items from this php code               <?php wp_nav_menu('menu=header_menu&container=false'); ?>      But the resultant of that cod is somehow like this,

                  Home

      So, what im missing here is the id="container" inside the tag and after the anchor tag the . I dont really know how to put those I have a reference               http://codex.wordpress.org/Function_Reference/wp_nav_menu      But the thing is I still cant understand as to how to add what the things Im missing from the snippet.


title: Get the index of post outside the loop

text:
I'm trying to find out the index of the post which is currently viewed (single post page). I have an overview of the articles in the same category in a sidebar. But when a user navigates to a post which is located on page 2, the articles should now show up the articles of page 2, even when in single post page. This is the code for the sidebar to show posts from the actual page:
         <?php              $offset = 0;              //THIS IS THE PROBLEMATIC PART              if (is_single()) {             $modulo = $wp_query->current_post % 6; // $wp_query->current_post somehow ever returns 0             $offset = $wp_query->current_post - $modulo;         }              if (is_tag()) {             $args = array(                 'posts_per_page'   => 6,                 'tag'              => get_query_var('tag') );         }         else {             $args = array(                 'posts_per_page'   => 6,                 'category'         => $cat_id,                 'offset'           => $offset );         }              $myposts = get_posts( $args );         $i = 0;         foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
                 <?php if (is_blog()) { ?>                 <a href="<?php the_permalink(); ?>"><?php the_title(); ?>                 <?php } else { ?>                 <a href="#" onclick="goTo(<?php echo $i; ?>);return false;"><?php the_title(); ?>                 <?php } ?>
         <?php $i++; endforeach; ?>
      As in the comments, $wp_query->current_post always returns 0, which I think is because it is outside a loop. How can i solve that issue?


title: unable to display the image meta value as background

text: I want to use meta url as background image.But the fact that I do not want to show "background-image:url('_')" this way because if my meta value is empty.What I thought to end up in this way.               $bgimage= get_post_meta( $post->ID, 'settings_image', true );     < div style="<?php echo 'background-image: url(".wp_get_attachment_url( $bgimage )")';?>">      I think this is best way since I do not want to put extra conditional block here.Did I make mistake in catenation?


title: input radio 'checked' saves, but select option 'selected' doesn't

text:
So I followed a tutorial on how to create a meta box w/ the taxonomy terms shown in radio buttons. (Tutorial here for others if interested: http://wp.tutsplus.com/tutorials/creative-coding/how-to-use-radio-buttons- with-taxonomies/) My main goal is to create it to be a drop down. However, when converting the input radio styles to select option, the selected option does not save. Here is the code comparing the two:                     <div id="taxonomy-<?php echo $taxonomy; ?>" class="categorydiv">                                <div id="<?php echo $taxonomy; ?>checklist" class="list:<?php echo $taxonomy?> categorychecklist form-no-clear">                                             <select id="select-taxonomy">                         <?php foreach($terms as $term){                            $id = $taxonomy.'-'.$term->term_id;                             $value= (is_taxonomy_hierarchical($taxonomy) ? "value='{$term->term_id}'" : "value='{$term->term_slug}'");                         echo "<option id='in-$id' name='{$name}'".selected($current,$term->term_id,false)." {$value} />$term->name</option>";                       } ?>                     </select>
                     <?php foreach($terms as $term){                        $id = $taxonomy.'-'.$term->term_id;                         $value= (is_taxonomy_hierarchical($taxonomy) ? "value='{$term->term_id}'" : "value='{$term->term_slug}'");             echo "";             echo "<input type='radio' id='in-$id' name='{$name}'".checked($current,$term->term_id,false)." {$value} />$term->name
";                           echo "";                   } ?>

      The only thing I can think of that is causing the selection not to save is change the input radio to an element, or it may be changing ".checked" to ".selected" Any help would be appreciated. Thanks, Roc.


title: Put CSS on TOP, how?

text: I have this mission, that regards setting my existing CSS on HEAD. I've tried to make a search on if there was any kind of plugin or code to automatically set the CSS code directly in Head. The main purpose is to follow YSlow recomendations such as "Put CSS on Top" How can i do that? Is there a code for it? a plugin? Does someone believes that can help me with this? My domain is http://findout-macau.com


title: Custom attribute values in drop down menu

text: I'm trying to modify the WOOCOMMERCE product search widget in a way that it can contain 3 drop down fields. Now these drop down fields need to be populated with custom attribute values that I've added to each product. In a pursuit to do this I saw a post: drop down list taxanomy problem On pasting the code in that post I got the following error. I'm absolutely new to wordpress. Any help will be highly appreciated. > Catchable fatal error: Object of class WP_Error could not be converted to > string in C:\wamp\www\sotcnri\wp-content\themes\mystile\product- > searchform.php on line 47               Call Stack     #TimeMemoryFunctionLocation     10.0015367840{main}(  )..\index.php:0     20.0024371528require( 'C:\wamp\www\sotcnri\wp-blog-header.php' )..\index.php:17     30.489432052608require_once( 'C:\wamp\www\sotcnri\wp-includes\template-loader.php' )..\wp-blog-header.php:16     40.491632067296include( 'C:\wamp\www\sotcnri\wp-content\themes\mystile\template-fullwidth.php' )..\template-loader.php:47     50.640632543096get_footer(  )..\template-fullwidth.php:56     60.640632543472locate_template(  )..\general-template.php:63     70.640832543608load_template(  )..\template.php:383     80.641232577544require_once( 'C:\wamp\www\sotcnri\wp-content\themes\mystile\footer.php' )..\template.php:407     90.642332578432woo_sidebar(  )..\footer.php:39     100.642332578432dynamic_sidebar(  )..\admin-sbm.php:8     110.642832580664call_user_func_array     (  )..\widgets.php:893     120.642832580896WP_Widget->display_callback(  )..\widgets.php:893     130.642932581296WC_Widget_Product_Search->widget(  )..\widgets.php:182     140.643132583384get_product_search_form(  )..\class-wc-widget-product-search.php:61     150.643432595944require( 'C:\wamp\www\sotcnri\wp-content\themes\mystile\product-searchform.php' )..\woocommerce-template.php:1490


title: Widget area does not show any contents for specific users in admin interface. How to go about debugging?

text: I use a custom theme on a WP-Multisite instance which also uses WPML plugin. I am pretty technical and I can read PHP code but I do not have any WP experience. The theme has three custom widget areas - footer left, footer center and footer right. As a network admin I can properly put content in all the widget areas. But users, who are admins on only the actual sites they want to edit can only edit the content in the center and right content area. When trying to edit the content in the left footer area as site admin without network admin permissions, however, the content does not show up. What's worse, when I edit the content in the center or right footer area as as a site-admin, then the content in the left (which I can't see) gets deleted. Any idea how to go about this issue? I can't really disable any of the plugins as this is a production system. Should I satrt building a staging system, or does anyone have an idea what the issue is?


title: Wordpress Theme Update Action?

text: I've done quite a bit of searching. I'm looking for hook/action called after a theme update. I know the initialization one - but a basic update? Cannot seem to find. If one does not exist, how can you run a function after auto-updating?


title: "Current" class on a singular page menu item with custom post types?

text: I'm struggling to get a "current" class for the corresponding menu item when I'm on a singular (child) page of a custom post type. These are the arguments I used when registering the post type with register_post_type:                   array(             'labels' => array(...),             'public' => true,             'has_archive' => true,             'capability_type' => 'post',             'hierarchical' => true,             'menu_position' => 5,             'supports' => array('title', 'editor', 'thumbnail'),             )      On the archive page everything is working fine and I do get the "current-menu- item" class for the current post types menu item. What can I do to make it work? I'm using wp_nav_menu(); to generate the menu.


title: Autosort uploads in galleries by filename

text: A client of mine wishes to not have to sort images uploaded into a post gallery, but instead rely on its filename for sorting (e.g. "01_sample.jpg", "02_sample.jpg"). This would save a lot of time for the client, and I'm wondering if this is possible to achieve using WP 3.5+ and the recent changes to Add Media?


title: Gravity forms - Can I have multiple custom spinners?

text: I wish to change the default ajax loader for gravity forms. I have done this using the following code (link found here):               add_filter( 'gform_ajax_spinner_url', 'cwwp_custom_gforms_spinner' );             /**        * Changes the default Gravity Forms AJAX spinner.        *        * @since 1.0.0        *        * @param string $src The default spinner URL        * @return string $src The new spinner URL        */              function cwwp_custom_gforms_spinner( $src ) {              return get_stylesheet_directory_uri() . '/assets/img/css/newsletter-loader.gif';          }      This seems to work fine. What I would like todo is set **another** custom ajax spinner for a different form on a different page. The design of the page is different and I would like to set a different spinner. Any ideas how I do this?


title: Primary navigation menu & footer not showing in category / tag page

text:
I tried to find a solution for primary navigation not showing in some pages, ie. archive.php. I found one from here but it's still giving me notices. I'm using `Reverie Theme` in `WordPress 3.6-alpha-23288` This is my code after implementing the fix **Plugins/MyMainPlugin.php**               add_filter( 'getMainMenu',  array( $this, 'getMainMenu'),           10, 1);     function getMainMenu( $menuLocation ) {         $locations          = get_nav_menu_locations();              if ( empty( $menuLocation ) ) {             $menuLocation   = 'primary_navigation';         }              $menuItems          = wp_get_nav_menu_items( $locations[ $menuLocation ] );         if ( empty( $menuItems ) ) {             return false;         } else {             wp_nav_menu( array(                 'theme_location'    => $menuLocation,                 'container'         => false,                 'menu_class'        => '',                 'echo'              => true,                 'before'            => '',                 'after'             => '',                 'link_before'       => '',                 'link_after'        => '',                 'depth'             => 0,                 'items_wrap'        => '
%3$s
',                 'walker'            => new reverie_walker() ) );             return true;         }     }      **Theme/header.php**               if ( !apply_filters( 'getMainMenu', 'primary_navigation' ) ) {         $backup     = $wp_query;         $wp_query   = NULL;         $wp_query   = new WP_Query( array( 'post-type' => 'post' ) );         apply_filters( 'getMainMenu', 'primary_navigation' );         $wp_query   = $backup;     }      **Notices** > Notice: is_category was called incorrectly. Conditional query tags do not > work before the query is run. Before then, they always return false. Please > see Debugging in WordPress for more information. (This message was added in > version 3.1.) in /var/www/customers/xxx/public_html/wp- > includes/functions.php on line 2981 Notice: is_tag was called incorrectly. > Conditional query tags do not work before the query is run. Before then, > they always return false. Please see Debugging in WordPress for more > information. (This message was added in version 3.1.) in > /var/www/customers/xxx/public_html/wp-includes/functions.php on line 2981 Any ideas how to solve this, and might be causing this? I have no idea what's causing that. **Update**   This actually affects to footer as well. So, I don't see any footer on my archive.php page either.


title: Most Wordpress sites causing realpath errors

text: recently installed some debugging software on our server and realised that most errors are coming from realpath() in Wordpress sites.               realpath() [function. realpath]: open_basedir restriction in effect. File(/var/www/vhosts/ xxx. com) is not within the allowed path(s): (/var/www/vhosts/ xxx. com/httpdocs/:/tmp/)      The sites are working OK but these are bugging me. Mostly because its hard to see any serious errors coming up! Would errors like this also affect performance?


title: How to detect if a Shortcode is being called on a page?

text: I'm trying to push some variables to google analytics and would like to be able to detect if a shortcode has been included on a page at all. Anybody know a smart way going about this? Thank you! Noel


title: Display smilies in Sidebar, too?

text:
I want the smilies to be generated in my sidebar (where it shows the recent posts, comments etc.) and not being displayed as text only. I've been searching through the Wordpress Codex, Google and here, but couldn't find any answers. Is this possible at all anyways? How would I do it for recent comments that I display in the sidebar?               <?php   $comments = get_comments('status=approve&number=5'); ?>     <?php foreach ($comments as $comment) { ?>

<?php             $title = get_the_title($comment->comment_post_ID);             echo get_avatar( $comment, '45' );     echo strip_tags($comment->comment_author); ?> commented on <a href="<?php echo get_permalink($comment->comment_post_ID); ?>#comment-<?php echo $comment->comment_ID; ?>" rel="external nofollow" title="<?php echo $title; ?>"> <?php echo $title; ?>: <?php echo wp_html_excerpt( $comment->comment_content, 45 ); ?> (...)

     <?php }  ?>      Thanks in advance.


title: Using Relevanssi outside search with cpt/custom taxonomy

text: I'm trying to use Relevanssi to generate related articles using this example script. It does the job but I would need to modify it and I'm not all that familiar with query_vars. All my articles are in an `article` custom post type with a custom category taxonomy `article_category` and what I want to do is to limit the results to one `article_category` (there are three different top categories and I want to avoid having the results mixed between those, I would use `get_ancestors()` to find what top category to use ). I would also like to know how to limit the results to the `article` custom post type - though this will sort itself out automagically if I can limit the results to a category of my custom taxonomy. You're supposed to be able to add query_vars but, sadly, I have no idea what those are other than in this context, but the variables from the example aren't part of that - e.g. where does a variable like the `operator` bit come from in this `$query->query_vars['operator']`?


title: Tagcloud: different color for different text size

text: I'm using `<?php wp_tag_cloud( $args ); ?>` to create a tag in my sidebar. With the "args" you can style it quite a bit, even the different text size, but it doesn't seem to be possible to apply different colors. What I did is a plain CSS solution which looks somewhat like this:               #tagcloud ul .tag-link-8 {     color:#666;     }          #tagcloud ul .tag-link-7 {     color:#7EA7C9;     }          #tagcloud ul .tag-link-9 {     color:#6A9EA5;     }      It works okay, but this is a hassle. I have to apply the colors manually and once I have 50 tags or so this will be kind of ridiculous. I was wondering if there is a way to connect e.g. the text-size to a specific color (like some tagcloud plugins seem to do anyways) (size:8 = red etc.)? Anybody any ideas? Thanks a lot in advance!


title: Is there a way to create a meta box that can be added multiple times to a post dynamically?

text: This shouldn't be that difficult (I wouldn't think) ... I just want to have a section of my theme (directors) that has the name of the director / their bio in the title and post respectively (done). _But_ , I would also like to have a meta-box on their post for their work (title / client / date / video link / thumb ) and I would like to be able to **add** or **remove** instances of this meta box as needed ... i.e. director A) has 3 videos ... director B) has 5 videos. How do I create a meta box (or is there something else in WP) that can be dynamically added / removed (like the way the menu system works) where I have a menu and I can add as many or as few items to the menu as i want / need.


title: WooCommerce wp_insert_post action firing on every save

text: function initial_product_data ( $post_id ) {     // lets get out of here if this is not a new product     if ( 'product' != $_POST['post_type'] )         return;          // make sure the post isn't automagically featured     // WTF WooCommerce??!!     update_post_meta( $post_id, '_featured', 'no' );          // automatically set the swatch     update_post_meta( $post_id, '_swatch_type', 'pickers' );         update_post_meta( $post_id, '_swatch_type_options', unserialize('a:1:{s:7:"pa_size";a:4:{s:4:"type";s:12:"term_options";s:6:"layout";s:7:"default";s:4:"size";s:19:"swatches_image_size";s:10:"attributes";a:3:{s:7:"x-large";a:3:{s:4:"type";s:5:"color";s:5:"color";s:7:"#FFFFFF";s:5:"image";s:1:"0";}s:23:"x-large-toplarge-bottom";a:3:{s:4:"type";s:5:"color";s:5:"color";s:7:"#FFFFFF";s:5:"image";s:1:"0";}s:23:"x-small-topsmall-bottom";a:3:{s:4:"type";s:5:"color";s:5:"color";s:7:"#FFFFFF";s:5:"image";s:1:"0";}}}}') );     }          add_action( 'wp_insert_post', 'initial_product_data' );      The code works fine and _almost_ does what its supposed to do. However, it seems like it fires _every time_ a product is saved and the user can't alter the values set on the initial product creation. Any suggestions? Or is this a WordPress bug?


title: Perform internal redirect in WordPress?

text: Let say I have an existing page named "bar", e.g. http://www.example.com/bar I want to write a plugin, which when called, will load the content exactly same as bar (not just post_content, but the whole page such as menu, sidebar and footer) Something like..               if ($_SERVER['REQUEST_URI'] == '/foo') {       // Perform internal redirect to /bar     }      Any idea?


title: Run a Wordpress function inside a wp_query loop result

text: I have a search results page that displays multiple results in a multi column layout. I am trying to run a function via a button/link that will allow users to add that post to a "favorites list". The function works 100% perfectly on the first result, but gets ignored when I try do any others. I am sure this has something to do with non-dynamic forms/id's as all the results are identical - but even after adding unique id to the forms and buttons the same thing happens. Any suggestions? Here is the code:   1. We get wp_query from filters: wp_query: https://gist.github.com/stankobrin/f0d19b2bdc5f0f77b8e4   2. Inside the results we call the apf_post_form to add to favourites: apf_post_form function: https://gist.github.com/stankobrin/975b24c7d7a780b82fc8   3. AJAX refreshes the page updates the response and resets the fields Any help would be highly appreciated!


title: include other content type post ID not working

text: I am calling content type portfolio in a page but i want to show some pages by id with portfolio content type, below code only retrieve the portfolio posts.                    $args = array( 'post_type' => 'portfolio', 'include' => '73,71' ,          'posts_per_page' => 30, 'order' => 'ASC', 'paged' => get_query_var('paged'));         $loop = new WP_Query( $args );         while ( $loop->have_posts() ) : $loop->the_post();      Note: include Id 73,71 content types are 'page'


title: Styling Active Links Within Wordpress

text: I wish to style the active link (ie. when home page is selected that the home page link be a different colour)               .current-menu-item a { color: #36c; }      My test site is : www.milknhny.co.uk/ShopTest I placed this in the CSS as i believe this was the class that i wished to change, however it does not appear to have worked. Could i please ask where i have gone wrong on this? thanks


title: How to echo a different field if another field is empty?

text:
I succeeded in getting both images and video to echo into a bootstrap carousel. However, I run into a problem when the post contains no images. If there are no images then there is no class="item active" so the bootstrap carousel won't show. Here is my workaround I feel like I'm almost there, can someone give me a hand?               <?php $myCarousel = get_order_field('projectdetails_image'); // use the Custom Group name              if( !empty( $myCarousel )) {                     foreach($myCarousel as $carousel){                                 if ($counter == 0) {                                     echo "
";                                     echo '';                                     echo "
";                                 }                                 else{                                     echo "
";                                     echo '';                                     echo "
";                                 }                                 $counter++;                          $videos = get_order_field('video_vimeo');                     foreach($videos as $video){                         if ( get('video_vimeo',TRUE) ) {                                 echo "

";                                 echo get('video_vimeo',1,$video);                                 echo "

";                         }                         else {}                     }                     }                }             else{                                 $videos = get_order_field('video_vimeo');                     foreach($videos as $video){                         if ( get('video_vimeo',TRUE) ) {                                 echo "

";                                 echo get('video_vimeo',1,$video);                                 echo "

";                         }                         else {}                     }                }?>      Got it finally:                   <?php $myCarousel = get_order_field('projectdetails_image'); // use the Custom Group name      if( !empty( $myCarousel )) {             foreach($myCarousel as $carousel){             $myimg = get('projectdetails_image',1,$carousel);             if ( !$myimg ) {             $videos = get_order_field('video_vimeo');             foreach($videos as $video){                 if ( get('video_vimeo',TRUE) ) {                         echo "

";                         echo get('video_vimeo',1,$video);                         echo "

";                 }                 else {}             }                }             if ( $myimg ) {                 echo "
";                 echo '';                 echo "
";                 $counter++;                      $videos = get_order_field('video_vimeo');                 foreach($videos as $video){                 if ( get('video_vimeo',TRUE) ) {                     echo "

";                     echo get('video_vimeo',1,$video);                     echo "

";                 }}             }         }     }     else{                         $videos = get_order_field('video_vimeo');             foreach($videos as $video){                 if ( get('video_vimeo',TRUE) ) {                         echo "

";                         echo get('video_vimeo',1,$video);                         echo "

";                 }                 else {}             }        }?>


title: Unable to browse WP plugin directory within WP's admin panel

text: This is kind of a weird problem. I upgraded all my WP installations to the latest 3.8 version and in one of them I seem to have lost the ability to browse through the plugin directory. When I click on "Add New" to install a new plugin and try to search for something, no matter what I type on the search box I always get this: _No plugins match your request._ Clicking on Featured, Popular etc. gives nothing as well. I tried reinstalling WP, deactivating installed plugins but nothing changed. Permissions to the wp-content and the plugins folder seem to be ok and I have 3 more separate WP installations in the same server without this problem. Is there anything else I could try? Has anyone else had this problem?


title: How to Display Custom Taxonomies in an Un-ordered HTML List

text: Having a Custom Taxonomy function like below, can you please let me know how I can list all of my Taxonomies in an unordered html list               enter code here     function create_conference_taxonomy() {      $topiclabels = array(      'name' => 'Topic',      'singular_name' => 'topic',      'search_items' => 'Search topics',      'popular_items' => 'Popular topics',      'all_items' => 'All topics',      'parent_item' => null,      'parent_item_colon' => null,      'edit_item' => 'Edit topic',      'update_item' => 'Update topic',      'add_new_item' => 'Add new topic',      'new_item_name' => 'New topic name',      'separate_items_with_commas' => 'Separate topics with commas',      'add_or_remove_items' => 'Add or remove topics',      'choose_from_most_used' => 'Choose from common topics',      'menu_name' => 'Conference topics',       );       register_taxonomy( 'conference_topics', 'conference_session',         array(       'hierarchical' => false,       'labels' => $topiclabels,       'query_var' => true,       'update_count_callback' => '_update_post_term_count',       'rewrite' => array('slug' => 'topics' )        )       );      }      Thanks


title: RSS Feed in Custom Field

text: I have a custom field intended for a rss feed. It is simpley a URL in the field, how do I take that url entered and output it into the correct section in the template?               <?php include_once(ABSPATH . WPINC . '/rss.php');wp_rss('<?php echo get_post_meta($post->ID, 'wpcf-rss', true); ?>', 3); ?>      Does not work


title: Make 'Post 2 Post' Connection mandatory

text: As the title states, I need to make a P2P connection a required field when creating new posts. The only mention of such a feature that I've found is here, but I'm not sure how to implement it.


title: Wordpress backup(on another server)leading to old server addy and WP

text: So long story short, someone told me about BACKUPBUDDY and how good it is, etc, and it is...now long story short, one of my clients, wants to move their site from FATCOW to HOSTGATOR. I went in, created the backup with BACKUPBUDDY on the old site(fat cow), then went to the new site and migrated the info.(into hostgator) now obviously for testing and other edits they want made,etc i log into the server or view the new site on the browser with their IP address.(host gator the new one)...and i havent pointed the domains to new site yet.... now that said, i noticed that when i use for example, "ip address / wp- login.php" it logs me in but then when i look up in the address bar, it says the FATCOW(old server) name/domain instead of the IP. so instead of seeing "ip addy /wplogin " i see " full name of site/wp-login " So my quesiton is , whats happening? if i cant fix this, i cant really test to make sure all is okay b4 pointing the nameservers. Any ideas as to whats going on? im a bit of a WP noob so... Thanks in advanced.


title: Removing plugin settings from database

text: I am developing a little plugin that has couple options. For that i use this code:               add_action('admin_init', array($this, 'pa_register_settings'));     function pa_register_settings()     {         register_setting('pa_options', 'pa_settings');         register_setting('pa_options', 'pa_metrics');         register_setting('pa_options', 'pa_token');     }      I would like to know what is the proper way to remove those settings from database when plugin is uninstalled?


title: Want Page Descendants when using query_posts post_parent or child_of

text:
I'm trying to use query_posts to list all descendants of a page ID. Using post_parent only lists the first-level children. This Trac ticket seems to address it: http://core.trac.wordpress.org/ticket/5742, but I don't understand it -- post_parent only lists the first-level children.               <?php         query_posts( array(         'post_parent' => 58, // Only shows posts that are direct children of the Machinery page. I want all descendants.         //'child_of' => 58, // When used, shows posts filterd by taxonomy and term, but not filtered by child of ID 58. Acutally omits direct child of 58 but shows grandchild.         'post_status' => 'any',         'post_type' => 'any',         'taxonomy' => 'industries',         'term' => 'dairy'         ));      ?>     <?php if ( have_posts() ) : ?>
Dairy Machinery

             <?php while (have_posts()) : the_post(); ?>
                     <a href="<?php the_permalink(); ?>"><?php the_title(); ?>
             <?php endwhile; ?>
     <?php endif; wp_reset_query(); ?>      How do I get query_posts to list all descendants of a page ID?


title: WP User Avatar preview for users

text: I have downloaded WP User Avatar plugin, to add the functionality to create your own avatars for users. I was wondering if it is possible to show for each user the avatar in my theme markup. How can I do this?


title: Why don't my custom menus show up in WPtouch Pro?

text: I'm using WPtouch Pro to create a mobile theme for my wordpress installation. I've activated it, but the custom menus I've created don't show up in menus drop down. Note that I'm using a different database table prefix than the default wp_. How can I get them to show up?


title: Best way to enqueue extremely popular scripts like bootstrap and font awesome

text: Scripts and Styles like bootstrap and font awesome are used on hundreds/thousands of plugins. Whats the best way to check for this? If two scripts aren't registered with exact same name they'll both get loaded. This is most frustrating when a plugin includes font-icons from ico-moon or somewhere similar that change the icon codes so all the icons will get loaded with the wrong images. Is there a good way to remove adding scripts/styles? : My guess would be something like using `wp_script_is()` and checking an array of files that would match ones like bootstrap and font awesome, but that sounds pretty heavy/ tedious. If there isn't a way to ensure this doesn't happen, what is the best practices for naming your scripts? Sorry if this is repeat, it seems like something that's probably been asked just couldn't find it.


title: wp-pagenavi getting 404 page not found

text:
Wordpress WP-PageNavi plugin gettinf 404 error. here is my code.                <?php  $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;             query_posts(array(         'posts_per_page' => 3,         'paged' => $paged        )       ); ?>         <?php if(have_posts()) : while(have_posts()) : the_post(); ?>          <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>          <?php the_title('
', '
'); ?>           <?php endwhile;  if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>             <?php wp_reset_query(); else : ?>
<?php _e('Sorry, no posts matched your criteria', 'example');
            <? php endif; ?>


title: What variables from the main query do I take over to make an archive load a page out of the loop?

text: My question is a little confusing, I realize, but I'm not sure how else to word it -- sorry! I might be going about this the wrong way but I want to do with a CPT archive what WordPress does with the 'post' post_type and how you associate it with a specific page from the Settings > Readings section (so when you land on page "blog" it acts like the "post" archive). The reason for this is that I want it to recognize the featured image and metadata for that specific page. I figure I have to hook into pre_get_post and make sure it's the main query but I'm not sure which variables to hijack to make it act this way. Any ideas?


title: add login and signup popup form in header

text: I use `<?php wp_register(); ?> <?php wp_loginout(); ?>` to show a link to the wordpress login and sign up screen. It opens up another page. My question is how do I make it so that when the user clicks the link a pop up will appear. Like using jQuery. But on these php codes. thanks you for your help


title: can I add a custom format to the format option in the text panel?

text: In the text editor, where you can set headings and other settings, is it possible to add your own styles for clients to use? and even remove the unnecessary ones?


title: Removing <li> from Comment

text:
I'm making a custom comment template, and I do not wish to use a list to display comments. By default, WordPress puts the following at the end of every comment:
      I know I could hack the core `wp-includes/comment-template.php`, but that would leave me to not be able to update normally. Is there a way to remove this? Here's my functions callback:               <section id="li-comment-<?php comment_ID(); ?>">         <article id="comment-<?php comment_ID(); ?>" class="comment <?php if ($comment->comment_author_email == get_the_author_email()) { echo 'author-comment'; } ?>">
                                      <?php echo get_avatar($comment, '50'); ?>                                  <?php comment_text(); ?>

Posted by : <?php echo get_comment_author(); ?>

On <?php the_time('l, F jS, Y') ?>  at <?php the_time() ?>

                     <?php comment_reply_link( array_merge( $args, array( 'reply_text' => 'Reply to Comment', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>


title: "Add Media" button in custom plugin

text: I'm writing a custom plugin and i would like to add the "Add Media" button. I just need to upload media, not to retrieve any content/data from the uploaded file. How can I add this button? Thanks