Query posts from a child taxonomy term id

this is my structure.... State1               CT1-1          - Car_Model Post-CT1-1 (the posts of child)          - Car_Model Post-CT1-2     CT2-1          - Car_Model Post-CT2-2     CT3-1          - Car_Model Post-CT3-1      State2               CT1-2     CT2-2     CT3-2      State3               CT1-3     CT2-3     CT3-3      Here is the logic of what i have done to display triple drop down for displaying 2 taxonomies and a child   * 1st drop ------> State (Taxonomy)   * 2nd drop ------> City (child of State Taxonomy)   * 3rd drop ------> Manufacturer (Taxonomy) now instead of manufacturer in the 3rd drop i have to Query posts from a taxonomy term id on selecting the 2nd drop                <!-- WORKING LOGIC Triple Drop Down Start -->           <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>      <script type="text/javascript">     $(function()     {         $('#main_cat').change(function()         {             var $mainCat=$('#main_cat').val();                  // call ajax             $("#sub_cat").empty();             $("#manu_cat").empty();             $.ajax             (                 {                     url:"<?php bloginfo('wpurl'); ?>/wp-admin/admin-ajax.php",                          type:'POST',                     data:'action=my_special_ajax_call&main_catid=' + $mainCat,                          success:function(results)                     {                         //  alert(results);                         $("#sub_cat").removeAttr("disabled");                                $("#sub_cat").append(results);                     // it should be closed here an perform new ajax call not in success ok ?                          // Passing the sub_cat to the function for displaying 3rd drop down list                         $(function()                         {                             $('#sub_cat').change(function()                             {                                 var $subCat=$('#sub_cat').val();                                      // call ajax                                 $("#manu_cat").empty();                                 console.log($("#manu_cat"));                                 $.ajax                                 (                                     {                                         url:"<?php bloginfo('wpurl'); ?>/wp-admin/admin-ajax.php",                                              type:'POST',                                         data:'action=my_special_ajax_call&main_brand_id=' + $subCat,                                              success:function(results)                                         {                                             //  alert(results);                                             $("#manu_cat").empty();                                             $("#manu_cat").removeAttr("disabled");                                                   $("#manu_cat").append(results);                                          }                                     }                                 );                                                                 });                         }); // function end for manufature jQuery                     }                 }             );                                             });     });          // for manufacturer logic paste here           </script>      <style type="text/css">      #content{width:auto; height:400px; margin:50px;}      </style>           <form role="search" method="get" id="searchform" action="<?php echo get_option('siteurl');?>/">     <div id="content">         <?php              wp_dropdown_categories('show_count=0&selected=-1&hierarchical=1&depth=1&hide_empty=0&exclude=1&show_option_none=Select State&name=main_cat&taxonomy=state');         ?>         <select name="sub_cat" id="sub_cat" disabled="disabled"></select>         <select name="manu_cat" id="manu_cat" disabled="disabled"></select>              <input type="submit" id="searchsubmit" value="Search" />             </div>     </form>                <!-- WORKING LOGIC Triple Drop Down End -->      **Functions.php**               function implement_ajax() {     if(isset($_POST['main_catid']))             {             $categories=  get_categories('child_of='.$_POST['main_catid'].'&hide_empty=0'.'&taxonomy=state');     //change the taxonomy state in your case               foreach ($categories as $cat) {                 $option .= '<option value="'.$cat->term_id.'">';                 $option .= $cat->cat_name;                 //$option .= ' ('.$cat->category_count.')';                 $option .= '</option>';               }                    echo '<option value="-1" selected="selected">Select City</option>'.$option;             die();             } // end if          if(isset($_POST['main_brand_id']))             {             $categories=  get_categories('&hide_empty=0'.'&taxonomy=manufacturer');     //change the taxonomy manufacturer in your case               foreach ($categories as $cat) {                 $options .= '<option value="'.$cat->term_id.'">';                 $options .= $cat->cat_name;                 //$option .= ' ('.$cat->category_count.')';                 $options .= '</option>';               }                    echo '<option value="-1" selected="selected">Select Make</option>'.$options;             die();             } // end if               }     add_action('wp_ajax_my_special_ajax_call', 'implement_ajax');     add_action('wp_ajax_nopriv_my_special_ajax_call', 'implement_ajax');//for users that are not logged in.      The logic starting from this line **if(isset($_POST['main_brand_id']))** has to be replaced, so here **if(isset($_POST['main_brand_id']))** i have to pass the term_id of the taxonomy to retrieve the post, kindly help how to query the logic to retrieve the relevant posts titles. Hope someone will help me........


Creating a table from shortcode avoiding wpautop for each row

I'm probably doing this all wrong, and there'll be a much simpler solution. Basically, I'm trying to build a table of tour dates that'll be editable by someone with little technical knowledge, but can handle shortcodes. There's also some custom functions in the table (with regards to displaying the date, and having an expiring ticket link) that makes me want to avoid a clunky table plugin. So here's the code I'm experimenting with, that's working apart from it's introducing a   tag for each new line of and separate short code. I don't want to disable wpautop completely, as it's used widely throughout the website and elsewhere on the page that this table will be appearing on.               [tour_table tour_name="The Tour Name"]     [tour_table_line tour_date="2011-06-19" ticket_link="http://ticket.link/" venue="The Venue Name"]     [tour_table_line tour_date="2011-06-19" ticket_link="http://ticket.link/" venue="The Venue Name"]     [tour_table_line tour_date="2011-06-19" ticket_link="http://ticket.link/" venue="The Venue Name"]     [tour_table_line tour_date="2011-06-19" ticket_link="http://ticket.link/" venue="The Venue Name"]     [tour_table_line tour_date="2011-06-19" ticket_link="http://ticket.link/" venue="The Venue Name"]     [tour_table_line tour_date="2011-06-19" ticket_link="http://ticket.link/" venue="The Venue Name"]     [/table]      The parsing of the table is all handled in functions.php by the wrapping function tour_table() and the function [tour_table_line] which is executed inside a do_shortcode() function (from the wrapping function). So the basic problem is that each new line is earning itself a new   tag, which is placing a massive space above the table. If anyone has any more elegant solutions, or can help me get the functionality I'm looking for, I'd be very appreciative of your help. If you need more detail, please let me know. Edit to add functions (probably quite a bit of convoluted code in there:               function tour_table($atts,$content = null){         extract( shortcode_atts( array(             'tour_name' => '',             'anchor_table' => ''         ), $atts ) );              if($anchor_table!=""){             $hid = "id=\"tourscrollto\"";         }else{             $hid = "";         }              $theoutput = "
";         $theoutput .= $tour_name;         $theoutput .= "

";         $theoutput .= do_shortcode($content);         $theoutput .= "

";         return $theoutput;     }          function tour_table_line($atts){         extract( shortcode_atts( array(             'tour_date' => '',             'ticket_link' => '',             'venue' => 'The Venue'         ), $atts ) );              $date_original = $tour_date;         $date_unix = strtotime($tour_date);              $theoutput = "
";         $theoutput .= date('D',$date_unix);         $theoutput .= "	";         $theoutput .= date('j M',$date_unix);         $theoutput .= "	";         $theoutput .= $venue;         $theoutput .= "	";         //$ticketlink = ticketlinkexpire($date_original,"Buy Tickets","");         //$theoutput .= $ticketlink;         $theoutput .= "
";              return $theoutput;          }          add_shortcode( 'tour_table' , 'tour_table' );     add_shortcode( 'tour_table_line' , 'tour_table_line' );


On cliking add new post redirect user to a custom page first

Probably my question title is confusing. I want something like this:   1. I have custom post type   2. When I click on add new, I would like to go to a "select" page   3. The select page allows you to make a choice (by clicking the appropriate box)   4. You are then redirected to the standard 'add new' custom post type page. However, a custom metabox will be pre-filled with data based on the choice in step 3. The url would have a custom query variable e.g. "wp-admin/post-new.php?post_type=my-box&box_id=3" Ok, hope you understand me now, how can I force that before I go to add new page, to show that my "select page" ?


can't import xml file

While i upload xml file to my site , the following error message occur and uploading fail > Sorry, there has been an error. File is empty. Please upload something more > substantial. This error could also be caused by uploads being disabled in > your php.ini or by post_max_size being defined as smaller than > upload_max_filesize in php.ini I can't edit the stuff mentioned in above (php.ini) becoz of mine is hosted on shared hosting and i don't wanna migrate from database or something like that . Is there a ways from migrating from wordpress scope ???


How to add CSS Class to previous_post_link or get previous/next post link URL

How can I add a CSS Class to the `previous_post_link` output or just get the URL and create the HTML markup myself


Dynamically Register Sidebars For Each Top Level Page

I have a small website that wants a different sidebar for each page containing blocks of text, blocks of images, and blocks of links, etc. What I'm trying to do is register a sidebar for each top level page:               if ( function_exists('register_sidebar') ){         $topLevel = get_pages(array(             'sort_column'   => 'post_date',             'hierarchical'  => 0,             'parent'        => 0,             'post_type'     => 'page',             'post_status'   => 'publish'         ));              foreach($topLevel as $page)         {             //make alphaunermic             $sidebarID = preg_replace("/[^a-z0-9_\s-]/", "", strtolower($page->post_title));                  //Clean multiple dashes or whitespaces             $sidebarID = preg_replace("/[\s-]+/", " ", strtolower($page->post_title));                  //Convert whitespaces and underscore to dash             $sidebarID = preg_replace("/[\s_]/", "-", strtolower($page->post_title));                  register_sidebar(array(                 'name' => $page->post_title,                 'id'   => $sidebarID,                'description'   => '',                 'before_widget' => '
'                 'after_widget'  => '
',                 'before_title'  => '
',                 'after_title'   => '
'               ));         }     }      1) is this possible? 2) is there a better way to go about this? 3) I'm getting a few errors...


Creating a Horizontal menu

i'm new to creating wordpress themes and want a menu at the Top of my page. I do have the following: Header.php                         <title>Tutorial theme</title>     <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>">
     <?php wp_nav_menu( array('menu' =>'Top Navi', 'container' => '', 'items_wrap'  => '
%3$s
'  ) ); ?>

      functions.php               <?php     add_theme_support( 'menus' );     if (function_exists('register_nav_menus')) {     register_nav_menus(         array(             'main_nav' => 'Main Navigation Menu'             )         );     }     ?>      And finally my css file http://pastebin.com/Pjr3THJm However my menu comes out in a list, not horizontally. What am i doing wrong?


How to protect wp-admin through .htaccess?

I'd like to protect the /wp-admin/ directory at the server level. This means two logins. One through the server and another through WordPress. I believe this can be handled through .htaccess. Does anyone know how? Also, are there any files that will need access (i.e., admin-ajax.php)?


How do spam users register while I've only enabled registration by Gmail via Janrain?

In wp-login.php?action=register, I've disabled text fields (sorry this web site is in Japanese only but hope you can see that there's no text field) and enabled registration only via social login by janrain plugin, and set it to accept `GMail` only. In this way I expect all new users have `GMail` addresses. However there are still new users who aren't using `GMail`, and what's worse is they look like spam. Examples are:               Account name: Anddcusd, cqbx33@groupd-mail.net     Account name: Anddcuse, cqbx34@groupd-mail.net     Account name: Anddcusg, cqbx36@groupd-mail.net      How can they still create accounts, with non-approved email addresses? Thanks! `WP` 3.5, `Janrain Engage` 1.1.1


How to upload an image using media uploader and return the image link to javascript?

I'm new to Wordpress, and i'm developing a plugin. I'm havin some troubles with image upload... Is there a way to call a JavaScript function in a onClick tag, that calls the Wordpress media uploader, and after the upload, saving the uploaded image link into a JavaScript variable? Without leaving the page, using thickbox. Every single option i tried on google, leaves the page after the image upload.               function imageUpload() {             formfield = jQuery('#upload_image').attr('name');             tb_show('', 'media-upload.php?type=image&TB_iframe=true');             return false;              window.send_to_editor = function(html) {             imgurl = jQuery('img',html).attr('src');             alert(imgurl);             tb_remove();         }      }      and calling in the html using `<input onClick=\"imageUpload();\" id=\"upload_image_button\" class=\"alterar- logo onetarek-upload-button button\" type=\"button\" value=\"Upload Image\" />` It makes the upload, but when i click in "insert into post" it won't copy the variable Using WP 3.6, by the way... Edit: i managed to do it by removing `return false;`


How to add enctype to multipart/form-data to comment form?

I need a way to change the encoding type for my comment form, without hacking the core files. I'm aware of the function to work on the post editing form: `post_edit_form_tag`. I've tried this:               jQuery('#comment_form').attr("enctype","multipart/form-data");      But it doesn't work, the only next step I know of is to hack the source code... Any help would be very much appreciated—thanks in advance!


Parent for a single (single.php)

Is it posible to get the parent ID of an single page.... I mean not a Page I mean an is_single()... page. I have a page witch contains some custom posts and when I click on one of these i came to the single page of these entree. I would like to get the permalink of the parent page, the page i come from.


Server-side subscribe by email?

Is there a server-side email solution that will allow users to subscribe to updates via email and, specifically, also be able to do this by category? I'm aware of Aweber and Feedburner being able to provide this kind of functionality, but my client has requested this as a server-side solution, with a database on-site. Any suggestions?


Get Value of Post before

I have a normal loop in wordpress and in every post i need to check the value of the post before to compare it with the current post. -- POST 1 -- ** DO NOTHING ** -- POST 2 -- ** GET VALUE FROM POST 1 ** -- POST 3 -- ** GET VALUE FROM POST 2 **               <?php          if ( have_posts() ) {             while ( have_posts() ) {                 the_post();                            $description = get_post_meta( get_the_ID( ), 'metabox_description', true );                              echo $description;                            // Add: echo $description_from_post_before;                  } // end while         } // end if     ?>


Changing Admin Menu Labels

I have spent the last day using the functions.php file to fully customize WordPress for my client sites. I am amazed at how much I have been able to accomplish and how much easier it will make things for my clients. I have removed certain menu items for users that are not logged in as an admin. What I am hoping (and from what I have read know it can be done) is to find a way to rename some of the menu items (left sidebar in the admin area). For instance change Posts to Articles. If anyone can supply the code for the functions.php file or point me in the direction I would greatly appreciate it!


Regex problem in an add_rewrite_rule

I'm working on a category page for a custom post type called articles in WP 3.1, and I'm having some trouble with extracting the page number. The url: `/articles/category/background/` Currently, what works for me, from my `functions.php`:               add_action( 'init', 'wpse7379_init' );     function wpse7379_init() {         add_rewrite_rule(             'articles/category/([^/]+)(/page/([0-9]+))/?$',             'index.php?post_type=articles&category_name=$matches[1]&paged=$matches[2]',             'top'         );     }      This internally rewrites the url to: `/index.php?post_type=articles&category_name=background` I'm trying to make the pagination work by expanding the rewrite rule, but it's not working for me. The pagination works as follows: `/articles/category/background/page/2/` New rule:               add_rewrite_rule(         'articles/category/([^/]+)(/page/([0-9]+))/?$',         'index.php?post_type=articles&category_name=$matches[1]&paged=$matches[2]',         'top'     );      This should rewrite the url to: `/index.php?post_type=articles&category_name=background&paged=2` I'm using a query with args on my `archive-articles.php` page, but just a regular loop on the `categories.php` page, where the posts are displayed. When I try `/index.php?post_type=articles&category_name=background&paged=2` it works, but the url that gets rewritten doesn't. Its just displaying the first page, no matter what I enter as pagenumber. Does anyone know how to fix this? **I think I'm looking for a proper regex, I kinda suck at regexes, so I guess thats the problem.**


Why is previous_post_link and next_post_link working outside of the Loop?

**This is my single.php file:** I'm using `previous_post_link();` and `next_post_link();`. In the Worpress codex it says that it only works inside the loop.               <?php     /**      * The Template for displaying all single posts.      *      * @package WordPress      * @subpackage Starkers      * @since Starkers 3.0      */              get_header(); ?>              <?php get_sidebar(); ?>
             <?php // Create and run custom loop                 $custom_posts = new WP_Query();                 $custom_posts->query('post_type=blocks&location=Work&section=Intro');                 while ($custom_posts->have_posts()) : $custom_posts->the_post();             ?>
                     <?php the_post_thumbnail('large'); ?>
             <?php endwhile; ?>                  <?php // Create and run custom loop                 $custom_posts = new WP_Query();                 $custom_posts->query('post_type=blocks&location=Work&section=Tagline');                 while ($custom_posts->have_posts()) : $custom_posts->the_post();             ?>
                     <?php the_content(); ?>
             <?php endwhile; ?>             <?php wp_reset_query(); ?>                  <?php // Display the thumbnails of previous and next posts ?>
                 <?php // Display the thumbnail of the previous post ?>
 <?php                         $prevPost = get_previous_post();                         $prevthumbnail = get_the_post_thumbnail($prevPost->ID); ?>
<?php previous_post_link('%link', 'Previous'); ?>
                         <?php previous_post_link('%link', $prevthumbnail); ?>
                      <?php // Display the thumbnail of the next post ?>
 <?php                         $nextPost = get_next_post();                         $nextthumbnail = get_the_post_thumbnail($nextPost->ID); ?>
<?php next_post_link('%link', 'Next'); ?>
                         <?php next_post_link('%link', $nextthumbnail); ?>

                  <?php // Create and run custom loop                 $custom_posts = new WP_Query();                 $custom_posts->query('post_type=blocks&location=Front Page&section=Sidebar');                 while ($custom_posts->have_posts()) : $custom_posts->the_post();             ?>

<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>
                     <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_post_thumbnail(); ?>
<?php the_excerpt(); ?>

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

             <?php endwhile; ?>                  <?php // Start the main loop                 if ( have_posts() ) while ( have_posts() ) : the_post();             ?>
                     <?php the_content(); ?>
             <?php endwhile; // end of the loop. ?>                  <?php get_sidebar('secondary'); ?>
              <?php get_footer(); ?>


Redirect to Current Page after Login

In my wordpress page, I add Login- logout item to the main menu using the code (in functions.php) below :               add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);     function add_login_logout_link($items, $args) {             ob_start();             wp_loginout('index.php');             $loginoutlink = ob_get_contents();             ob_end_clean();             $items .= '<li>'. $loginoutlink .'</li>';         return $items;     }      When login is performed using this button, It should redirect the current page where login is clicked. How can I do that? I think `wp_loginout('index.php')` needs to change because after login and logout I redirect to home page. What should I write to go previous page ?


RSS Subsriber count without using feedburner

Currently, I have a blog which is running on wordpress. I want to know how many users subscribe my feeds. I know that if i used feedburner, I can get the counter from there. But I was really wondering if there's anyway that we can track the subscriber easily. Please kindly share the code or ideas. Thanks.


What is the difference between these two methods of writing $ instead of jQuery in WordPress               (function($) {          // $ Works! You can test it with next line if you like     // console.log($);          })( jQuery );      ... Which I found here and               jQuery(function ($) {     /* You can safely use $ in this code block to reference jQuery */     });      ... Which I found here


Search Results with googlemaps

I have made a custom search for houses. The problem is that I have to show in the search results page, a "googlemaps" with the points at which there is a house, according to the search results obtained. How can I do it? Thanks.


Enqueue scripts to a specific header-<name>.php?

I've multiple header files (header-name.php), they are mainly being used by different custom post types. Is there any way to enqueue script to only a specific header? At this moment I'm targeting it with conditional tag like if `( 'MYPOSTTYPE' == get_post_type() )` but I'm looking for a better alternative. do we have something like `is_header('name')`?


firing function at login within class

I've got a function that I'm trying to fire at wp_signon (grabs data from a remote server and updates accordingly). I'm running the function within a class that is on a secondary file in a plugin (i.e. brought in with a require_once). For the life of me, I cannot get this function to run at all.               add_action( 'wp_signon', array(&$this, 'login_pull_updates'), 40, 3 );                  function login_pull_updates() {                 update_option('ap_login_run', 'YES I DID');             }      I'm using that now to just test and confirm it's running at all, and it won't fire. Any ideas?


sort post attachments by title order (numerical)

I have been assigning numerical values to all the post attachments as their titles. I am trying to set order of these attachments based on their titles, which is a numerical value then I was trying to use a simple argument like the one shown below.               $images =& get_children( array (                 'post_parent' => $post->ID,                 'post_type' => 'attachment',                 'post_mime_type' => 'image',                 'orderby' => 'title',                 'order' => 'ASC'                 ));      But this just gives something in this order 10, 1, 21, 29, 2 ..... which is more of an alphabetical sorting rather than a numerical sorting I seek eg 1, 2, 10, 21, 29 ... I am aware of the meta_value_num function but I am not dealing with custom fields here. Also FYI this is NOT the only loop on page, as I have two other loops on my single.php. Inspired from here and there I have put put together a code below but does not seem to work. Could you please help me correct this.               function orderby_post_title_int( $orderby ) {                 global $wpdb;                 if(!is_admin && is_single()){                 $orderby = '(wp_posts.post_title+0) ASC';                 return $orderby;                 }                 }                 add_filter('posts_orderby', 'orderby_post_title_int' );                            $images =& get_children( array (                   'post_parent' => $post->ID,                   'post_type' => 'attachment',                   'post_mime_type' => 'image',                   'orderby' => 'title',                   'order' => 'ASC'                       ));                 }                  remove_filter('posts_orderby', 'orderby_post_title_int' );


how to group custom post type posts by custom taxonomy terms

I would really appreciate if you could help me :) I'm very stuck and don't know how to proceed. I have a custom post type called `event` and 2 custom taxonomies registered for it:   1. `event_type` with tag-like functionality (ex. of event type: yoga, voice work)   2. `event_location` with category-like functionality (ex of event location: uk->brighton, london; europe->paris). There are pages on the website like `Yoga -> Upcoming events`; `Voice work -> Upcoming workshops`. Depending on which page we are on I'd like to display appropriate events. For example, if we're on page `Yoga -> Upcoming events` I'd like to display all `event` custom posts with `event_type` being yoga and then group the results by `event_location` taxonomy terms. For example, list all yoga events for UK, Brighton then UK, London and then Europe, Paris and so on. What I currently do in a template is the following:   1. I get the slug of the current page and its ancestors.   2. I get slugs of all terms in the `event_type` taxonomy, that have some events associated with them.   3. I determine which event types to display, by intersecting previously gathered values.   4. Then I construct a WP_Query to get `event` posts with determined `event_type` taxonomy terms. This seems to work. However, results came back unordered and I would like them to be ordered by `event_location` taxonomy terms. For example:   * UK     * Brighton        * Event 1       * Event 2      * London         * Event 3   * Europe      * Paris        * Event 4 I would also like to display only non-expired `event` posts and order them by `event_date`. The `event_date` value is stored as meta value along with the rest of `event` post details under a single meta_key. **Here is my code so far:**                   //pull in the appropriate events depending on the page type: yoga/voice work         /* get the ancestors and current page slugs */         // collect ancestor pages         $relations = get_post_ancestors($post->ID);         // add current post to pages         array_push($relations, $post->ID);         // get pages slugs         $relations_slugs = array();         foreach($relations as $page_ID){             $page = get_page($page_ID);             array_push($relations_slugs, $page->post_name);         }              /* get the term slugs (non-empty) for event_type taxonomy */         //get the event_type taxonomy values         $event_types = get_terms( 'event_type', 'hide_empty=true' );         $event_types_slugs = array();         foreach($event_types as $event_type){             array_push($event_types_slugs, $event_type->slug);         }              /* find what event_type to display on the current page */         $page_event_types = array_intersect($relations_slugs, $event_types_slugs);         $page_event_types_string = implode(",",$page_event_types);              /* find the events of the event_type to display on the current page */         $args = array(             'post_type' => 'event',             'tax_query' => array(                 array(                     'taxonomy' => 'event_type',                     'field' => 'slug',                     'terms' => $page_event_types_string                 )             )         );         $temp = $wp_query; //assign orginal query to temp variable for later use            $wp_query = null;         $wp_query = new WP_Query($args);              /* run the loop to output the event's details */         get_template_part( 'loop', 'event-details' );      I'm not great at constructing SQL statements. I would really appreciate if you could help me. Thank you very much!!! **EDIT** I have significantly simplified the functionality (as I got quite confused and lost in the original one). Please see my answer. Thanks to @Bainternet for taking the time and trying to help me out!


changing notification emails from WordPress <wordpress>@mydomain.net to something else

How do I change notification emails address from WordPress @mydomain.net to something else. I want to do this because WordPress @mydomain.net ends up getting flagged as junk mail. Thanks Daniel


Wordpress Image update filter

I can't seem to find the filter for an image update. Right now I have the code below, which works great until someone clicks on an image in the editor and updates it. Then it throws the height and width back in. Is there a filter I can use to stop this? I've tried several to no avail.               add_filter( 'post_thumbnail_html', 'remove_thumbnail_dimensions', 10 );     add_filter( 'image_send_to_editor', 'remove_thumbnail_dimensions', 10 );          function remove_thumbnail_dimensions( $html ) {         $html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html );         return $html;     }


How to Sort Custom columns in admin

I have set a custom column for date in admin, but the sorting is not working, when I click to sort the dates are jumbled up and not sorted correctly. This is the sorting function Im using               function sortable_columns() {         return array(             // meta column id => sortby value used in query             'publishdate' => 'date', // e.g. 1344964575                     );     } add_filter( "manage_edit-post_sortable_columns", "sortable_columns" );


How do I link to the posts page?

How can I link to the posts page that has been set in Settings > Reading? This is for a premium theme so it can't just be the page's permalink.


WordPress linking

On my homepage, I have several links that should link to different parts of my website. The first link should be redirected to a custom post type that has the slug portfolio. The other links should be redirected to different custom template pages like contact page , about us page, etc. Are there any functions in WordPress that allow me to link to this pages?


How to change order of posts in admin

Hi I have set a custom post type with some custom fields, one of the custom fields is a date field which is different from the publish date of the post itself, which is by default used by WordPress to sort the posts. I would like posts on this screen to be by default sorted using the custom field. How can I do that, is there some filter? Secondly, I would also like to have a dropdown at the top of the page, so a user can filter posts by custom field.


Error: Options page not found when saving my Plugin-Settings

after saving my options for my plugin I am getting the options page not found error. After some research, I found, that I may have forgotten to register my option or registered the wrong one. I checked my code, but I do not find the mistake: in **settings.php**               /**     * Register and add settings     */     public function page_init()     {                 register_setting(             'general', // Option group             'my_connect_options' // Option name             //array( $this, 'sanitize' ) // Sanitize         );              add_settings_section(             'general', // ID             'General Settings', // Title             array( $this, 'callback_general_section' ), // Callback             'my_connect_settings' // Page         );                add_settings_field(             'email', // ID             __('Email Adress'), // Title              array( $this, 'email_callback' ), // Callback             'my_connect_settings', // Page             'general' // Section                    );     }          public function callback_general_section()     {         _e('Set you general settings here.');     }          public function email_callback()     {         printf( '<input type="email" id="email" name="my_connect_options[email]" value="%s" />',         isset( $this->options['email'] ) ? esc_attr( $this->options['email']) : '');     }      and in **plugin.php**               public static function init()     {         add_option('my_connect_options');     ...      init() is called by the `plugins_loaded` hook. `page_init` is called by the `admin_init` hook


Setting up PubSubHubbub (PUSH) with Wordpress

I'm trying to set up PubSubHubbub (PUSH) with WordPress so I can allow updates to be seen in real time, without refresh. I have read many, many tutorials online on how to implement this plugin with WordPress but none have got it working for me yet. Here is what I have done so far: 1) I Downloaded the official PUSH plugin for WordPresss 2) I Created a Hub using Superfeedr with the following settings:   * Sub-domain: http://ianamador.superfeedr.com/   * Name of service: iantest   * URL / Service of service / application: http://caclord.com/buddy1/ (my test website) 3) I Added "http://ianamador.superfeedr.com/" under "Hubs" in my PubSubHubbub WordPress plugin settings. At this point, I am unsure of what to do next in order to get this integrated with an RSS feed and allow automatic real time updates. And I am also wondering if PUSH only works with RSS Feeds or if it could work with other content like blog posts within a loop aswell. Here is my test website: http://caclord.com/buddy1 Here is the URL for my feed: http://caclord.com/buddy1/feed _Any help would sincerly be appreciated guys! :)_


DWQA Plugin filters not working for logged in users

I am using the DWQA plugin in my wordpress site : http://getlegal.co.in But I am facing a problem. The filters in the plugin such as page navigation, category selection etc don't work for a logged in user whereas they function perfectly fine for a non logged in user. I think there is some problem with the ajax calling. Is there any code in wp-admin/admin-ajax.php and wp- admin/includes/ajax-functions.php which differentiates the way ajax calling is done for logged in and logged out users ? ![When user is not logged in](http://i.stack.imgur.com/WZadu.png) ![When user is logged in](http://i.stack.imgur.com/D6Uz8.png)


Shortcodes in Options Panel textareas

I am using an Options Panel to create my themes, and I would like to make the textareas from this OP to support my shortcodes too. The code for that creates the textarea fields:               case 'textarea':                 $cols = '8';                 $ta_value = '';                      if(isset($value['options'])) {                         $ta_options = $value['options'];                         if(isset($ta_options['cols'])) {                         $cols = $ta_options['cols'];                         }                      }                          $ta_value = stripslashes($data[$value['id']]);                          $output .= '<textarea class="of-input" name="'.$value['id'].'" id="'. $value['id'] .'" cols="'. $cols .'" rows="8">'.$ta_value.'</textarea>';             break;      Any idea how can I do that? Please let me know if I should provide more details. Thanks.


Error after updating to WooCommerce 2.0.15

Warning: in_array() expects parameter 2 to be array, null given in /home/semprebemcasados/www/wp-includes/taxonomy.php on line 2092 Warning: Invalid argument supplied for foreach() in /home/semprebemcasados/www/wp- includes/taxonomy.php on line 2856


Redirect to custom login page

I have created a custom page for login/registration. Is there any automated way to redirect all wp-login.php calls to that page, or will I need to replace all links manually. For example, on the comments form, I have this default message: > You must be **logged in** to post a comment. The _logged in_ links to the               http://localhost/wp-login.php?redirect_to=url      How can I change this to:               http://localhost/my-custom-login-page


Updating wp_attachment_metadata and woothemes catalog images

The problem: Need to change the size of all catalog images in my woocommerce themed website. For example: All catalogs images need to be resized from 112w x 112h to 160w x 160h (px) Here are the steps taken so far. The steps below work, but I am looking to see if there's a best solution.   1. Change woocommerce settings to display catalog images 112 x 112px to 160 x 160px   2. Resize all thumbnails using a plugin (a couple of plugins out there)   3. Go to the database, find wp_attachment_metadata and do a search and replace on all entries with width = 112, height = 112, and image name ending in 112x112 Step 1 ensures that all new images upload will be resized to the new size Step 2 resizes all physical images again Step 3 changes all current images attachment sizes in the database to the new size, so that woocommerce can show them properly. If this step is not done, the current images will be displayed with the same height and width and same path as before. First I had assumed that by changing woocommerce settings to 160px (in step 1) would also update the database wp_attachment_metadata, but it doesn't. I don't see anywhere in WP where I can update that information either. WP doesn't seem to keep track of image attachments on the back-end. So I guess my questions is... is this the best or only way to do it? I found a lot of plugins that re-size the actual image, but none of them seem to update wp_attachment_metadata. I searched a lot for just wp_attachment_metada but there doesn't seem to be much on it. I just would like some input from people who have been using woocommerce longer than me, and have more experience with it. Thanks.


posts page - different lengths of excerpt

is it possible to get wordpress on the posts page to do the following example. the first three posts need to have a large image spanning the width of the title box and a longer excerpt. the rest of the posts need to be thinner and a smaller featured image floated left. How would I go about changing this in the template or loop?


Change plugin author after someone leaves the company

My company owns several plugins on Wordpress.org. The original creator of these plugins created them using his own Wordpress account, and has now left the company. How can we assume ownership of these plugins (preferably without contacting the former employee)?


Get categories names as an array to use it in theme settings

I am building a theme and for the Theme Settings Page I followed this tutorial: http://wp.tutsplus.com/tutorials/using-the-settings-api- part-1-create-a-theme-options-page/ What I want now is to have a multi-checkbox with every category. This is what I should have:               $options[] = array(         "section" => "zzz",           "id"      => HS_SHORTNAME . "_multicheckbox_inputs",           "title"   => __( 'Multi-Checkbox', 'hs_textdomain' ),           "desc"    => __( 'Some Description', 'hs_textdomain' ),           "type"    => "multi-checkbox",           "std"     => '',           "choices" => array( __('Category 1','hs_textdomain') . "|category1", __('Category 2','hs_textdomain') . "|category2", __('Category 3','hs_textdomain') . "|category3")     );      However I've tried multiple options but none of them gives me exactly as shown above. I think the answer is close to get_categories() function with no luck. Also tried:               function my_list_cats() {         $cats = get_categories();         foreach($cats as $cat) {             $catsArray[] = __('' . $cat->cat_name . '','hs_textdomain') . "|" . $cat->category_nicename . "";         }         echo implode(', ', $catsArray);     }      And then:               "choices" => array(my_list_cats())      But no luck. Does anyone know a solution? Thank you very much


Page vs Custom Post Type - which to use

I am creating a few pages (Company, Offices, Contact) and would like to have custom meta boxes for each of those pages. I want the meta boxes to be different for each page, and I don't know if that is possible to have meta boxes be unique for separate pages. On the other hand, I don't know that custom post types are the right way to go either, because I don't want to have multiple Company, Office, and Contact posts. What would be the right way to go about this so that they are single static pages and can have their own unique meta boxes in the admin?


Permanently modifying the W3 Total Cache's nginx.conf file

I want to have an `add_header` directive inside a location block of the `nginx.conf` (inside the document root) generated by W3 Total Cache like this               # BEGIN W3TC Page Cache cache     location ~ /wp-content/cache/page_enhanced.*html$ {     expires modified 3600s;     add_header Vary "Accept-Encoding, Cookie";     add_header MyHeader "Value";     }     location ~ /wp-content/cache/page_enhanced.*gzip$ {     gzip off;     types {}     default_type text/html;     expires modified 3600s;     add_header Vary "Accept-Encoding, Cookie";     add_header Content-Encoding gzip;     add_header MyHeader "Value";     }     # END W3TC Page Cache cache      Since W3 Total Cache overwrites this file I'd to know a method to keep it permanent.


custom uploader in the admin area

I am building a wordpress plugin that needs to allow the admin to upload CSS documents, and attach thumbnails. I want to know if there are any methods within wordpress that would be useful in assisting me in building an admin page that allows upload and deletion of css documents and images.


Sort search results asc for a custom field

i am not a very good developer (better: i am not a developer :), however i want to sort the search results in order of the value of a custom field. the reason is we are using ratings and it would be great to sort search results in order of the rating. everything else should stay the same. i tried severak plugins, none is offering this function. thx so much for any advice! best regards f


Wordpress WP_Query() Not working properly

I would like to know why we get an error when we implement this code in our `sidebar.php`:               $categories = get_categories();      foreach($categories as $category)      {        printf('
%s

', $category->cat_name);       $posts = new WP_Query('cat='.$category->cat_ID);       while($posts->have_posts())       {              $posts->the_post();         echo '
', the_title(), '
';        }          print '
';       }      The error we are getting is: > Fatal error: Cannot use object of type WP_Query as array in > C:\xampp\htdocs\wordpress\wp-includes\query.php on line 2374


Database tables for sports betting integrated in Wordpress

I am currently building a sports betting website, and have problems creating database tables for tipsters who writes sports picks. All the picks should be stored in a database table, with information about the pick, result, statistic etc. Very similar to the tables seen at betshoot.com, betrush.com etc. Can this be done by using custom posts or a specific plugin?


Exclude specific taxonomy term when using wp_get_post_terms

i have a single-post_type.php file where i constructud a breadcrumb (or similer to) **i am currently using this to get the terms of this taxonomy:**               $terms = wp_get_post_terms( $post->ID, 'wedding_cat');      .   **Later on i am showing that term like this:**
<?php $term = array_pop($terms);   echo ''. __('Home', 'sagive') . ' » '.__('Wedding Rings', 'sagive').' » slug, 'wedding_cat').'">'.$term->name.','?>
      That way i am only getting one term which is gr8 but..   i need to exclude a specific term comepletly from apearing. How can i do that?


Display admin notice only on main dashboard page

I'm using following code to display a notification in the admin dashboard. I want to display only on the main dashboard page (index.php), however the following code would display on all pages in the dashboard. Is there anyway to restrict it only to the dashboard main page? Thanks.               function my_admin_notice() { ?>

<?php _e( 'some message', 'my-text-domain' ); ?>

         <?php     }     add_action( 'admin_notices', 'my_admin_notice' );


How to make wp dropdown category load with selected option on top?

I have the selected option saved correctly, but when load the page, wp_dropdown_categories still load the list by its order. I prefer to load the selected item on top. How to do this?


Functions.php in child theme that loads CSS file breaks website

I created a child theme and created a functions.php file in the child theme directory that also has the required style.css file and a seperate custom CSS file that I want to load. This is the code I use:               <? php           add_action('wp_head', 'add_landing_css');     function add_landing_css() {          wp_enqueue_style('landing_css', get_stylesheet_directory_uri().'/landing.css','screen');     }     ?>      When I add this code to functions.php every page on my website is blank. It doesn't load anything. When I delete functions.php file my website works as normal. I use a theme called Modest from elegant themes.


Why would post_type be ignored in this query?

In the following query, post_type seems to get ignored resulting in display of all posts from my installation. What have I done wrong?               <?php     function filter_where( $where = '' ) {         $where .= " AND post_date > '2009-03-01'";         return $where;     }     add_filter( 'posts_where', 'filter_where' );          $posts = query_posts( '&showposts=-1&post_type=listings' );          remove_filter( 'posts_where', 'filter_where' );          echo '
';     foreach ($posts as $post) {         echo '
' . get_the_title() . '
';     }     echo '
';     ?>


Wordpress adding in anchor elements when I save a page in html editor

This page I am editing in the html editor. I pasted in my list from my text editor. You'll notice that the second last list item is all a link, thats because wordpress has taken it upon itself to wrap the whole thing in an empty tag! Why is it doing this and more importantly, how do I stop it? FYI here is the relevant ul

Target Health & Fitness

7 Sheffield Road Holmfirth HD9 7BW

01484 681000

enquiry@target-leisure.com

      inside that wordpress has added an anchor, if you inspect it using inspector or firebug. I've added these filters thinking they'd work but they haven't               remove_filter( 'the_content', 'wpautop' );      remove_filter( 'the_excerpt', 'wpautop' );


wordpress multi user question

The blog I'm implementing will have more than one user (different analysts) but there will be only one user (call it the publisher user) who will be checking through the posts and uploading them for everyone. The client wants me add a feature that will allow the publisher user to select which author he is posting on behalf of and that will then display that author's name. How could a approach this issue? I was told to try something with custom fields?


Error in buddypress when using wp_editor

Since none of plugin works with new wordpress and buddypress for rich text editor I have started to implement it myself manually directly into the theme. After using wp_editor() I got the editor on my fourms and it is posting forums content well without issue. However when I am trying to edit forums post it is not loading any content into the text editor. I am using below code if anyone can help me.               $content = bp_the_topic_text();         $args = array(         'quicktags' => true,        'editor_class' => 'frontend',        'textarea_rows' => 5,        'tabindex' => 1         );     wp_editor( $content, 'topic_text', $args);      This doesnt load the forum post content just wonder. I have tested with the sting and just works fine it loads the string but not the actual content with the function. I dont know either this is the right function to get the content or not. Thanks a lot in advance.


Call a function on every wordpress pages only

I have written a security function.I want to call this function in all pages which are created by wordpress back end only (Does not want want to called by all php files).Is there any hook available?.Please Help


Buddypress: Add a tab in buddypress with wordpress recent posts, blog posts?

I trying to create a buddypress profile tab that takes in recents blog posts, either by using a blog page the is read within the tab och feeding recents post only? I found this code, but I don't know how to extend this further:               //Buddypress add profile tab Latest Post     add_action( 'bp_setup_nav', 'latest_post_nav' );          function latest_post_nav() {         global $bp;         $parent_slug = 'recent_post';         $child_slug = 'recent_post_sub';         //name, slug, screen, position, default subnav         bp_core_new_nav_item(                          array(                                 'name' => 'Posts',                                 'slug' => $parent_slug,                                 'screen_function' => 'my_profile_page_function_to_show_screen',                                 'position' => 50,                                 'default_subnav_slug' => $child_slug                          )          );     }     function my_profile_page_function_to_show_screen() {              //add title and content here – last is to call the members plugin.php template         add_action( 'bp_template_title', 'my_profile_page_function_to_show_screen_title' );         add_action( 'bp_template_content', 'my_profile_page_function_to_show_screen_content' );         bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );     }          function my_profile_page_function_to_show_screen_title() {         echo 'Recent Post';     }          function my_profile_page_function_to_show_screen_content() {         echo 'See the latest articles';     }


Buddypress: Adding several profile tabs in buddypress with differents links to pages?

I want to create several custom tabs in the profile that are linked to different pages? Example, I click that tab, it gets me to a page..But each tab goes to different pages..


Twitter share button displays 1 share in single post but 0 in the post index page?

I'm displaying the Twitter button this way in both single.php and index.php: **index.php:**               <?php if (have_posts()) : ?>              <?php while (have_posts()) : the_post(); ?>                        (etc...)                        <a href="https://twitter.com/share" class="twitter-share-button" data-url="<?php echo get_permalink(); ?>" data-via="ChineseLearnOL">Tweet           **EDIT:** button from single.php:               <iframe id="twitter-widget-0" scrolling="no" frameborder="0" allowtransparency="true" src="http://platform.twitter.com/widgets/tweet_button.1397165098.html#_=1398689426849&count=horizontal&id=twitter-widget-0&lang=en&original_referer=http%3A%2F%2Fwww.chineselearnonline.com%2Flearning-insights%2F&size=m&text=Learning%20Mandarin%20Chinese%20Insights&url=http%3A%2F%2Fwww.chineselearnonline.com%2Flearning-insights%2F&via=ChineseLearnOL" class="twitter-share-button twitter-tweet-button twitter-count-horizontal" title="Twitter Tweet Button" data-twttr-rendered="true" style="width: 104px; height: 20px;">      button from index.php:               <iframe id="twitter-widget-0" scrolling="no" frameborder="0" allowtransparency="true" src="http://platform.twitter.com/widgets/tweet_button.1397165098.html#_=1398689298272&count=horizontal&id=twitter-widget-0&lang=en&original_referer=http%3A%2F%2Fwww.chineselearnonline.com%2Flearning-insights%2F&size=m&text=Learning%20Mandarin%20Chinese%20Insights&url=http%3A%2F%2Fwww.chineselearnonline.com%2Flearning-insights%2F&via=ChineseLearnOL" class="twitter-share-button twitter-tweet-button twitter-count-horizontal" title="Twitter Tweet Button" data-twttr-rendered="true" style="width: 104px; height: 20px;">      Seems like a different button with the same URL. How to fix that?


How can I determine what mode the editor is in and when it changes?

I need to determine if the page/post editor is in Visual or Text mode. I also need to determine when this changes. Does WordPress provide some kind of functionality for doing this? I am writing some JS that requires this information.


Custom editor preview of shortcode?

With the new WordPress 3.9 release, the official WP gallery shortcode has a beautiful preview functionality. I have an old slideshow plugin written and now I'm wondering where I should start looking if I want to make a similar preview functionality for my plugin.


Different styles on multiple pages

I'm using _s to build a theme. I want to have different styles for different pages. I can figure out how to get two pages working but I want different styles for 5 pages? Maybe an else if statement? I would really appreciate some help. here is my code.                if (is_page_template('page-templates/page-about.php')) {             wp_enqueue_style( 'sentiencesentient-layout-style' ,    get_template_directory_uri() . '/layouts/about.css');         } else{             wp_enqueue_style('sentiencesentient-layout-style' , get_template_directory_uri() . '/layouts/content-full.css');                  }      many thanks


Why are plugin settings not all nested in one place?

Through my modest usages of WordPress, i have encountered many plugins. Some of them have menus displaying at the bottom of the menu panel, some are inserted within the menu panel as if they were WP native, and some are hidden away in the settings tab. My question is in two parts : 1 - What are the historical reasons for this variety ? 2 - Is it seen by the WP team as something that should / will be fixed ? It feels confusing to new users !


How to automatically trigger a link if user has already been in the page?

I need a solution in php or javascript to make trigger a link to a internal #anchor when the user has visited the page for second time. can you help? the theme is a SINGLE PAGE one that shows all the pages in 1 and user when a link is clicked slides to the next page. I would like the script to detect if it is more than the 1st visit and automatically slide to a page... I tried different approachs, I don't know how to do it more efficient. Would like to do it with PHP.. This code I added to functions.php but doesnt work!               function redirect_user() {                 $expire = time() + 60 * 60 * 24 * 30; // expires in one month                $visits = 1;                 if(empty($_COOKIE['visits'])){                      setcookie('visits', $visits, $expire);                 } else {                       $visits = $_COOKIE['visits'];                       $visits++;                        setcookie('visits', $visits, $expire);                   }                  if($visits <= 1){                    wp_redirect('http://www.page.com');                   } else {                   wp_redirect('http://www.page.com/');                  }         }          add_action( 'init', 'redirect_user');      Maybe there is a better approach... i feel lost :( I want to really add this php not to the functions.php but to the page template so it slides...


Conditional Tags If Custom Post Parent & Child?

Check on the single-artists.php whether we are viewing the parent or child of the said custom post? Tried this but always shows the top child content, rather then showing the two different area               <?php if ('artists' == get_post_type()  || $post->post_parent=='artists') { ?>                     the child single-artists.php          <?php } else { ?>                     the parent single-artists.php               <?php } ?>


Ajax (jquery) wp_query pagination returns -1

I am currently developing an ajaxified theme for wordpress. I am listing the posts in a particular category, but the pagination returns -1 when clicked. Lets say I set showposts to 3 and a particular category has 2 posts, the link to previous posts does not show up as expected. Now if the category has 5 posts, the link to previous posts shows up, again as expected, but when I click on it, -1 is returned. Here is my code:               <?php     $category = get_category_by_slug($_POST['catname']);     $wp_query = new WP_Query();     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $wp_query->query('cat='.$category->term_id.'&showposts=1&paged='.$paged);     ?>          <?php     while ($wp_query->have_posts()) : $wp_query->the_post();         get_the_title();     endwhile;     ?>
<?php next_posts_link('« Older Entries') ?>

<?php previous_posts_link('Newer Entries »') ?>
     <?php     ?>      Also, the link of the previous post is `http://domain.com/wp-admin/admin- ajax.php?paged=2` which I suspect might be the root of the problem. Can anyone help please? Thanks


Creating my own portfolio custom-type

I'm using WordPress to build my photography portfolio. So far I've created a _Custom Post Type_ called `session` for each photo session, and I've managed to list all the sessions with each thumbnail in the home page. Now, however, I have to create the content of each `session`. I'd like to keep it simple:   * The title   * A small description (if any).   * A set of pictures, that should appear straightaway in the post.  The problem is that I don't know how to face the inclusion of the images. Looks like using a _gallery_ is not what I'm looking for, because it generates a set of thumbnails, and I just want the images in full size in the post. What's the best way of doing this? The ideal case would be to have something like `the_images_of_this_post()` so I could place them at will from the template file. Thanks!


how to programmatically change post tags

Is there a php function which can add/remove tags of posts? If not how would I do this? I am looking for something like this:               add_tag($post_id, 'tag-name');     remove_tag($post_id, 'tag-name');


How to change the default orderby from "Date" to e.g. "Title" or my custom column in content type records list in admin? Right now the created or cahnged is always the first. But I want to order the records by my custom field (I already have created it with a sort functionality following the advice here: http://justintadlock.com/archives/2011/06/27/custom-columns-for-custom-post- types) My question is how to set the orderby as default to e.g. title or my custom column called "expiration". Is there any hook for that?


The Loop for my theme with static front page is not working

I'm developing a wordpress theme that uses a static page as front page. My wordpress is configured to use "Home" page as its front_page and "Blog" page to show the blog posts. When i try to use the loop on my "Blog" page to list the posts i get a odd behavior, the loop runs fine but any method to get the post information returns an empty string. Sample code:               if (have_posts()) {       while(have_posts()) {         the_post();         $posts[$index] = array(                     'title' => get_the_title(),                     'permalink' => get_permalink(get_the_ID()),                     'content' => get_the_content(),                     'day' => get_the_date('j'),                     'month' => get_the_date('M')                     );         $index++;            }     }      If i have 5 posts that yould return me an array with 5 elements, all of them with empty strings as the values. If i add `query_posts('posts_per_page=5');`. it works, but that shouldn't be needed. What am i missing? You can check the complete source code on github: https://github.com/albertein/coltsintheme Thank you _UPDATE_ : Even if i avoid using a static page as front page (delete front- page.php and configure wp con Settings>Reaging) I'm getting the same results which seems weird to me, it seems I'm missing something.


JavaScript enque stopped working

Somewhere along the line I have messed up my js enqueue I am not sure how. I have the following in my functions.php file and I am including `<?php wp_footer(); ?>` in my footer.php before the js files were outputting in the footer no problem, but now it isn't working and I don't know why?               function foundationScripts() {         if (!is_admin()) {              wp_deregister_script('jquery');         wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js', false, '1.7.1',true);         wp_enqueue_script('jquery');            wp_enqueue_script('modernizr.js',get_template_directory_uri() . '/javascripts/modernizr.foundation.js',false,false,true); // for some reason this adds extra quotation marks in the body       wp_enqueue_script('foundation.js',get_template_directory_uri() . '/javascripts/foundation.js',false,false,true);       wp_enqueue_script('app.js',get_template_directory_uri() . '/javascripts/appF.js',false,false,true);       }              add_action('init', 'foundationScripts');     }


wp_nav_menu doesn't generate parent/ancestor classes

I don't know why the proper classes for menu item are not generated - all the elements in the tree which has subtree get only `menu-item menu-item-type- post_type`. The elements, which don't have children, get proper classes after being clicked (active). Link: http://lichens.ie/ Part of the menu structure: http://imgur.com/5Lj00.png Code               $args = array(         'menu'      => 'Main menu',         'container' => '',         'menu_id'   => 'nav',     );     wp_nav_menu($args);      When you visit e.g. http://lichens.ie/view-lichens-by/lichens-by-habitat/ you can see that it has no 'current' class. As well as it's parent. PS Sorry for posting 'not working links' - it's because of reputation limitation Any ideas - help much appreciated.


List Category Plugin - Changing the links

Using the list category posts plugin I'm trying to work out how to include a title for the link In my main theme the links are styles as follows:               Post title      I want to do that using the category list plugin too, can that be done using the shortcode tags or would I need to put together a template?


Customizing page content layout

For a while now I have been building WordPress based sites for clients. These sites tend to be brochure sites so feature a collection of pages all with slightly different layouts within an overarching main layout and style. Upto this point I have either created Pages in the WordPress admin panel and then created a page template with the content embedded into it (not great when the client want to be able to update the page) or created a new page and a generic "page" template and then placed content into this using HTML in the editor (not great for the user trying to edit the content in the editor, or when the editor decides to add more HTML tags) Is there another way to easily create pages where the user can easily update the content using the editor but wont risk screwing up the layout? something like multiple editors or content areas in the admin panel?


Adding a pagenavi to function for displaying bookmarks

I have a plugin user bookmarks - see here -  and I'm trying to add a to it so the bookmark posts don't pile up like crazy. How can I do it? This is the function that displays the bookmarked posts.               function upb_list_bookmarks( $delete_link = true, $delete_text = 'Delete' ) {     if(is_user_logged_in()) {         $display = '
';             $bookmarks = upb_get_user_meta(upb_get_user_id());             if($bookmarks) {                 foreach( $bookmarks as $bookmark) {                     $display .= '
';                     $display .= '
';                     $display .= '
';                     $display .= '';                     $display .= '';                         $display .= '';                         $display .= '';                         $display .= '
';                                               $display .=  limit_text(get_the_title($bookmark), 25);                                              $display .= '
';                         $display .= '';                         $display .= '';                          $display .= '';                         $display .= '

';                         $display .= '

';                             if($delete_link) {                             $display .= '' . 'remove' . '' ;                         }                         $display .= '
';                                            $display .= '
';                 $display .= '
';                 }             } else {                 $display .= '
You do not have any favorited looks :(
';             }         $display .= '
';     }     else {         $display .= 'You must be logged in to view your bookmarks.';     }          return $display;     }


Category slug field missing with registered custom taxonomy

I have registered a new taxonomy term using the same code on two different sites. On one site (a vanilla install), If I go to my taxonomy term in the admin menu, I see a 'slug' option for the add category screen. On my other site, with all plugins disabled, this slug option does not appear. Anyone know what might cause this? Register taxonomy code:               register_taxonomy( 'my_topics',      array( 'post', 'page' ),      array( 'hierarchical' => true,      'label' => 'my Categories',      'query_var' => 'topics',      'rewrite' => array('slug' => 'topics')     ) );


Single random post in homepage

I want to display single random post in it's entirety in the homepage.I've tried many methods, but the main issue was that it won't display the content, only heading, or display content, but only an excerpt. Now I have this code:               <?php     query_posts(array('orderby' => 'rand', 'showposts' => 1));     if (have_posts()) :     while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>"><?php the_title(); ?>
          <?php the_content(); ?>          <?php endwhile;     endif; ?>      One problem is that it doesn't display full post, only excerpt.Another problem is that it displays only heading and content and I want all the things I get in single.php.The biggest problem is that my custom code:               <?php          if(in_category('afghanistan')) {     $recent = new WP_Query("pagename=asia/afganistanas"); while($recent->have_posts()) : $recent->the_post();?>
<?php the_title(); ?>
            <?php the_content(); ?>     <?php endwhile;     }     else {     echo "Klaida!";     }     ?>      which displays a page inside of post depending on the category of post doesn't word in index, but does work in single.php **Is there any method to use a copy of single.php in index and give it a random post to load every time the page is refreshed ?**


Using custom taxonomies to display hierarchical URLs?

I can't seem to get my custom taxonomy hierarchy working properly. It seems like many other have had this problem but none of their fixes work for me. I would like to have a URL structure similar to the default category functionality. **Example**               http://domain.com/category/sub-category/subsub-category/postname      But it currently works like this               http://domain.com/custom-post-slug/post-name      I would like to be able to have an archive page for each category and sub category with the specified taxonomy. Is this possible? I've tried everyones proposed solutions, but nothing seems to work. Any advice?               function social_create_venue_post_type() {              register_taxonomy("venues",             array("venues"),             array(                 "hierarchical" => true,                 "label" => "Venue Type",                 "singular_label" => "Type",                 'rewrite' => array('hierarchical' => true, 'slug' => 'type' )             )         );              register_post_type('venues',             array(                 'labels' => array(                     'name' => 'Venues',                     'singular_name' => 'Venue',                     'add_new' => 'Add Venue',                     'edit_item' => 'Edit Venue',                     'new_item' => 'New Venue',                     'add_new_item' => 'Add New Venue',                     'view_item' => 'View Venue',                     'search_items' => 'Search Venue',                     'not_found' => 'No Venues Found'                 ),                 'public' => true,                 'has_archive' => true,                 'hierarchical' => true,                 'menu_position' => 5,                 'capability_type' => 'post',                 'supports' => array('title','editor','page-attributes','excerpt','thumbnail'),             )         );     }


Add url from Custom Field as 'Featured Image'. Code not working

I'm trying to migrate a site to WP. We have a whole bunch of pictures, and I have done some research and figured -- I think -- my best bet is a CSV import of the data, storing the relative URL of the image as a custom field. So, I found this --which looks ideal -- and I implemented it thus (in functions.php with a global call added as I was getting a 'no object' error):               function store_cf_featured_image() {     global $post,$wpdb;          $uploads = wp_upload_dir();          // Get all attachment IDs and filenames     $results = $wpdb->get_results("SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = '_wp_attached_file'");          // Create an 'index' of attachment IDs and their filenames     $attachments = array();     foreach ($results as $row)         $attachments[ intval($row->post_id) ] = $row->meta_value;          // Get all featured images     $images = $wpdb->get_results("SELECT post_id, meta_value AS 'url' FROM $wpdb->postmeta WHERE meta_key = 'featured_image'");          // Loop over each image and try and find attachment post     foreach ($images as $image) {         if (preg_match('#^https?://#', $image->url))             $image->url = str_replace($uploads['baseurl'], '', $image->url); // get relative URL if absolute              $filename = ltrim($image->url, '/');              if ($attachment_ID = array_search($filename, $attachments)) {             // found attachment, set post thumbnail and delete featured image             update_post_meta($image->post_id, '_thumbnail_id', $attachment_ID);             delete_post_meta($image->post_ID, 'featured_image');         }               }               }          add_action( 'init', 'store_cf_featured_image' );      However, when I put a link in my custom field 'featured_image', and save it... nothing. No errors, but no nothing. I update the post and come back to it, but the link is still just a link the the custom field and no 'featured image' has been set. Does anyone have any ideas what the issue might be? an am I right in thinking this will store the image as part of built in 'Media Library', now? AlsoAlso: Will I be able to adapt this code to pull in Alt text etc for each image from custom fields. Any input greatly appreciated! Thanks.


Plugin that generates a page of post content

My script is generating a duplicate **post** even after I explicitly state that the post_type should be a **page**. It also ignores the `$post_title`, which I do not want to create a duplicate post if the title already exists. Can anyone figure out why it's creating a post instead of a page?               function av_generate_page($post_id) {          $post_info = get_post($post_id);     $post_slug = $post_info->post_name;     $post_title = $post_info->post_title;     $page_exists = get_page_by_title($post_title);     if($page_exists){ exit(); }     $detail_level = get_post_meta($post_id, 'detail_level', true);     $formats = wp_get_post_terms($post_id, 'formats', array('fields'=>'slugs'));          $page = array(         'post_type' => 'page',         'post_title' => $post_title,         'post_content' => '[['.$post_slug.']]',         'post_status' => 'publish',         'post_parent' => 8800     );     if( !$page_exists ) {         if (in_array('brief-segment',$formats)){             // Do not create a page for brief segments         }else{             $new_page_id = wp_insert_post($page, false);             update_post_meta($new_page_id,'suf_hide_page_title','on');             update_post_meta($new_page_id,'_wp_page_template','no-sidebars-no-comments.php');                 if(in_array('internal-only',$formats)){                   add_post_meta($new_page_id,'InternalOnly','yes',true);                 }         }     }else{         // Do not create a page     }        } add_action('publish_post', av_generate_page, 12);      **EDIT** How _would_ I pass the current post id to be used as my ID for generating a page? As a premise for why I'm embedding a post into a page (provided that that page has not already been created), I'm creating a **hierarchical treeview of pages**. Because posts are flat, I need to create a page each time I create a post and move it to the appropriate place in the hierarchy. Why am I not simply creating a page instead? Because I need to create multiple pages for each post based on the multiple categories that they apply to. Yes, they are tagged with the categories in the post, but I still need to provide the list of pages that I cannot do with a post. Therefore, I'm creating a page that can live in a hierarchy and references a post that I can thus reference in other pages as well.


Custom Post Type Single Loop Outputting Wrong Post

I have been unable to get my single-portfolio.php template to behave properly. So I have a custom post type called portfolio. I am displaying all of those posts in the front-page.php and it works perfectly fine. Here is the loop for the front-page.php: http://pastie.org/4268087 For the life of my however, I cannot get the right post to show up in my single-portfolio.php template. Basically, if I go to one of my posts (so for example, lets say http://example.com/portfolio/test-post/) I end up with a single post page that displays the wrong post (so instead of "test-post" I get "wrong-post"). No matter what post I open up, it will be the exact same post that is displayed ("wrong-post"). If I set the posts_per_page to infinite, it will show me all of the posts. I have tried many different Loops. I have tried the exact same loop as shown above, as well as the default custom post type loop found in the Wordpress Codex:               $args = array( 'post_type' => 'product', 'posts_per_page' => 10 );     $loop = new WP_Query( $args );     while ( $loop->have_posts() ) : $loop->the_post();         the_title();         echo '
';         the_content();         echo '
';     endwhile;      Any suggestions on how to solve this? Thanks,


Failed to load resource:404 image

website is http://pleevi.com. when i look on the problems with the website, i get this. http://i.imgur.com/aHQky.png here is the entire list of what i get as i cannot post more than 2 hyper links :( none of the images on my website will load. strange thing is that on my computer the images show up and everything is normal, but when i go to another computer, none of the images show up. any help would be appreciated


Unable to access new installed theme

Bear with me as I am new to this.I am running 13.10 desktop. I installed Wordpress LOCALLY on my computer. I already have a website that will eventually be replaced and want to create the site myself then load to our hosting servers. I am unable to access the theme that I purchased and installed through my Dashboard. The theme file is located with the other theme files that already come with WP. The new Theme file has the same read/permissions as the rest of the themes. I can access the new file and see all its contents but unable to access through Dashboard and customize. Mysql and PHPMYADMIN are all current. Any idea?


Things to take care before installing wordpress Manual v/s Softaculous

I have cleared up the first step  on moving to Self-hosted wordpress. Now I have a confusion if someone can answer: 1: My hosting provider's tutorial shows installing WP from cPanel using tool called Softaculous. Is it a good way to use that utility or do by grabbing the wp package from wordpress.org and do everything manually? I tried and it was easy but want to know pros/cons. Using Softaculos I am confused with the two things: a: Choose protocol: It has options: `http://, http://www, https:// and https://www` I know my site isn't using ssl so now what should I choose `http:// or http://www` And why should I chose one over other? b: In Directory: Asking me where should I install it? in the root or sub- directory e.g. `http://mydomain/wp` What should I choose there? And why? Primary purpose of my site is I will be blogging. In future I don't know what it could turn out? If I install it in say a sub-directory say root/wp, I found that I can set the Site Address(Url) from WP Admin panel. I want to do it right in terms of SEO rankings, maintenance and future changes. Any explanation / suggestions appreciated. Thanks.


How do I remove the entire Media section from the main WordPress navigation without just hiding it?

I would like to remove the entire "Media" section from the main WordPress admin navigation ont he left hand side. What I don't want to do is just "hide" it with CSS or a plugin/function like I have done so below, because it's still accessible via the URL. This is crucial users shouldn't see each others uploads by any means. Here's what I currently have, which just hides it. If you went to upload.php in the url, you could still access it.               add_action( 'admin_menu', 'remove_menu_links' );     function remove_menu_links() {         remove_menu_page('upload.php'); //remove media     }      Any ideas? A suitable method I believe would be to just direct the user to the dashboard with an error message if they tried to access the upload.php url? Not sure how to do this though.


Trying to avoid including wp-load.php

I am working a plugin where I am trying to connect an HR system with WordPress. There is an XML API on the HR system so I have written the plugin to take the data and put it into a WordPress database table specific to my plugin. This is all done via the built in AJAX etc but there was a request for the person to be able to schedule a task so that it wasn't querying the HR system on every site visit (the list of positions need to be displayed on the site front page). Then the problem becomes syncing. This is an IIS environment so they want to use Scheduled Tasks to sync the site. I explained the WordPress scheduled task API but they prefer to have it sync manually through their own infrastructure. How do I create code (essentially a php file) that can be run by a scheduler without username/password without calling wp-load.php? Their scheduler needs to be able to run a URL alone so this makes it somewhat difficult. I'm trying to explain this without code since its a generic problem but in this case, the bulk script I have created and works looks like this:               if ( !defined('WP_LOAD_PATH') ) {              /** classic root path if wp-content and plugins is below wp-config.php */         $classic_root = dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/' ;         //echo $classic_root;         if (file_exists( $classic_root . 'wp-load.php') )             define( 'WP_LOAD_PATH', $classic_root);         else             if (file_exists( $path . 'wp-load.php') )                 define( 'WP_LOAD_PATH', $path);             else                 exit("Could not find wp-load.php");     }          // let's load WordPress     require_once( WP_LOAD_PATH . 'wp-load.php');          // If the plugin class is not found, die.     if (!class_exists('Aragon_eRH_RSS')) {         die('Aragon-eRH RSS not installed.');     }          $core = new Aragon_eRH();     $core->aerh_xml_parser_bulk();      Now they can run http://site.com/wp-content/plugins/aragon-erh-rss/lib/bulk- sync.php?nonce=thenonce This performs the syncing function. Note that there is a nonce required and can be changed from the plugin's admin menu. See screenshot below: ![Admin Screnshot](http://i.stack.imgur.com/tO305.png) Note: I want to avoid it because:   1. Considered bad practice   2. Plugin was rejected due to including WP-Load


Custom Post Types cause 404 for pages?

I have looked at the previous post here regarding a similar issue but what resolved them issues doesn't want to work for me. Basically, I have a custom post type for football players for my home team, the slug for this post type is players and my permalink structure is /%category%/%postname%/ Now when I create a new player, and go to view the post, I get a 404, so I go to permalinks and click save. The custom post type of the player now works but with a strange issue, my pages now come back with a 404, post seem to work fine and aren't effected? Now I am using a plugin called Easy Custom Content Types by Pippin, but this error also happend for me when using the Custom Post Type UI. I have tried different themes, deleting the .htaccess and nothing seems to work. The strange thing is that if I change the permalink structure back to default there is no issue, but I don't want that, I want to be able to use the permalink structure I'm currently using minus the errors. So can anyone help to resolve this annoying error. Thanks


High traffic management in WP

I have to develop a site in Wordpress similar to an already existing site in JSP which handles approx.`50K users a day and 200 users` at a time. And in load testing i get that wordpress can handle only `40 users` at a time (with `Super Cache` plugin `ON`). Also I have hosted my site on a `Shared hosted server`. So please suggest me some way or guide me to `optimize` my wordpress site so that it can also handle the same traffic. Thanks in advance.


hybridauth (google OAuth integration) and WP problems

I'm trying to implement the script shown here: http://hybridauth.sourceforge.net/userguide/Integrating_HybridAuth_SignIn.html To allow people to sign in with Google to my site. However I am getting 302 moved, or "`headers already started`" errors. I suspect it has something to do with paths; whereas the hybridauth code is in my theme folder (thats the only way I can include it, or am I wrong?) the callback API can't access /wp- content/themes and so on. Does anyone have any advice on these and what to do?


Change the functionality of wordpress users module in admin

I want to restrict wordpress admin to view all users in user list. For say, I have created custom roles (company users, employee). A company user type role can have multiple employees. I want wordpress admin to only view company users. I got, `args` in `function prepare_items()` inside `WP_Users_List_Table` class can filter this. So have tried to override this in my theme's functions.php.               function my_prepare_items(){              //my custom code goes here          }     add_action( 'prepare_items', 'my_prepare_items' );      But it's not working. How and where I can override this functionality without touching core wordpress methods? EDIT : This I want in admin UI. Thanks in advance.


Blog only showing code

I would like to have some help. I host a wordpress blog in my raspberry pi running apache2, but when I browse the blog it only shows the code as you can see here http://lifeonpi.sytes.net/raspgrammer/ what can i do? what is the problem with it? any help?


Get new (not old) post inside transition_post_status hook

Following up the ticket 'transition_post_status' is executed before 'save_post', I'm still struggling how to access the **new** `$post` (after it has been saved) inside a `transition_post_status` hook. Right now, I'm getting the old $post data (before it has been saved). Example:               add_action('transition_post_status','myfunc',10,3);     function myfunc($new_status,$old_status,$post){           if ( $new_status == 'publish' && $old_status != 'publish') {      // a post is getting published              if(!check_my_post($post->ID)){ //how can I get the saved/new post here?                ...             // do something              }            }          }      Changing priorities does not make any difference. Any ideas how to achieve this?


Comments and Bootstrap 3's media-list

I'm developing my first custom theme for WordPress based on Bootstrap 3 framework. I'm newbie and I can't understand few things, so I'd like to ask you for some help, especially with comments.php, comments display etc. First of all, I developed HTML website and now I'm going to change it to WordPress theme. I done some work but I can't handle with comments and form for sending a comment message. I don't know how to make wp_list_comments works with media-list from Bootstrap. Here you can see how I want to have comments looks (HTML demo): http://fonlinepl.96.lt/single.html And here is a WordPress website, how it looks like: http://testerio.96.lt/?p=1 I can also say that I didn't add comments form because I don't know how I could do it and make it works with Bootstrap's styles. I can also send you my theme if it is necessary, so you could check how it is made. Hope you help me solve this problem. :) Edit: comments.php               <?php wp_list_comments(              $args = array(             'style'             => 'ul',             'avatar_size'       => 64,         )          ); ?>       I'd like to make WordPress comment's look like media-list from Bootstrap - getbootstrap.com/components/#media-list


Temp URL Redirect Loop

I am attempting to set up my site using a temp URL (IP/~username/domain) through hostgator, but I am running into some issues. I have gone into the database and replaced all instances of my old domain with the new temp URL. Problem is I am running into a redirect loop. I read somewhere to try resetting permalinks, but I don't have access to the admin panel. I'm not sure what else to try to fix the redirect loop. I even replaced my .htaccess with a fresh one, and still get the redirect loop. Here is my current wp-config file:               define("WP_SITEURL","http://IP/~username/example.com");     define("WP_HOME","http://IP/~username/example.com);          define('DOMAIN_CURRENT_SITE', 'IP/~username/example.com');     define('PATH_CURRENT_SITE', '/');      And my current .htaccess:               ###############################################################          # BEGIN WordPress     <IfModule mod_rewrite.c>          RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]     RewriteRule . index.php [L]     </IfModule>     # END WordPress          ##############################################################          <IfModule mod_rewrite.c>     Options -MultiViews     RewriteEngine On     RewriteBase /     RewriteCond %{REQUEST_FILENAME} !.*\.(jpeg|jpg|gif|png|ico)$     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /home.php [L]     </IfModule>


How to access media library?

I'm working on a plugin which uses custom post types. When creating or editing one of these custom post types in the WP admin backend, one must be able to select or upload a custom background image from the WordPress media gallery/library (for that post particular). So I want to be able to bring up the default WordPress media library in the backend. Is there a function / hook / api available to call the WordPress media gallery admin window? I Googled the entire afternoon, but I don't seem to get the results I need. P.s. I know that I can use the featured image for that purpose, but I want to preserve the featured image for the user.


Category page with gallery for each post

I'm looking for a bit of direction on how to set up a category page (for a real estate company). What would be the best way to have a gallery of images (1 large photo and several thumbnails) listed for each post on a category page.


W3Total Cache problem with Nginx

Hi I installed w3 total cache on my nginx powered site, I'm having errors however. For example when I enable page caching disk:enhanced I get: It appears Page Cache URL rewriting is not working. If using apache, verify that the server configuration allows .htaccess or if using nginx verify all configuration files are included in the configuration. When I choose page caching disk:basic no error is displayed. Here is the config for the server in /etc/nginx/nginx.conf: http://pastebin.com/SEdnyHbf If it makes any difference, I have multiple sites installed, all in /srv/www I can see that W3 Total Cache is creating a separate nginx.conf for each website, e.g. /srv/www/mysite.com/public_html/nginx.conf and within it there are the rules of W3 Total Cache, pasted here: http://pastebin.com/dANPVMJk I would like to have a setup that works for any number of websites I will add. Clients on my server need to be free to update their W3 Total Cache configuration as they wish without the server needing to be restarted. Also they might opt not to use the plugin at all.


Codex Function Problems When There is an Apostrophe in the Category Name

I'm working on a site, largely managed by categories. Two of the categories have apostrophes in them... ex. "Joe's Place" and "Tina's Lounge". (Actual titles changed, these are examples...) The category slugs are "joes-place" and "tinas-lounge". The customer asked for a breadcrumb on the site... Unfortunately the breadcrumb call fails whenever the category has an apostrophe in its name. The failure occurs at the call to get_cat_ID. Oh, and when the breadcrumb fails, the whole page fails. Here is a fragment of my breadcrumb code...               if ( is_category() )             {                 // single_cat_title() Displays or returns the page title if a category                 // or tag archive is queried.                  $catTitle = single_cat_title( "", false );                    echo '<!-- $catTitle:'.$catTitle." -->";  // troubleshooting line...                  $cat = get_cat_ID( $catTitle );                 echo '<!-- $cat: '.$cat."-->";   // troubleshooting line                 echo "<li>  ". get_category_parents_custom( $cat, TRUE, ' » ' ) ."</li>";             }      get_cat_ID simply returns a `0`. Uh-oh... when I look close at my troubleshooting code, I can see that $catTitle returns `Joe’s Place` Ouch.. Its really not clear on exactly what format is required where the apostrophe is concerned. When I dig further and further in codex core, I can see get_cat_ID calls a function `get_term_by()` that warns "$value is not HTML-escaped for the 'name' $field. You must do it yourself, if required." I'm assuming that's my issue. but, what does it mean to "HTML-Escape" a string? I tried `$catTitle2 = htmlspecialchars_decode($catTitle);` no go there.   I tried `$catTitle2 = esc_html($catTitle);` no go there. In both of those previous functions, the string never changes a bit. I tried manually introducing the string "Joe's Place" to the call, and WOW, that totally worked. In the meantime I will do a simple string replace function, but that seems like such a hack. Is there a php or wordpress function that will convert the string `’` back to a simple apostrophe? What is the right way to fix this problem? Update: I stumbled upon this posting: My quick fix consists of a bit of code suggested there with a small modification:                    $catTitleCorrected = html_entity_decode(str_replace("’","'",$catTitle));


Trying to display terms from custom taxonomy within function

I have a function that is giving me this error - `Catchable fatal error: Object of class stdClass could not be converted to string in.... blah blah` Below is some of the code from the function. It is the last line that is giving the error but I can't work out why. I'm trying to display the term with ID 7 in the project_cats taxonomy.               $html_content .= "
" . rgpost('input_1') . "
"; //Title     $html_content .= "
Category: " . rgpost('input_5') . " | Budget: " . rgpost('input_3') . "
"; //Category & Budget     $html_content .= "
" . rgpost('input_4') . "
"; //Description     $html_content .= "" . get_term_by('id', 17, 'project_cats') . "";


Disable default Wordpress widgets in sidebar

Im creating my own theme. When I have a clean wordpress installation, there are some default widgets in the sidebar (search, category, recent posts etc). I know that I can remove them from the sidebar by adding a widget to that sidebar, but I want them removed in the sidebar by default. Is there a way to do that without disabling the widget (unregister_widget())?


Custom folder for wordpress page templates

How I can change a folder for wordpress page templates? By default all page templates located in theme's root folder. I want to make a folder with name "templates" in theme's root directory and keep all page templates there. How can I achieve that?


How to define a remote uploads directory?

Using the constant overrides in wp-config I'm able to define a remote FTP server that plugins will be added to when installed using the WP interface.               define('FS_METHOD', 'ftpext');     define('FTP_BASE', '/');     define('FTP_CONTENT_DIR', '/public_html/example.com/wp-content/');     define('FTP_PLUGIN_DIR', '/public_html/example.com/wp-content/plugins/');     define('FTP_USER', 'username');     define('FTP_PASS', 'password');     define('FTP_HOST', '123.123.123.123');      What's weird to me is that there isn't a constant setup for themes or uploads. Themes I don't care about (but its still weird) ... I want uploads to be put on the remote server though. Ideally there would be an `FTP_UPLOADS_DIR` that could be overwritten the same way. Any ideas on how to get around this?


List custom taxonomy specific to one custom post type

I am slowly going mad trying to figure this out.. I want to list custom post type 'mobile_review' by custom taxonomy 'mobile_phone', as multipe custom post types share this taxonomy I need some way to segment. So far I have this:               function get_terms_by_post_type($taxonomies,$args){           $args = array(         'post_type' => 'mobile_review'     );          // The query for posts of type 'mobile_review'     $the_query = new WP_Query( $args );          // The Loop     while ( $the_query->have_posts() ) : $the_query->the_post();          //get terms             //$mobs = wp_get_object_terms($post->ID,"mobile_phone");           $mobs = get_terms('mobile_phone');      $count = count($terms);      if ( $count > 0 ){      echo "
";      foreach ( $terms as $term ) {        echo "
" . $term->name . "
";           }      echo "
";      }          endwhile;          // Reset Post Data     wp_reset_postdata();                  }      Am I close? I have been hacking back and forth for ages and getting nowhere. Any help would be great! Thanks in advance.


Prevent users from accessing mp3s in my uploads folder?

I have mp3 players set up to play mp3s on my site. The mp3s are all being uploaded to the uploads folder. I don't want people accessing these directly, meaning I don't want people to be able to download the mp3s. Is there a way to somehow restrict access to all files ending in .mp3 in the uploads folder while still having them playable in the mp3 players on the site?


how do you point 'screen_function' to a function in the same class?

In a plugin class, I'm successfully creating a new tab on a Member page using:                   bp_core_new_nav_item( array(         'name' => __( 'MyTab', 'bp' ),         'slug' => 'mytab',         'position' => 200,         'screen_function' => array( $this, 'mytab_screen' ),         'default_subnav_slug' => 'mytab'     ) );      The problem appears when you click the tab. The function is found - this Warning _DOES NOT_ appear:               Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback etc      But the function is not called and you end up on the 'It seems we can’t find what you’re looking for.' page. Am I using the correct approach to point 'screen_function' to a public function in the same class ?