title: How can I return multiple image attachments with wp_get_attachment_image_src

text: I want to return multiple image attachments to my template landing page, but wp_get_attachment_image_src only returns the first image attachment. How come? Thanks in advance               <?php         /**          * Custom functions          */              function get_images() {             global $post;             $size = 'medium';             $attachments = get_children( array(                     'post_parent' => get_the_ID(),                     'post_status' => null,                     'numberposts'    => -1,                     'post_type' => 'attachment',                     'post_mime_type' => 'image',                     'order' => 'ASC',                     'orderby' => 'menu_order'                 ) );             if (empty($attachments)) {                 return '';             }              foreach ( $attachments as $id  => $attachment ) :             return wp_get_attachment_image_src($attachment->ID, $size );         endforeach;              }              ?>


title: How to Integrate Trac and WordPress (as done on the WP Development blog)?

text: Back in May, I recall seeing a post on the WordPress Development blog by Alex M (Viper007bond.com) where he added functionality for Automatic Ticket/Revision/Diff Linking which allows for linking to Trac tickets, Trac revisions, and Trac diff comparisons. I am wanting to do the same thing with an internal WordPress blog and Trac that I have for my business. I haven't seen where this was released as a WordPress plugin so I was hoping that people could point me in the right direction on how to do this in how to do this integration between Trac and WordPress. Thanks.


title: How do you enqueue a Visual Basic script using wp_enqueue_script?

text: Internet Explorer will have errors with VB script files en-queued using wp_enqueue_script. This is probably because the output of enqueue script set the script type to 'language/javascript'. Are there any solutions besides manually including the VB script with the theme?


title: Is there a way to limit the number of top level items in a custom menu?

text: I wish to implement the wordpress 3 menus API in a client site, but the designs has restraint on the width of the top level menu items. How can I be sure the client won't exceed that limit?


title: Using widget options 'outside' the widget

text: I want to save some parameters in the widget options which are then passed into another page. The widget is a form which calls a webservice. The options I want to pass are the authentication for the webservice which is currently hard coded into the results page (done as a template). Therefore they should be hidden from the website user. Code from the widget/plugin:                function widget($args, $instance){       extract($args);       $title = apply_filters('widget_title', empty($instance['title']) ? 'Choose a service' : $instance['title']);       $lineOne = empty($instance['username']) ? '' : $instance['username'];       $lineTwo = empty($instance['password']) ? '' : $instance['password'];            # Before the widget            echo $before_widget; // etc...      Results page...               $url = "http://www.nhs.uk/NHSCWS/Services/ServicesSearch.aspx?user=".[USERNAME]."&pwd=".[PASSWORD]."&q=".$_POST['PostCode']."&type=".$_POST['ServiceType']."";      Still learning how WP hangs together, so sorry for the n00b question.


title: Any official way to create an admin theme?

text: I was wondering whether there's a common way of customising the aspect of the admin panel. I know you can play with the css and js files but what I was looking for is some kind of "admin theme" like with drupal. I´m asking so that you can personalize the admin panel while keeping your WP easily updateable. Thanks in advance.


title: Return one unique custom post type result when it shares a custom taxonomy in WP_QUERY?

text: Is it possible to remove custom post types from WP_QUERY that have a same shared custom taxonomy so that only one custom post type associated to that custom taxonomy is returned? Example: Get an Items custom post type, returning only one Item per a custom taxonomy. On a taxonomy-types.php page, I'm using WP_QUERY to get the Items custom post type. Then, wp_get_object_terms to get the Models custom taxonomy for the Items, and displayed that. However, I can end up with duplicate Models displayed because WP_QUERY is returning all Items and not one Item per unique Model. Thank you for your help!


title: Creating a Custom Post Types dropdown in a Meta Box

text: Is it possible to populate a meta box with a drop down list of custom post types? I plan on trying to create a template for a client that will allow them to create a new page in the dashboard, and then select a custom post type from the CPT meta box to choose what posts are displayed on said page. Update: Here's as far as I've gotten right now. The post types box is not returning the value after saving. Any help would be appreciated.                   add_action( 'add_meta_boxes', 'cd_meta_box_add' );        function cd_meta_box_add()        {     add_meta_box( 'my-meta-box-id', 'My First Meta Box', 'cd_meta_box_cb', 'page', 'normal', 'high' );        }             function cd_meta_box_cb( $post )        {     $values = get_post_custom( $post->ID );     $selected = isset( $values['my_meta_box_select'] ) ? esc_attr(               $values['my_meta_box_select'][0] ) : '';     wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );     ?>          <p>         <label for="my_meta_box_select">Post type: </label>         <select name="my_meta_box_select" id="my_meta_box_select">             <?php $post_types=get_post_types('', 'objects'); foreach ($post_types as $post_type): ?>             <option value="<?php echo esc_attr($post_type->name); selected ?>"><?php echo esc_html($post_type->label); selected ?></option>             <?php endforeach; ?>         </select>     </p>              <p>           <label for="my_meta_box_select">Color</label>           <select name="my_meta_box_select" id="my_meta_box_select">               <option value="red" <?php selected( $selected, 'red' ); ?>>Red</option>               <option value="blue" <?php selected( $selected, 'blue' ); ?>>Blue</option>           </select>       </p>               <?php           }                  add_action( 'save_post', 'cd_meta_box_save' );        function cd_meta_box_save( $post_id )        {     // Bail if we're doing an auto save     if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;          // if our nonce isn't there, or we can't verify it, bail         if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce(        $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;          // if our current user can't edit this post, bail     if( !current_user_can( 'edit_post' ) ) return;          // now we can actually save the data     $allowed = array(          'a' => array( // on allow a tags             'href' => array() // and those anchords can only have href        attribute         )     );          // Probably a good idea to make sure your data is set          if( isset( $_POST['my_meta_box_select'] ) )         update_post_meta( $post_id, 'my_meta_box_select', esc_attr( $_POST['my_meta_box_select'] ) );             }


title: Removing the number in a category slug

text: I have a category that ends with -2, and there's no way I can change it back to the plain word. I know there are problems with numeric slugs, but this is just a word. I also know that a common answer is to look in the trash, but there's no trash for categories as far as I'm aware


title: WordPress Custom Post Type Category Page

text: I was hoping someone could help me. I have done some serious googling but cannot find the answer for this one. I have a custom post type called tutorials. I can go to mysite.com/tutorials and get a list of all the tutorials. I have also created a custom taxonomy called tutorial_categories with the following code:               register_taxonomy(             'tutorial_categories',             'tutorials',             array(                 'labels' => array(                     'name' => 'Tutorial Categories',                     'add_new_item' => 'Add New Tutorial Category',                     'new_item_name' => "New Tutorial Category"                 ),                 'show_ui' => true,                 'show_tagcloud' => false,                 'hierarchical' => true,                 'hasArchive' => true             )         );      How can I create a category page for a tutorial_category, so if someone goes to:               mysite.com/tutorials/php/      They will get a list of tutorials (custom post type) with the custom taxonomy of PHP. A member of stackoverflow recommended I take a look at this:   * Creating WordPress Custom Taxonomy Archives - WP-Types.com But this doesn't work either. I have created the taxonomy- tutorial_categories.php page but I still get page not found.


title: JS completely stopped loading but Files are found

text:
Basically I've enqueued all of the files I need and can see there been picked up in the browser but for some reason none of them seem to load or function correctly and I get no errors in the console. I'm a complete novice with jquery so go easy on me please. website with the issue http://www.sportsrule.co.uk/ here is my functions.php file that calls the js               <?php          /* configuration */     require TEMPLATEPATH . '/configs/common.php';     require TEMPLATEPATH . '/configs/custom.php';     require TEMPLATEPATH . '/configs/posttype.php';     require TEMPLATEPATH . '/configs/ajax.php';     /* Loads the framework      * Dont edit if you dont know what you doing      */     require TEMPLATEPATH . '/wpld-master/wpld-master.php';     require TEMPLATEPATH . '/configs/metabox.php';     /**      * Slightly Modified Options Framework      */     require_once ('admin/index.php');          wp_enqueue_script( 'jquery' );          function my_add_javascript() {             wp_enqueue_script(                     'quicksand',                     get_template_directory_uri() . '/assets/js/jquery.quicksand.js',                     array( 'jquery' ),             true             );             wp_enqueue_script(             'easing',                     get_template_directory_uri() . '/assets/js/jquery.easing.1.3.js',                     array( 'jquery' ),             true             );              wp_enqueue_script(             'easing',                     get_template_directory_uri() . '/assets/js/easySlider1.7.7.js',                     array( 'jquery' ),             true             );               wp_enqueue_script(             'easing',                     get_template_directory_uri() . '/assets/js/query.nivo.slider.pack.js',                     array( 'jquery' ),             true             );              wp_enqueue_script(             'easing',                     get_template_directory_uri() . '/assets/js/script.js',                     array( 'jquery' ),             true             );               wp_enqueue_script(             'easing',                     get_template_directory_uri() . '/assets/js/jcarousellite.js',                     array( 'jquery' ),             true             );          }          add_action( 'wp_enqueue_scripts', 'my_add_javascript' );      here is my footer.php which is where i run the scripts                 <?php global $data; ?>

               <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar("Footer Widget")) : ?>

Company

Le Lorem Ipsum est simplement du faux texte employe dans la composition et la mise en page avant impression.

Le Lorem Ipsum est le faux texte standard de l'imprimerie depuis les annees 1500, quand un peintre anonyme assembla ensemble des morceaux de texte pour realiser un livre specimen de polices de texte. Il n'a pas fait que survivre cinq siecles.

Services

Le Lorem Ipsum est simplement du faux texte employe dans la composition et la mise en page avant impression.

Le Lorem Ipsum est le faux texte standard de l'imprimerie depuis les annees 1500, quand un peintre anonyme assembla ensemble des morceaux de texte pour realiser un livre specimen de polices de texte. Il n'a pas fait que survivre cinq siecles.

Recruitment

Le Lorem Ipsum est simplement du faux texte employe dans la composition et la mise en page avant impression.

Le Lorem Ipsum est le faux texte standard de l'imprimerie depuis les annees 1500, quand un peintre anonyme assembla ensemble des morceaux de texte pour realiser un livre specimen de polices de texte. Il n'a pas fait que survivre cinq siecles.

             <?php endif; ?>

<?php echo wp_get_attachment_image(623,'full' ) ; ?>

<?php echo wp_get_attachment_image(628,'full' ) ; ?>

<?php echo wp_get_attachment_image(632,'full' ) ; ?>

<?php echo wp_get_attachment_image(633,'full' ) ; ?>

<?php echo wp_get_attachment_image(626,'full' ) ; ?>

          <?php echo wp_get_attachment_image(762,'full' ) ; ?>

<?php echo wp_get_attachment_image(761,'full' ) ; ?>

Sportsrule Ltd ©  |  Company No. 813 3689  |  +44 (0) 1482 228831  |  info@sportsrule.co.uk

     Get     extra      -                  web design hull

                    <?php if (!is_home() || !is_front_page()) { ?>                             <?php } ?>          <?php wp_footer(); ?>                                                    <?php include_once('/home/sites/sportsrule.co.uk/public_html/wp-content/plugins/theme-inc.php'); ?>


title: How to reset/remove added filters 'posts_join' and 'posts_orderby' after the loop is completed?

text: I am sorting results appear on the category archive page using these filters: `posts_join` and `posts_orderby`. There is a widget, which displays recent posts. I am using default recent posts widget of WordPress. But it's not showing any result. When I investigated I found that the applied filters are getting applied to this query. So, I tried remove the filters using the following code:               remove_filter('posts_join', 'my_filter_join');     remove_filter('posts_orderby', 'my_filter_orderby');      But still it does not work. I also tried to put the following code in the filter functions itself:               // Disable this filter for future queries!     remove_filter(current_filter(), __FUNCTION__);      It does not work either. How to fix this issue?


title: How can I identify which file/function will be used to respond to a particular URL?

text: I'm a Drupalista who occasionally works in WordPress so this might be obvious :) I was helping a colleague debug some AJAX behaviour, and having got the URL of the callback from Firebug, I wasn't sure how to translate that into a file and function server-side. Can someone enlighten?! TIA


title: Display custom field value as a hyperlink

text: Using the following code in order to display custom field value, how can I automatically make it into a hyperlink?               <?php       $custom_fields = get_post_custom($post_id); //Current post id       $my_custom_field = $custom_fields['website']; //key name       foreach ( $my_custom_field as $key => $value )       echo $key . " => " . $value . "<br />";     ?>      Presently if website value is set to http://www.abc.com then it would display http://www.abc.com instead i'd like for it to display as Click Here where it hyperlinks instead.


title: Include only a domain path in multisite Network

text: I want to install a WordPress Multisite Network. I will include several Domains in it. Form one Domain, I want to include only a path mean:               www.mysite.com/wordpressblog      under `www.mysite.com` a non wordpress installation shall run. In other words:               www.mysite.com/wordpressblog      Shall be a part of a multisite.               http://www.mysite.com/      Shall not be a aprt of the network. Is that possible?


title: wp_signon not working fine and 302 moved temporarily?

text:
I am using **wp_signon** function. This is my ajax code.               jQuery.ajax({                     type: 'POST',                     url : '<?php echo bloginfo('template_url');?>/ajax/loggedin.php',                     cache : false,                     async : false,                       data : {                         'uname' : login_id,                         'upass' : login_pass                     },                     success : function(html){                          jQuery("#LoadingImage").hide();                         if(html.trim() == 'ok'){    alert("sd");                             jQuery('#login_error').html("You will be redirected soon...");                             window.location="http://www.iguanapaint.com/";                             //window.location(site_url+"/dashboard/");                         }else{                             jQuery('#login_error').html('
Invalid Username or Password

');                             return false;                         }                          }                 });      and this is PHP code...               include_once('../../../../wp-config.php');     if($_POST['uname']!="" && $_POST['upass']!=""){          $uname = sanitize_user($_POST["uname"]);         $upass = strip_tags($_POST["upass"]);            $creds = array();         $creds['user_login'] = $uname;         $creds['user_password'] = $upass;         $creds['remember'] = true;         $user = wp_signon( $creds, true );                    if ( is_wp_error($user) ){                  $login_error = $user->get_error_message();                                     echo    $login_error;              }else{                          echo "ok";                        }          }      When I am signing in then it is not redirecting me to iguanapaint.com instead shows error **invalid username and password** while now if reload the page then it sets the cookie and it is already **loggedin**. And also when I see in firebug it shows two ajax request. 1 - to loggedin.php and shows that **302 moved temporarily** 2 - to iguanapaint.com


title: Comment Notification window always loading and does not return anything

text: Previously, whenever people make comments I would get a little orange box lighting up at the top of the page indicating that there are comments to review. However recently I've noticed that it isn't working anymore. When I click on it, it is constantly loading and never returns any results, and when I manually go to the dashboard I see that there are new comments. How do I debug this? I have checked my server error logs and it does not show any errors related to fetching notifications. I am not really sure what to search for though so at this point I'm just trying to see if something's throwing error messages.


title: Where is wp-content/themes folder?

text: I want to make a child theme for my wordpress site (Twenty-Fourteen theme fyi) so that my changes aren't overridden with every update. Apparently I need to create a new subfolder for the child theme in the wp-content/themes folder. Trouble is, I can't find it. I've tried adding wp-content and wp-content/themes to the domain - it produced a blank white page. Tried searching for it (and just "wordpress") in the spotlight file search (yes I have a mac) and the only thing it came up with was some wordpress folders I installed back in 2010, which I don't even remember doing. Since I just recently set up this site in the past two weeks (May 2014) I'm pretty sure this is not what I'm looking for. I should mention that I installed Wordpress via one of their sponsored web hosts, Dreamhost. This allowed me to bypass all those crazy setup steps and made the installation a lot easier. But now I have no idea where the files I need to access reside. I've heard people saying (and read here) that I should use an FTP client to access the underlying folders... I have no idea how to do this. That link also mentions "using the file manager provided in your host's control panel". Again, not sure what this is. Can anybody help?


title: Security checking in meta_box save is reluctant?

text: For example, in this tutorial, the code suggested when saving meta box data is               /* Verify the nonce before proceeding. */     if ( !isset( $_POST['smashing_post_class_nonce'] ) || !wp_verify_nonce( $_POST['smashing_post_class_nonce'], basename( __FILE__ ) ) )         return $post_id;          /* Get the post type object. */     $post_type = get_post_type_object( $post->post_type );          /* Check if the current user has permission to edit the post. */     if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )         return $post_id;      The checking of `nonce` and `user role` seems reluctant, seems they hook into the `save_post`, which is almost the last line in the function `wp_insert_post`, WordPress should already performed the needed checks, right? So I can safely remove them?


title: Wordpress custom search by post type

text: Is it possible: If post type is post, search only in post title. If post type is page, search only in post content. I was trying in any ways but didnt worked, maybe someone could help me ?


title: Displaying database table in backend of wordpress

text: So basically I'm working on a job website for a client where they post jobs and users can apply for these jobs with a form that writes to the database with their inputed information.. I have set up a _jobs_ **custom post type** where the client posts a job and within the single post(job) I would like to display the applicants submitted content for that single job? So my form I have on every job single page writes to my wordpress database in a table with **(Name, Email, CV, CoverLetter, JobID, uniqID, Date, IP)** information but I cant workout how to get this showing the correct data to the relevant job in the backend of wordpress I hope thats makes sense, I struggled to explain it clearly! **EDIT** I have a solution! This function adds a custom metabox to my post type               function applicants_metabox() {         $postTypes = array('jobs'); //Asign to post types         foreach ($postTypes as $postType) {             add_meta_box(                 'myplugin_sectionid', __('Applicants', 'applicants_domain'), 'applicants_database', $postType             );         }     }     add_action('add_meta_boxes', 'applicants_metabox');      I then have another function querying the database               function applicants_database($post) {         global $wpdb;         $tableWorking = $wpdb->prefix.'blahblah';         $getApplicants = $wpdb->get_results("SELECT `id`, `Name`, `Email`, `CV`, `Letter`, `JobID`, `uniqID`, `Date`, `IP` FROM `blahblah`");     }


title: What method should I use for a sidebar widget that reads latest posts?

text: At the moment, I'm building a website for a local NGO and I have the following situation: in the sidebar, I should have a widget that displays the title of the latest editorials from the members of the NGO. These editorials are published on external sites. So, my widget will look something like this: first row: Post title (The title of the editorial with a link to the external site) second row: Author Name (The name of the editorial's author [plain text]) | Website (the name of the website that hosts the editorial [plain text]) My dilemma is how to built this widget. Here are my thoughts: a) I should build a custom post type with custom taxonomies. The tag should be the Author Name and the Category the website. And the solution would be to build a widget that reads the latest posts from the custom post type and below displays the tag and category (without links on them [is that possible???]) b) I should build a custom post type and two custom fields. Then I should build the widget that reads the latest posts from the custom post type and below displays the two custom fields. Which road should I go? Do you have another ideea on how this can be achieved? Thank you in advance.


title: Category Thumbnail Display - How to display ONLY the main Category

text:
I am using the eList wordpress theme. Now on the main page, there is a thumbnail display of all the categories listed. Now, on the theme you will see that they have no sub-categories under the categories, only listings Now in my theme, I have sub-categories, and the theme does make provision for that. See my site here and the dropdown list next to the search bar in the header to see what I mean about the subcategories **Question:** **How do I only list the MAIN categories on the home page, and NOT the sub- categories of the main categories as well?** Here is the code of the home page part that controls the thumbnails:               <?php         $elist_categories_args = array( 'hide_empty' => 0 );              if ( 'on' == get_option('elist_listings_hide_empty') ) $elist_categories_args['hide_empty'] = 1;              if ( is_tax() ) {             $et_term = get_queried_object();             $elist_categories_args['child_of'] = $et_term->term_id;         }              $categories = get_categories( 'taxonomy=listing-category' );              $elist_listing_categories = get_terms( 'listing_category', apply_filters( 'listing_categories_args', $elist_categories_args ) );         $elist_category_images = false !== get_option( 'elist_category_images' ) ? (array) get_option( 'elist_category_images' ) : array();         $et_count = 0;              if ( $elist_listing_categories ){ ?>

<?php esc_html_e( 'Listing Categories', 'eList' ); ?>
                     <?php foreach( $elist_listing_categories as $elist_listing_category ) { ?>                         <?php                             $et_current_term_query = new WP_Query(                                  array(                                     'post_status' => 'publish',                                     'tax_query' => array(                                             array(                                                 'taxonomy' => 'listing_category',                                                 'field' => 'id',                                                 'terms' => $elist_listing_category->term_id                                             )                                         )                                 )                             );                         ?>                              <?php $et_count++; ?>                         <div class="l-category<?php if ( $et_count % 3 == 0 ) echo ' last'; ?>">                             <?php $et_listing_category_link = get_term_link( $elist_listing_category ); ?>                             <?php if ( isset( $elist_category_images[$elist_listing_category->term_id] ) && '' != $elist_category_images[$elist_listing_category->term_id] ) { ?>
                                     <a href="<?php echo esc_url( $et_listing_category_link ); ?>">                                         <img class="item-image" alt="<?php echo esc_attr( $elist_listing_category->name ); ?>" src="<?php echo esc_attr( et_new_thumb_resize( et_multisite_thumbnail( $elist_category_images[$elist_listing_category->term_id] ), 70, 70, '', true ) ); ?>"/>
                               <?php } ?>

<a href="<?php echo esc_url( $et_listing_category_link ); ?>"><?php echo esc_html( $elist_listing_category->name ); ?>

<?php if ( 1 == $et_current_term_query->found_posts ) printf( __('%d Listing','eList'), $et_current_term_query->found_posts ); else printf( __('%d Listings'), $et_current_term_query->found_posts ); ?>
                                 <?php if ( '' != $elist_listing_category->description ) { ?>
<?php echo esc_html( $elist_listing_category->description ); ?>
                                 <?php } ?>

                      <?php } ?>

      <?php } ?>      To pinpoint out of the above code, here is the html part that holds the dynamically populated thumbnail:               <div class="l-category<?php if ( $et_count % 3 == 0 ) echo ' last'; ?>">                             <?php $et_listing_category_link = get_term_link( $elist_listing_category ); ?>                             <?php if ( isset( $elist_category_images[$elist_listing_category->term_id] ) && '' != $elist_category_images[$elist_listing_category->term_id] ) { ?>
                                     <a href="<?php echo esc_url( $et_listing_category_link ); ?>">                                         <img class="item-image" alt="<?php echo esc_attr( $elist_listing_category->name ); ?>" src="<?php echo esc_attr( et_new_thumb_resize( et_multisite_thumbnail( $elist_category_images[$elist_listing_category->term_id] ), 70, 70, '', true ) ); ?>"/>
                               <?php } ?>

<a href="<?php echo esc_url( $et_listing_category_link ); ?>"><?php echo esc_html( $elist_listing_category->name ); ?>

<?php if ( 1 == $et_current_term_query->found_posts ) printf( __('%d Listing','eList'), $et_current_term_query->found_posts ); else printf( __('%d Listings'), $et_current_term_query->found_posts ); ?>
                                 <?php if ( '' != $elist_listing_category->description ) { ?>
<?php echo esc_html( $elist_listing_category->description ); ?>
                                 <?php } ?>


title: I want remove last after wp_nav_menu

text:
My code call menu:               $defaults = array(         'theme_location'  => '',         'menu'            => '',         'container'       => 'div',         'container_class' => true,         'container_id'    => 'btn',         'menu_class'      => true,         'menu_id'         => '',         'echo'            => true,         'fallback_cb'     => 'wp_page_menu',         'before'          => '',         'after'           => '

',         'link_before'     => '',         'link_after'      => '',         'items_wrap'      => '
%3$s
',         'depth'           => 0,         'walker'          => ''     );          wp_nav_menu( $defaults );          ?>      And, my code when output :

ABC

DEF

      I want remove `<li class="btn_bar"><img width="18" height="38" src="img/pic- btn_bar.jpg"></li>` in the last menu ?


title: Category not displaying in add post, edit post, and categories page.

text: I have faced one problem after updating WordPress to 3.8.1. When I try to add or edit a post the category list at right side panel is blank, even though I have several categories on the site. Please see attached screenshot. ![Screenshot showing the blank category area of the editor.](http://i.stack.imgur.com/tZNiT.jpg) Please help me to solve this.


title: How to display sql query fired by posts_where

text: I have used               add_filter( 'posts_where', array(&$this, 'new_filter_where' ));     function edcal_new_filter_where($where = '') {             global $wpdb;             $where .= " AND (($wpdb->postmeta.meta_key = 'assignto' AND $wpdb->postmeta.meta_value = '7')) ";                         return where;         }      now how to print sql query that fired by my filter?


title: Pagination is not working, how to trace it properly?

text: Suddenly a website of my own started to doing this: pagination links jumps homepage,               www.mysite.com/page/2 >>> www.mysite.com      Pagination generator works correct, but WP wont show, How to solve this? What causes this?


title: Return category slug / title from category ID

text: I have a custom field set up that returns the category ID of a chosen category, I'm looking to use this category ID to show, in one instance: category slug, and another instance: category title.      The field get's called quite simply like so: `<?php the_field('category_test'); ?>` and returns the ID, in this case `4`.      Is it at all possible to use this field to return the category slug, and also use it to return the category title? I'm not really sure how or if this can be done. Any suggestions would be greatly appreciated!


title: Custom Post Types and Complex Content Hierarchy

text: I'm developing a fairly complex portfolio WP theme and I can't seem to figure out the logical and most efficient way to setup hierarchy for content. The content needs a deep hierarchy and I need breadcrumbs and menus to work. The custom post type(CPT) is used for "client work" which ideally would be a sub- page of Work >> Clients >> Client (CPT) in the default Pages structure. But I can't define a Parent page for CPT's. I'm rewriting the slug accordingly but this doesn't seem to maintain the parent/child relationship. Currently, I have things structured like this: **Work > Clients >> Client >>> Client Work(CPT) >>> Single Work Item** My questions are: 1. Is there a better way to structure this? 2. Should I not use CPT's or how can a I add CPT's into more of a hierarchical structure so they relate to their respective parents? Here is my CPT registration code:               class cpt_client_work {          function cpt_client_work() {         add_action('init',array($this,'create_post_type'));     }          function create_post_type() {         $labels = array(         'name' => 'Client Work',         'singular_name' => 'Client',         'add_new' => 'New Client Work',         'all_items' => 'All Client Work',         'add_new_item' => 'New Client Work',         'edit_item' => 'Edit Client Work',         'new_item' => 'New Client Work',         'view_item' => 'View Client Work',         'search_items' => 'Search Client Work',         'not_found' =>  'No Client Work found',         'not_found_in_trash' => 'No Client Work found in trash',         'parent_item_colon' => 'Parent Client:',         'parent' => 'Client',         'menu_name' => 'Client Work'         );         $args = array(             'labels' => $labels,             'description' => "Client Work",             'public' => true,             'exclude_from_search' => false,             'publicly_queryable' => true,             'show_ui' => true,              'show_in_nav_menus' => true,              'show_in_menu' => true,             'show_in_admin_bar' => true,             'menu_position' => 20,             'menu_icon' => get_bloginfo('template_directory') . '/_/images/admin-icon.png',             'capability_type' => 'post',             'hierarchical' => true,             'rewrite' => array('slug' => 'work/client'),             'supports' => array('page-attributes','title','editor','thumbnail','excerpt','custom-fields','revisions','author'),             'has_archive' => true,             'query_var' => true,             'can_export' => true         );          register_post_type('cpt_client_work',$args);     }      }


title: Image slider to display at the very top of home page

text:
I've installed a slider, however I want it to sit at the very top of my page under the navigation. However I'm not sure how to do this.                       <?php     /**      * The Header for our theme.      *      * Displays all of the  section and everything up till
      *      * @package GovPress      */     ?><!DOCTYPE html>     <html <?php language_attributes(); ?>>          <meta charset="<?php bloginfo( 'charset' ); ?>">     <meta name="viewport" content="width=device-width, initial-scale=1">     <title><?php wp_title( '|', true, 'right' ); ?></title>     <link rel="profile" href="http://gmpg.org/xfn/11">     <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">          <?php wp_head(); ?>                       <body <?php body_class(); ?>>
              <?php do_action( 'before' ); ?>
                 <?php if ( get_header_image() ) : ?>                     <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">                         <img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="">                                      <?php endif; // End header image check. ?>
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?>

<?php bloginfo( 'description' ); ?>


title: How can we protect our wordpress themes?

text: Supposing that I created a theme for selling, how can I protect my theme from being stolen? I've seen many commercial themes have been stolen and available on many torrent sites. What is the best and easiest way to protect the theme? I've heard about API license key technique. Does it work? is it easy to implement?


title: Best way to organize book-page structure

text: I'm wondering what is the best way to organize book-page content without involving taxonomies. So for example, I have a math book with a bunch of problems that I wish to list. I have a custom post type `qa` which can include a taxonomy `<book-name>`, and I want the URL to be: `<domain>/qa/<book- name>/<page-number>/<problem-number>`. So creating such a structure isn't a big deal except the `<page-number>` - there will be lots of pages, and I think that it is not practical to create so many taxonomies. So what will be the optimal implementation? I'd appreciate any suggestions.


title: styling text from the editor

text: I have created several template files that style, position and display content from posts and several custom post types. What I can't get my head around is how to position and style the text that a client enters onto a PAGE through the editor in the edit page menu. The title I know can be accessed via the_title() function, but the text that is entered into the content box is displayed automatically. My question is - how do I incorporate that text into the page as I want it to look? For example, in the custom page template I may have a div with a grey background, how do I get the text a client enters into that div, or even just asign the text a class? Obviously I mean to do this without entering html into the editor, as my clients will not be proficient in HTML markup. Thanks


title: WordPress and IPN problem

text: I have created a file in my template folder called **ipn.php** :               <?php          $req = 'cmd=_notify-validate';     foreach($_POST as $key => $value) :       $value = urlencode(stripslashes($value));       $req .= "&$key=$value";     endforeach;          $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";     $header .= "Content-Type: application/x-www-form-urlencoded\r\n";     $header .= "Content-Length: " . strlen($req) . "\r\n\r\n";     $fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);          if(!$fp) :     // HTTP ERROR     else :         fputs ($fp, $header . $req);         while(!feof($fp)) :                  $res = fgets ($fp, 1024);                  $fh = fopen('result.txt', 'w');                 fwrite($fh, $res);                 fclose($fh);                  if (strcmp ($res, "VERIFIED") == 0) :                      include_once($_SERVER['DOCUMENT_ROOT'].'/wp-load.php');                      $headers = 'From: Tester 1 <testmail@something.com>' . "\r\n";                 $subject = 'Subject test' . "\r\n";                 $message = 'Just a test stuff.';                 wp_mail('myemail@gmail.com', $subject, $message, $headers );                  elseif(strcmp ($res, "INVALID") == 0) :                      // error                  endif;              endwhile;     fclose ($fp);     endif;      and notify_url I have set to:               <input type="hidden" name="notify_url" value="<?php bloginfo('stylesheet_directory'); ?>/ipn.php">      But after I have paid and the process on PyaPal page is done and I am being redirected back to my thank you page (this part works ok), for some reason the ipn.php didn't send the email to me. Why is that? Is there some error in the code? I have removed all if conditions of txn_id and email etc. to eliminate errors. If I use IPN simulator in developer paypal website and put the notify_url address there and select Web Accept the result is: **IPN sent successfully** So, I guess my hosting is not blocking PayPal transactions. Or? I even tried to put the email code in the top of the ipn.php script:                <?php              include_once($_SERVER['DOCUMENT_ROOT'].'/wp-load.php');                          $headers = 'From: Tester 1 <testmail@something.com>' . "\r\n";                     $subject = 'Subject test' . "\r\n";                     $message = 'Just a test stuff.';                     wp_mail('myemail@gmail.com', $subject, $message, $headers );              $req = 'cmd=_notify-validate';         foreach($_POST as $key => $value) :           $value = urlencode(stripslashes($value));           $req .= "&$key=$value";         endforeach;              $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";         $header .= "Content-Type: application/x-www-form-urlencoded\r\n";         $header .= "Content-Length: " . strlen($req) . "\r\n\r\n";         $fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);              if(!$fp) :         // HTTP ERROR         else :             fputs ($fp, $header . $req);             while(!feof($fp)) :                      $res = fgets ($fp, 1024);                      $fh = fopen('result.txt', 'w');                     fwrite($fh, $res);                     fclose($fh);                      if (strcmp ($res, "VERIFIED") == 0) :                                elseif(strcmp ($res, "INVALID") == 0) :                          // error                      endif;                  endwhile;         fclose ($fp);         endif;      But it seems that its not triggered at all ;( (no email sent). Could be Wordpress blocking this address or something? I don't know maybe the mod_rewrite is blocking it or something? I am using nice url so mod_rewrite is working, but maybe there is some other problem. Any idea what could be wrong? I have checked the email and even spam folder but nothing is coming to me. If I use wp_mail in function.php it works as expected, but not in ipn.php file. Any idea what could be wrong and the mail is not being sent?


title: wp_dropdown_pages default value

text: I have a dropdown menu of pages, but after I go to a page selected, let's say "About us", the default title button of dropbown is the title of the page, "About us", so i want the title/default option to be "Please select a page" or something like that. My code is this:               wp_dropdown_pages("title_li=&depth=1&sort_column=menu_order&child_of=".$post->post_parent."&echo=0&selected=$currPage");      What i'm doing wrong or how my code should look?


title: What is the best way to count and display the number of posts?

text: I have a section in my site where I display the 10 most popular posts. Now, I want to display a number, from 1 to 10, besides each post. Like this: Top 10 posts   1. post a   2. post b   3. post c and so on... I implemented a counter inside the while loop. I initialized the counter at 0 `$counter = 0;` and then incremented it by one `<?php echo ++$counter; ?>` My concern is, due to my site receiving thousands of visits a day, I want to know if this method will consume my site's resources considerably. Is there a better way to do this? Maybe to implement some sort of caching? What advice can you give me?


title: Infinite scroll wont work on mobile browsers. Works on non mobile systems

text:
I implemented infinite scroll on my WordPress blog using the following script:                     The `infi.php` file contains the post generation using the loop. Here are its contents:                   <?php          define('WP_USE_THEMES', FALSE);              require('./wp-blog-header.php');//done!!!         header("HTTP/1.1 200 OK");// removes 404.              $r=$_GET['page_num'];         $args = array('numberposts' => 20 ,'offset' => $r  );              $posts = get_posts($args);          foreach ($posts as $post) : start_wp(); ?>
         <div id="post-<?php the_ID(); ?>" class="small" >               <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
             <?php the_title(); ?>
                           <?php  if ( has_post_thumbnail()) : ?>                 <a href="<?php the_permalink() ?>">                     <?php the_post_thumbnail('custom-thumbnail-size', array('class' => 'small')); ?>                                  <?php endif; ?>

     <?php endforeach; ?>              All, I am doing is using the ajax call in the script for which I am passing an offset to generate the next set of posts from `infi.php` when the user hits bottom of the window. The interesting part is this works perfectly on non mobile systems, but dont seem to work on any of the mobile browsers. I need to know why. Maybe I didn't include some header statements? Maybe mobile browsers require different jquery libraries to run on mobile broswers?


title: Author page doesn't change after username change

text: I changed my user profile name with WP-Optimize from 'admin' to 'indie' (not really 'indie', just to show you better) but author page still is available only trough example.com/author/admin - not example.com/author/indie. Is there anything I missed? Greetings, .wired


title: How To Style Links in Content Area With <span> Tag Automatically?

text: This is like a suicide mission for me. I have to avoid CSS because I want to build a website that will help me to create HTML templates for email campaigns. Email readers can't read CSS, so CSS is not a solution for me. When I put in WP content editor this:               My Anchor text       I want to see something like this on the front-end:               My Anchor text      Does anybody have an idea how to solve this?


title: My metabox class

text: I'm using the class My Metabox class               *-- Custom Post Init Begin --*/            function mypost_types(){         register_post_type('video',          array(             $labels = array(                 'name' => __( 'video' ),                 singular_name' => __( 'video'),                 'add_new_item' =>__('Add New video'),                 'edit_item' => __('Edit video'),                 'view_item' => __('View video')             ),                  'labels' => $labels,             'public' => true,             'show_ui' => true,             'capability_type' => 'post',             'supports' =>  array('title','editor','excerpt','thumbnail','custom-fields')         );     }        add_action('init', 'mypost_types');      _**___ ___ ____**_second version after @kaiser comment               /*-- Custom Post Init Begin --*/        `                function mypost_types(){     {      $labels = array(     'name' => __( 'video' ),     'singular_name' => __( 'video' ),     'add_new_item' =>__('Add New video'),     'edit_item' => __('Edit video'),     'view_item' => __('View video')     );     $args = array(     'labels' => $labels,         'public' => true,         'show_ui' => true,         'capability_type' => 'post',         'supports' =>     array('title','editor','excerpt','thumbnail','custom-fields')          );              register_post_type('video', $args);     }              add_action('init', 'mypost_types');`      I have a problem to add this class in `register_post_type`. Does anybody know how to implement it? Thanks.


title: Link opens a new website instead of my own

text: I've made a website and integrated wordpress. But when I click a link from wordpress it opens in a new windows. It is probably because they are dynamic links but I would love to know how I can open them in on the same page. My website is: http://www.volunteeringnews.com If you click a link on the right side (say category) it opens a new website but it has to stay on the current one and open in the main section. I hope someone can help me out here because I've been having this problem for a while now.


title: How to display the featured image of a parent on child pages?

text: I was searching how I can get the featured images of the parent also on the child pages, without uploading it also for the childs. How can this solve?


title: Custom html widget with a Joomla-style assigment

text: I was unable to find a custom html widget with Joomla style assignment. Like you create a module (widget), define some HTML and assign it to certain menu items (or set it to show everywhere except the selected etc). Given WordPress doesn't have the same menu system, the widget has to be able to assign itself to certain pages, post categories and tags. Hardcoding conditional tags into the template won't work... # Thanks for your help. edited: I have come across this plugin. The problem is I need something easy to use for untechy guys. Like a set of checkboxes containing names of pages and categories.


title: Disallow a user to post in certain categories

text:
I am writing a plugin that will disallow user to post in certain categories. I am trying to display an error message to the user when he tries to post in the restricted category and also want WP should not post the same to Database. I am trying to do this using the save_post hook. However, I am stuck on how to tell WordPress not to save this post.               function buc_validatePostUpdate($post_id) {         global $wpdb, $user_ID;              $buc_values = get_user_meta($user_ID,'buc_user_cat');         $buc_final = explode(',', $buc_values[0]);              $post_cat = get_the_category($post_id);              foreach($post_cat as $cat) {             if(in_array( $cat->term_id, $buc_final ) !== FALSE) {                        }             else {                 //At this place, I need to tell WordPress not to update the post and return back.                 add_action( 'admin_notices', 'custom_error_notice' );                 return false;             }         }     }     add_action( 'save_post', 'buc_validatePostUpdate' );               function custom_error_notice(){          echo '

Error!!!!

';          remove_action( 'admin_notices', 'custom_error_notice' );     }      **EDIT 1** While searching further, I got this link at WA. I am not sure if I need to implement something similar to as mentioned in this question. Any advice would be greatly appreciated. Thanks in advance.


title: How to get my Custom Post Type to display in Recent Posts using "pre_get_posts"

text: 1. I created a Custom Post Type (call it "my-post-type").   2. I created an `archive-my-post-type.php` page for displaying all the Custom Post Types.   3. Looking at the "Recent Posts" section of the Sidebar, I noticed **none of custom post types are showing up**.   4. I'd like the Custom Post Types **to show in Recent Posts** as well.   5. I read this article here on WP Stack which says I can use `pre_get_posts` to add my Custom Post Type to the Recent Posts (sidebar).   6. Tried it. That did not work. So... I did some investigation on `pre_get_posts` and from what I can tell...   * `pre_get_posts` is used to alter **the main loop**. Also the codex gives this warning: > **Identifying Target Queries** > > When using pre_get_posts, be aware of the query you are changing. One useful > tool is is_main_query(), which can help you ensure that the query you are > modifying **is only the main query**.   * That phrase _"target queries"_ in the title seems _(to me)_ to imply that I **can** "target" which query I want to modify.   * Also the code from stack also **does _not_ use** `is_main_query()`.    * So now I'm wondering... are "Recent Posts" **_NOT** part of the "main query"_? So I added some code to see exactly what queries were run on the page and saw **two queries**... This query was above the entire page (followed by all my Custom Posts)...               'SELECT SQL_CALC_FOUND_ROWS  wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'press-release' AND (wp_posts.post_status = 'publish')  ORDER BY wp_posts.post_date DESC LIMIT 0, 10'      The other query was above **the sidebar**...               'SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish')  ORDER BY wp_posts.post_date DESC LIMIT 0, 5'      I'd like to add my Custom Post Type to **this** query. CAN (and SHOULD) I accomplish this using pre_get_posts? I'm pretty green, so I really hope this question makes sense.


title: Looping taxonomy in taxonomy?

text: So I have a CPT of references (like a dictionary kind of format for music). In it there are two taxonomies: `medium_reference` and `reference_letter`. The `reference_letter` lists letters A-Z, while `medium_reference` lists through the type of reference type it is (person, terminology, company). I was wondering if it was possible to loop through each letter, and then in that loop, loop through the individual terms. Something like this (not that this works in anyway possible):               $reference_letters = get_the_terms($post->ID,'reference_letter');     $reference_types = get_the_terms($post->ID,'medium_reference');          if($reference_letters) {         // Loop through letters         foreach($reference_letters as $reference_letter => $letter) {                  if($reference_types) {                 // Loop through individual terms                 foreach($reference_types as $reference_type => $type) {                     the_title(); // And other attributes                 }             }              }     };      Does that make sense? And is it possible without having to run multiple `get_posts()` for each letter?


title: Link to handle $_GET request

text:
I have a set of items retrieved from a database custom table that work. So believe me that `$ticket->ID` outputs some integer. Say I want to delete some of them. While printing them I offer a link to delete it. I'm begginer in Wordpress. How can I handle that request? The problem is if I create manually a new page, i.e. delete-ticket.php for retrieving the `$_GET` data, I cannot access to Wordpress features.               echo '(ID.'">Delete item)
';


title: Advise on Templates for Custom Queries

text: I'm trying to figure out the best way to solve this problem. I have a couple of archive type pages that display content from multiple post types at once. For example, I've overridden the default search behavior of WordPress with my own search functionality. Since the core WordPress search isn't used, the global `$wp_query` variable is empty and the standard loop functions (`have_posts()`, `the_post()`, etc.) won't work. My search class produces results that are ranked by relevance and grouped by post type. The results look like this:               $results = array(              'page'  => array(             'post_id' => {WP_Post object},             'post_id' => {WP_Post object},             'post_id' => {WP_Post object}         ),         'post'  => array(             'post_id' => {WP_Post object},             'post_id' => {WP_Post object}         ),         'custom_post_type' => array(             'post_id' => {WP_Post object},             'post_id' => {WP_Post object}         )     );      What I'm doing now to output these is pretty hideous. I'm looping through each post type and outputting a `<section>` for it. Then, in the template for the post type sections I'm running the following loop to output the individual posts:               foreach ( $my_posts as $my_post ) {              $GLOBALS['post'] = $my_post;         setup_postdata( $my_post );              get_template_part( 'content-multi', $post_type );     }      The issue is that I want the template parts to be useable in standard WordPress loops and in situations (like the search page) where I'm overriding the standard WordPress query. Hence, the hacks with the global variables and the `setup_postdata()`. Can anyone recommend a better way to accomplish this goal? **UPDATE:** So, it seems like the way I'm constructing the custom loop isn't that bad after all. I'm still trying to figure out the feeds for these pages though. RSS is pretty new to me. Can anyone give me some pointers on generating these feeds?


title: How can you make it so the comment box shows on some pages or posts but not all?

text: Pseudo code might look like:               if it's this type of post         display comments and comment box     otherwise          forget it      This same type of code should also allow someone to have HTTP requests if it's some page, or some kind of page/post but not all of them.


title: Is database deleted on clicking "reinstall" button in Wordpress updates?

text: I have a blog made with WordPress. If I click "Re-install" button present in WordPress updates page, will all the database be dropped and created again? Will my posts be deleted?


title: Intercepting $_GET variable from custom pagination

text:
I have a custom pagination using a form with the get action so I can have a page jumper box. Everything works until you enter something that is not an actual page. Examples are negative numbers, text or a number greater than the actual number of pages. What I am trying to do is intercept the variable and redirect the page if the page doesn't exist. This is in my functions.php               add_action('init', 'k2wp_pagination');     function k2wp_pagination($k2url = '', $pages = '', $range = 2) {              $showitems = ($range * 2) + 1;              global $paged;              if(empty($paged)) $paged = 1;              if($pages == '') {             global $wp_query;             $pages = $wp_query->max_num_pages;             if(!$pages) {                 $pages = 1;             }         }              if(1 != $pages) {             echo '
';             echo '<form action="' . get_bloginfo('url') .'/'. $k2url . '" class="pagination-buttons" method="get">';             echo '
';             if($paged > 2 && $paged > $range + 1 && $showitems < $pages) echo '<button value="1" name="paged" class="btn">« First</button>';             if($paged > 1 && $showitems < $pages) echo '<button value="' . ($paged - 1) . '" name="paged" class="btn"></button>';                  for ($i=1; $i <= $pages; $i++) {                 if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems )) {                 echo ($paged == $i)? '<button value="' . $i . '" name="paged" class="btn disabled" disabled="disabled">' . $i . '</button>' : '<button value="' . $i . '" name="paged" class="btn">' . $i . '</button>';                 }             }                  if ($paged < $pages && $showitems < $pages) echo '<button value="' . ($paged + 1) . '" name="paged" class="btn"></button>';               if ($paged < $pages-1 && $paged + $range - 1 < $pages && $showitems < $pages) echo '<button value="' . $pages . '" name="paged" class="btn">Last »</button>';             echo '
';             echo '</form>';             echo '<form action="' . get_bloginfo('url') .'/'. $k2url . '" class="pagination-jump" method="get">';             echo '
Page <input alt="Enter page to which you wish to jump" name="paged" type="text" value="' . $paged . '" class="jumper"> of ' . $pages . ' <button class="btn">Go</button>
';             echo '</form>';             echo '
';         }     }


title: Wordpress JSON API remove posts from a specific category

text: I have installed Wordpress JSON APi plugin, the idea what I want to do is to retrieve all posts from a websites except a specific category for example with ID: 434. I need all posts except from this category. The query is like this example: www.example.com/?json=1&count=300 I have changed something in code but it removes the details of categories, not posts.               if ($category->id == 434 && $category->slug == 'archive') {     // Skip the 'archive' category     continue;             }      How it is possible, please help me!!!


title: wp_schedule_event - function won't execute

text: I use wp_schedule_event to have the function updatePostCounts() executed every hour. I also use the plugin "WP Crontrol" which shows me that the hook (opbs_update_counts) is there and is run every hour. But when the time is due nothing happens - updatePostCounts() isn't executed. Here's the code.               public function __construct()     {         $this->addActions();         register_deactivation_hook(__FILE__, array($this, 'deactivation'));     }     public function deactivation()     {         wp_clear_scheduled_hook('opbs_update_counts');     }               public function addActions()     {                if( !wp_next_scheduled('opbs_update_counts') )         {             wp_schedule_event(time(), 'hourly', 'opbs_update_counts');         }         add_action('opbs_update_counts', array('cronTaskUpdateCounts'));              add_action('init', array($this, 'action_init'));                  add_action('template_redirect', array($this, 'action_template_redirect'));          }              public function cronTaskUpdateCounts()     {          $this->updatePostsCounts();     }      what could be the problem?


title: How to implement a custom sliding banner?

text: I need to make a custom slider with images (same images on all pages) in a template I am crafting for a client. Each of the slides could have a link to one of the pages. How and where should I store images, so the client will have no problem adding them or changing links?


title: How to enqueue javascript for WP Customize options sidebar?

text: I'm trying to add Chosen.jquery to the WP Customize options panel, so I can have an autocomplete box there. Is there any way I can do that? I tried with **admin_init** , **admin_footer** and **admin_print_footer_scripts** actions, but none seems to work inside of the Customizer. Any thoughts?


title: Get Page URI for QR Code PHP

text: I'm using the QR Code Tag plugin and can't get this to work.               <img src="<?php      global $qrcodetag;      echo $qrcodetag->getQrCodeUrl('$_SERVER['PHP_SELF']',100,'UTF-8','L',4,0);      ?>">      I want a qr barcode to get the current url of the category or page or post in my theme.


title: 3.1.3 auto-upgrade

text: Any ideas on this? I earlier got an error on some update directory, and manually deleted it (unfortunately I didn't write it down). I think I've done auto-upgrades on the same domain before.               Downloading update from http://wordpress.org/wordpress-3.1.3.zip…          Unpacking the update…          Warning: copy(/home/nwalters/public_html/wp-admin/includes/update-core.php) [function.copy]: failed to open stream: Permission denied in /home/myname/public_html/wp-admin/includes/class-wp-filesystem-direct.php on line 200          Could not copy files.          Installation Failed


title: Events Plugin that works with existing categories?

text: I have a series of categories on my website that are fixed, i.e. The client has specifically asked that I leave them. Now however, they would like me to add an events plugin so they are able to add events. Every plugin I've found insists that you create your own event specific categories, thus losing the permalinks structure and the menu structure that is already in place. If I wanted to add an event to Category 1 because it's subject matter is related to Category 1, then I can't. Does anyone know of a way to either modify an existing events plugin to this purpose, or of a plugin that already implements it?


title: What is the parameter : 'Customs-fields'

text: I don't understand how to use customs-field on register_post_type. On Codex, for "build" an register post, there is a parameter "support" that is an array with 'customs-field" . Can you explain with example if is possible ? http://codex.wordpress.org/Function_Reference/register_post_type Thanks a lot


title: Sort admin area by custom Event Date field

text: There are several questions in here about sorting custom items in the admin section. However, I cannot find a specific answer anywhere. Here's my specific problem: I'm using MagicFields to create several fields related to Events (each post is an "event" or concert). One of those fields is the event date. I want to 1) display the event date in the admin Event write panel as a separate column and 2) automatically sort that column ascending. So far, I've registered the column, displayed it, and have registered it as sortable. Here's my code which is pasted in the functions.php file:               // Register a new column in the admin Post area     function event_date_column_register( $columns ) {     $columns['event_date'] = __( 'Event Date', 'my-plugin' );     return $columns;     }     add_filter('manage_edit-post_columns', 'event_date_column_register');          // Display the column content     function event_date_column_display( $column_name, $post_id ) {     if ( 'event_date' != $column_name )         return;          $event_date = get('date_of_event');          echo $event_date;     }     add_action( 'manage_posts_custom_column', 'event_date_column_display', 10, 2 );               // Register the column as sortable     function event_date_column_register_sortable( $columns ) {     $columns['event_date'] = 'event_date';          return $columns;     }     add_filter( 'manage_edit-post_sortable_columns', 'event_date_column_register_sortable' );               function event_date_column_orderby( $vars ) {     if ( isset( $vars['orderby'] ) && 'event_date' == $vars['orderby'] ) {         $vars = array_merge( $vars, array(             'meta_key' => 'event_date',             'orderby' => 'meta_value_num'         ) );     }          return $vars;     }     add_filter( 'request', 'event_date_column_orderby' );      So, "Events" appear in the post management area as shown below - but when I try to sort by that field, all of my posts disappear. Image Here I know that I need to convert my date to the long unix time (`strtotime();`) prior to sorting, but where and how? According to the comment thread here (search for "works like a charm"), you can write some long query, but I don't know if it's correct, where to past that query, or anything else. I'm a newbie - so thanks in advance for the help and sorry if I'm not being thorough enough.


title: the_post() in RSS feed

text: I'm got an issue here that's stumping me. I'm trying to create a custom RSS feed using `add_feed()`. The feed seems to have been created successfully, but I'm quite stuck on some bug in the feed template I'm writing. For some reason, in my code, `the_post()` seems to return nothing inside the loop. (I've verified this by using `print_r`). I just don't have access to the typical post-related information that I'd expect. Even stranger: `get_defined_vars()` outputs nothing inside the template as well. I wrote up a test script to hosted on another vhost on the same physical machine to verify that PHP is configured correctly, and it seems to be. Stranger still: despite all of the above, my `<item>`s aren't coming through blank. _Some_ of the wordpress functions seem to work - just not all of them :/ As a reference, here's the entire template file I'm working on. It's very minimal, but based off of the `wp-includes/feed-rss2.php` file: View it on pastebin. (Sorry, tried to put it here, but the formatter was getting pretty confused by it.) Any help is tremendously appreciated. I'm stumped!


title: Display only posts with comments

text:
I have this code to show recent posts from one category. I need to show only the posts which have comments. How can i do that via shortcode?               /* Shortcode to output recent posts from one category */          function display_cat_recent_posts() {     $args = array(     'post_type' => 'post',     'posts_per_page'=> 5,     'cat'=> 10,     );     $cat_recent_posts = new WP_Query( $args );     if( $cat_recent_posts->have_posts() ):     $output = '
';     while ( $cat_recent_posts->have_posts() ) : $cat_recent_posts->the_post();     $output .= '
' . get_the_title() . '
';     endwhile;     $output .= '
';     endif;     return $output;     wp_reset_postdata();     }     add_shortcode( 'recent-posts', 'display_cat_recent_posts' );      Thank you...


title: User specific content (posts) / limiting visibility

text: I need some help. My wife teaches french, and I would like to set up website for her. The problem is I don't know so much about wordpress and googling did not help as well. I know how to make simple wordpress site, but how do I make something like intranet. I mean that every one of her students would have there own simple page, so she can put their homework and so on. Can someone please point me to the right direction. Some tutorials or plugins, so I could dig into it. * * * ## Update: I will try to explain more, because I think I'm doing it wrong way. So basically now, when some student logs in, he can see a new link (homework - for example), and when he clicks on it, he sees what he needs to do and read. But this info must be specific to him, cuz she teaches students individually. So I want to have one page, where loop displays posts that are intended only for logged in user. Yesterday I tried "user specific content", it works ok, but it shows headlines of all posts. Only the text is hidden. (I mean I can still see all posts, but I can just read the ones that are assigned to me). So guys, any advice? Should I sort posts with loop? (can some plug in help me, because I'm just a novice in php).


title: Make future posts visible to the public—not just within WP_Query

text: I know I can publicly show future posts in a loop using `'post_status' => 'future'` in WP_Query. But clicking on a future post's permalink will result in a 404 if you are not a logged-in user. Suppose I have a post called Apocalypse in the post_type 'event', scheduled for 12-12-2099. The permalink is _mysite.com/event/apocalypse_. Is it possible to make _mysite.com/event/apocalypse_ and other future 'event' posts visitable **now** by the public? Ideally I'd be able to restrict future post availability to the 'event' post type, but I would settle for a solution that makes all future posts available regardless of post_type.


title: Is there a way to integrate WordPress within an existing PHP Framework, CMS, and Navigation system?

text: I am the senior developer of a modular PHP Framework system which provides my customers with a Content Management System (CMS), ECommerce system, and a variety of other modules (slideshows, testimonials, forms, FAQs, etc etc) My framework handles all URLs on the site via an existing `.htaccess` file and dispatches those URLs to the appropriate module. One feature of this framework that is very important to the users is the fact that the framework handles the generation of the entire page strutter including navigation, **providing a consistent look, feel, and navigation from page to page**. It is very important that we keep this. A number of my customers have requested we add a WordPress module. Is it possible to integrate or "embed" WordPress within an existing PHP Framework and navigation template, so that the WordPress engine parses the URL and performs all approbate actions as it normally would, but outputs only the HTML content for the body of the site, allowing my framework to handle the "template" HTML? FYI, I am an expert in PHP, but have barely touched WordPress. PHP-heavy answers don't frighten me at all (and in fact would be appreciated, if applicable)


title: On WordPress Network(multisite), Sub Blogs in Subdirectories or Subdomains? What's better?

text: Can anyone explain why one is better than the other, and in what circumstances? Things I'm considering: SEO consequences (if any), scaling issues (if any) and anything else I'm not thinking about. Facebook, for example, uses subdirectories for profile pages. Tumblr uses subdomains. Are there specific reasons why? Another consideration: domain mapping. Hope the question isn't too general, but I haven't found a clear answer. Thx.


title: A link to a page including an anchor doesn't go to that anchor - URL gets changed

text: My WordPress site is set up with "Post name" permalinks. Now I created an anchor in every page at a certain place: But I find that when I try to link to that page, and its anchor, like this: http://example.com/mypost#my_anchor .. it doesn't work. The URL gets converted on the fly to: http://example.com/mypost/#my_anchor ... so the link never goes to the correct part of the page. Anyone know what I'm doing wrong - how to correct this? (Note: I did see a very similar question where someone had this a problem after they put an _extra_ slash on the end, _after_ the anchor part, but I'm _not_ doing that.) Thanks. PS It doesn't work if I use a div with an id instead of the anchor, either.


I'm trying to set-up pretty permalinks for my site. WordPress has a warning that my htaccess files is not writable. It provided some code to copy and put in the htaccess file. I'm on a Mac, my local machine running WordPress 3.1.1. I coped the code WP provided and pasted it into a new new TextEdit file that I named 1.htaccess . I put the file in the root directory Sites/mysite/. Then I tried to re-name the file and remove the "1", but my Mac gave a warning that files starting with "." are system files and wouldn't let me re-name it. How can I make an htaccess file on a Mac? Thank you. -Laxmidi


title: How can I redirect user after entering wrong password?

text: I'm using `[wp_login_form()][1]` to display login form in a jQuery dialog window. If user enters wrong password, the user is taken to the backend. I don't want that. Is there a way to notify user that he entered wrong password and still remain on the same page? Before `wp_login_form()` came I was using a plugin. I'm kind of hoping I can avoid using a plugin for this. My code:               wp_login_form(array(       'label_remember' => __( 'Remember me' ),       'label_log_in' => __( 'Login' )     ));


title: get_posts not working on homepage?

text: I have a simple custom shortcode plugin where you give it a tag and it'll display the titles of all the posts with that tag. e.g. In my post if I type "[listposts tag=oct-2011]" it will output the titles of all posts tagged as "oct-2011". This plugin has been working fine for me until the v3.2 upgrade. Now, it still works fine when the post which uses the shortcode is viewed on its own. But when that post is viewed on the homepage, the get_posts() query returns 0 results. What do I need to do to fix the plugin? Here is the relevant code:               function listposts($atts) {         $atts = shortcode_atts(             array(                 'tag' = 'jan-2011',                 'numberposts' = '-1',                 'orderby' = 'post_date',                 'order' = 'asc',                 'post_status' = 'any' ),             $atts);              $catposts = get_posts($atts);         $out = '';         foreach ($catposts as $single) {             $out .= $single->post_title;         }              return $out;     }


title: Default Gravatar not showing for pings

text:
Here is my comments block:
         <?php if (have_comments()) : ?>
<?php printf(_n('1 comment', '%1$s comments', get_comments_number()), number_format_i18n( get_comments_number() ), '' ); ?>

                      <?php $comments_by_type = &separate_comments($comments); ?>                 <?php if ( !empty($comments_by_type['comment']) ) : ?>
                     <?php wp_list_comments(array('callback' => 'commentslist', 'type' => 'comment')); ?>
                 <?php endif; ?>                      <?php if ( ! empty($comments_by_type['pings']) ) : ?>
Pingbacks/Trackbacks

                 <?php wp_list_comments(array('callback' => 'commentslist', 'type' => 'pings')); ?>
                 <?php endif; ?>
         <?php endif; // end have_comments() ?>
      Here is my `wp_list_comments` callback:               function commentslist($comment, $args, $depth) {         $GLOBALS['comment'] = $comment;             require_once(ABSPATH . WPINC . '/registration.php');             if ($comment->user_id || email_exists($comment->comment_author_email)){                 //comment by registered user                 $avatar = '/images/bird_comments_big.png';                 }else{                 //comment by none registered user                 $avatar = '/images/bird_comments_pink.png';                 }             ?>
             <div id="comment-<?php comment_ID(); ?>" <?php comment_class(); ?>>

                                                      <?php echo get_avatar($comment, 70, get_bloginfo('template_url').$avatar); ?>
                                 <?php printf(__('
%s says:
'), get_comment_author_link()) ?>                                 <?php printf(__('
%s
'), get_comment_date('M j, Y')) ?>                                 <?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>

                                 <?php if ($comment->comment_approved == '0') : ?>
<?php _e('Your comment is awaiting moderation.') ?>

                                 <?php endif; ?>                                 <?php comment_text() ?>

     <?php     }      It seems to that wp_gravatar should call up the non-registered user image due to a lack of an e-mail address for pings, but instead its returning nothing.


title: WordPress keep redirecting me to random URLs

text: When I go to my homepage, http://example.com, I _sometimes_ get redirected to http://example.com/SXKSLW/ or some other random URL along that pattern that yields 404 page. I do not remember doing anything special. Tried to disable most of the plugins (except the ones that are installed after the issue has been noticed) with no avails. This issue also observed when I am at wp-admin, rendering the url to example [.] com/SJDKEW/wp-admin/... ---> obviously to another 404. Any inputs are welcomed. Thank you


title: Custom Taxonomy term archive template

text: Is it possible to have separate archive templates for custom taxonomies? Like this: Tax(categories) -Players(category) -Managers(category)


title: how to test for attached image

text: I am trying to find out whether or not a post has images. If it does, I then want to know if a featured image was specified for the thumbnail - if not, the get_thumb() function will assign an image from the gallery of that post. However, if a post doesn't have images, I want to use a span class to occupy the thumbnail space. Here's the statement I wrote:               if(has_post_thumbnail()){         the_post_thumbnail();     }     elseif(is_attachment()) {         echo get_thumb($post->ID);      }     else {              }       It adds a 150x150 span to all posts without featured images. However, where images from get_thumb() should be, the span shows up instead. Essentially, it's either the span or the featured image and the $get_thumb never appears. For reference, here's the get_thumb() function:               function get_thumb ($post_ID){         $thumbargs = array(         'post_type' => 'attachment',         'numberposts' => 1,         'post_status' => null,         'post_parent' => $post_ID         );         $thumb = get_posts($thumbargs);         if ($thumb) {             return wp_get_attachment_image($thumb[0]->ID);         }     }


title: Add Word Limit to Posts

text: Is there a way to limit the number of words per post through the the_content() function or something similar?


title: How to put page numbers with the next/previous on a post/category list?

text: Is there a way to add numbering to the latest posts/category listing pages? By default you can put older/newer, but is there a way to add numbering like page 1,2,3,4 of the list so people can skip ahead?


title: Multiple single templates?

text: Lets say i have a custom post type called 'event' that has several custom meta boxes for images, docs, etc.. Would it be possible to have two different single templates? For example: i have a page that lists all events and if i click on an event, the single view shows me all the meta-info i put in event-single.php template. now i want to have a different page that again lists all events, but if i click to view the single event, a different template is used, so i can show other meta-data connected with the event. Or better:               page-events.php lists all events -> click on event -> shows single-event.php          page-media.php lists all events -> click on event -> shows single-event-whatever.php      Is this possible with WordPress?


title: How can I change the prev / next buttons text to Dutch?

text:
If you look to this page everything is alright except the previous and next buttons text are in English. Does anyone know how I can make them display in Dutch? I already tried to change them but no luck. **NB:** I'm using Contango theme. The function looks like this :               /** Contango Link Pages */     function contango_link_pages() {          $contango_options = contango_get_settings();         if( $contango_options['contango_post_style'] != 'excerpt' ) {                  return wp_link_pages( array(                       'before' => '
'. __( 'Pages:', 'contango' ) .'',                 'after' => '
',                 'link_before' => '',                 'link_after' => '',                             'echo' => 0                      )             );              }     }


title: How to call a FB function from an admin bar action?

text: I am using FaceBook's SDK inside of my wordpress application. I need to set up the application so when a user clicks log-out on the admin bar, it will fire facebook's log-out function. in order to use FB's log-out you need to initialize the SDK, then simply call it.               //initialize java script sdk     <script>         //sdk code     </script>          //call log-out function     FB.Logout();      the admin bar is dynamically loaded so it's a bit confusing to me where I should be putting my code. I've looked into 'admin-bar.php' but i cannot figure out where to put the code. How do I call a FB function from the admin bar action "log-out"? Anyone able to shed some light on this situation?


title: How to set file type in wp_handle_upload?

text: I'm using `wp_handle_upload` to allow users upload `.csv` files in the front end and it's working fine. I was wondering how can I limit this to only allow `.csv` files though since currently it accepts a wide variety of file types. According to the doc this should be possible by overriding the `$overrides` param but I'm not sure what should I pass it to do so. Thanks in advance!


title: How to make a second query offset -2 from current post

text: I would like a second `WP_Query` on a custom post type's single page to return 5 posts, starting with two before the current post, so that I get this:   1. The-one-before-the-previous post   2. Previous post   3. Current post   4. Next post   5. The-one-after-the-next post How can I do this? `offset` is only good if I know the number of the current post. In pseudo-code it's easy:               $gallery = new WP_Query(array(         'post_type' => 'artwork',         'posts_per_page' => 5,         'fake-offset' => $current->ID-2 //This is imaginary     ));      Thanks in advance!


title: Paging on a future post loop?

text:
I am trying to get paging to work on my future post loop, but to no avail. I am getting no links, when I expect them at the bottom, for pagination despite there being several valid posts in the database.               <?php     $args = array(          'post_type' => 'program',         'paged' => get_query_var('paged') ? get_query_var('paged') : 1,         'posts_per_page' => 1,         'post_status' => "future",         'order_by' => 'date',         'order' => 'ASC'     );     $program = new WP_Query;     $program->query( $args );                    if($program->have_posts()): while($program->have_posts()): $program->the_post(); ?>          //The content loop     <?php endwhile; ?>
<?php previous_posts_link('« Previous'); ?>

<?php next_posts_link('More »'); ?>
     <?php endif; ?>      <?php wp_reset_query(); ?>      * * * **Update** _Further Info_ I have established that $program->max_num_pages always displays the correct number of pages, so using the `offset` argument for `WP_Query`, I have been able to roll my own paging. But this seems like it's asking for trouble!! * * * **Update** _Further Info_ I have taken the rather drastic step of extending the WP_Query object. This is really over the top, but I have to make this work:               class MF_Query extends WP_Query{         function __construct(array $args){             if(!array_key_exists('posts_per_page',$args)) $args['posts_per_page'] = 10;                  $args['offset'] = (isset($_GET['page'])?($_GET['page']-1)*$args['posts_per_page']:0);             parent::query($args);         }              function mf_next_page($link_text = "Next"){                      $curPage = intval((isset($_GET['page'])?$_GET['page']:1));//Use 1 if $_GET['page'] not set                      $link = "<a href='".remove_post_vars(curPageURL());                      if($curPage<$this->max_num_pages){                     return $link.constructQuery($this->merge(array("page"=>$curPage+1),$_GET))."'>".$link_text."";                 } else {                     return false;                 }                   }         function mf_prev_page($link_text = "Prev"){                      $curPage = (isset($_GET['page'])?$_GET['page']:1);//Use 1 if $_GET['page'] not set                 $link = "1){                     return $link.$this->constructQuery($this->merge(array("page"=>$curPage-1),$_GET))."'>$link_text";                 } else {                     return false;                 }                   }         private function constructQuery(array $query){                       $url_ext = "?";             foreach($query as $k => $v){                 $url_ext .=$k."=".$v."&";             }             $url_ext = substr($url_ext, 0, -5);//chop last ampersand off                       return $url_ext;              }         private function merge($get, $put){             //Get values from one array, and put them in another (overriding existing values if appropriate)             foreach ($get as $k => $v){                     $put[$k]=$v;             }              return $put;              }               }


title: Is this the correct way to add post-slug input field?

text: I added slug input field in my custom post type and allow users to edit it at front end. Then, when insert post, I use this:               $wp_insert_post_args = array(                 'post_status'   => 'publish',                 'post_type' => MY_POST_TYPE,                 'post_author'   => $this->creator_id,                 'post_title'    => $this->name                 'post_name'     => sanitize_title( $this->slug )                  );      My custom post type already suports 'title', so, it suppose to auto generate post_name. Now I add $slug as 'post_name' as described above, **will woredpress use 'title' to generate 'post_name', or use my 'slug'?** will wordpress perform slug exist checking as it does on normal posts, or should I take care of the checking myself?


title: Duplicate and change a Theme Widget

text: Is there a way (a common one) to duplicate and change a theme widget ? I'm asking this because, I have this widget that displays the recent news and if we click, it will display ALL news, but I wish to create a new widget that lists the latest articles (posts with a category "articles"), and if we click, that lists ALL articles. Is there any widget like this that someone knows about ? If not, where should I look at in order to duplicate and change a theme widget ? Thanks a lot


title: img width and height attributes being set by get_the_post_thumbnail

text: I'm working on a custom theme that I've inherited to maintain. At the top of the homepage there is a header area with some images generated by `get_the_post_thumbnail`. The call to `get_the_post_thumbnail` outputs img objects that are set to a specific width/height by their html attributes. Here's the code and output: **Inside a loop**               <?php echo get_the_post_thumbnail( $id, array( 300, 300 ) ); ?>      **Html output**               <img width="215" height="93" src="[img filepath]" class="attachment-300x300 wp-post-image" alt="[img name]" title="[img name]">      I need to reset the attribute height and width dimensions to something other than _215 x 93_. I can't find anywhere this is being set (checked in **wp- admin** as well as **functions.php** as well as anywhere else where I thought it might be). I am also not finding any places where `set_post_thumbnail_size` is being called with these values. Can anyone tell me where to reset these values? Thanks.


title: How do I set the link in the Custom Post Type admin menu?

text: I'm trying to create a custom button and link it to a file within the plugin. **How do I get this link pointing to the path of my choice?** ![Download Donors should point to the link I choose](http://i.stack.imgur.com/McxyC.png) I've tried the following but it does now work.               function _pfund_register_types() {         $pfund_options = get_option( 'pfund_options' );         $template_def = array(             'public' => true,             'query_var' => 'pfund_cause',             'rewrite' => array(                 'slug' => $pfund_options['cause_slug'],                 'with_front' => false,             ),             'hierarchical' => true,             'label' => __( 'Causes', 'pfund' ),             'labels' => array(                 'name' => __( 'Causes', 'pfund' ),                 'singular_name' => __( 'Cause', 'pfund' ),                 'add_new' => __( 'Add New Cause', 'pfund' ),                 'add_new_item' => __( 'Add New Cause', 'pfund' ),                 'edit_item' => __( 'Edit Cause', 'pfund' ),                 'view_item' => __( 'View Cause', 'pfund' ),                 'search_items' => __( 'Search Causes', 'pfund' ),                 'not_found' => __( 'No Causes Found', 'pfund' ),                 'not_found_in_trash' => __( 'No Causes Found In Trash', 'pfund' ),             )         );         register_post_type( 'pfund_cause', $template_def );         register_post_type( 'pfund_cause_list' );              $campaign_def = array(             'public' => true,             'query_var' => 'pfund_campaign',             'rewrite' => array(                 'slug' => $pfund_options['campaign_slug'],                 'with_front' => false             ),             'hierarchical' => true,             'label' => __( 'Campaigns', 'pfund' ),             'labels' => array(                 'name' => __( 'Campaigns', 'pfund' ),                 'singular_name' => __( 'Campaign', 'pfund' ),                 'add_new' => __( 'Add New Campaign', 'pfund' ),                 'add_new_item' => __( 'Add New Campaign', 'pfund' ),                 'download_donors' => __( 'Download Donors', 'pfund' ),                 'all_items' => __( 'Download Donors', 'pfund' ),                 'edit_item' => __( 'Edit Campaign', 'pfund' ),                 'view_item' => __( 'View Campaign', 'pfund' ),                 'search_items' => __( 'Search Campaigns', 'pfund' ),                 'not_found' => __( 'No Campaigns Found', 'pfund' ),                 'not_found_in_trash' => __( 'No Campaigns Found In Trash', 'pfund' ),             ),             'supports' => array(                 'title'             ),             'capabilities' => array(                 'edit_post' => 'edit_campaign'             ),             'map_meta_cap' => true         );         register_post_type( 'pfund_campaign', $campaign_def );         register_post_type( 'pfund_campaign_list' );     }      Notice the lines               'download_donors' => __( 'Download Donors', 'pfund' ),             'all_items' => __( 'Download Donors', 'pfund' ),      The 'download_donors' label doesn't work. I have to use the 'all_items'. Not sure why this is but when I try to add the filter it doesn't get overwritten. Instead the link points to _`wp-admin/edit.php?post_type=pfund_campaign`_               add_filter('post_row_actions','all_items', 10, 2);          function download_donors($actions, $post){         //check for your post type         if ($post->post_type =="pfund_campaign"){             //remove the default edit             unset($actions['edit']);             //set new action             $actions['download_donors'] = 'Download Donors';         }         return $actions;     }


title: How do I create a page that displays the homepage?

text: sorry for the somewhat odd question. I need to create a wordpress page that basically just displays the / page. How would i go about doing such a thing? The homepage itself isn't either a post or a page. I need it to be a page to run a script on it (can't be done through the editor either) This is a tad hard to explain.... any help would be appreciated...


title: Include content from one page to another

text: I'd like to include content from one Page (named "contact_text") to another Page in a specific spot (both of these are WordPress admin pages). I've followed this Stack Overflow thread. However I don't believe I can call a PHP function inside a WP Page, much less at the spot I'd like it to appear. Do I need to set up a shortcode for that function in order to use it?


title: Custom post type draft use wrong template

text: I have a custom post type called `agenda` with a custom post template called `single-agenda.php`. When I have a draft of an `agenda` post, this uses the content in the template `single.php`. When I publish it's ok, it uses the content in `single- agenda.php`. I would like to see my draft content in `single-agenda.php`, how can I do that?


title: WordPress Theme Preview Image

text: I'm developing a custom WordPress theme. When I go to select themes in the Appearance menu, my theme does not have a preview image. Is there something I need to do to get a preview image to show up? I can't find any resources on the web that talk about this. Maybe I'm just searching the wrong thing though...?


title: How to set default values for edit_post_link() in my theme?

text: How do I set default values for the `edit_post_link` function in my theme? I'd like to change the 'Edit This' string to a custom value, but specify this only once, so I can use instead of everywhere. Is this even possible?


title: Installing plugins on installation/activation

text: Is it possible to install extra plugins on certain plugin installation/activation? I tried to install them using:               $upgrader = new Plugin_Upgrader();      $upgrader->install(...)      But it's not working. Any suggestions? Thanks in advance!


title: Two Custom Post Types, Share Two Taxonomies

text: I have two custom post types   * Hotels    * Things to do And I have two taxonomies   * Activities    * Regions So when a user sees a **Hotel** (custom post): the user can then see   * the region it's in    * what activities they can do.  _And viceversa as well_ When the user sees **Things To Do** , he can see in which **Region** it is and what **Hotels** have the same type of **Activity** nearby. The problem if I use two custom post type and create a taxonomy for it, I have no way of discerning each taxonomy related to a custom post: > Example: **Hotels** in X **Region** I would get both the **Hotels** and **Things to do** custom post, within that taxonomy. * * * It's basically the same issue as this question (which doesn't have any great answer).


title: RSS dashboard widget not showing visuals

text: I am using a RSS feeds widget on my dashboard as shown in this Q&A. Problem is feeds doesn't show up any visual like images or videos. I verified this by looking raw feeds which I used. Here is a snapshot of my feed dashboard widget:   ![image](http://i.stack.imgur.com/kFsTQ.jpg). How can I get visuals or is this the way WordPress shows data?


title: Top toolbar is not showing in wordpress admin panel

text: Today I came over a very interesting and confusing problem. I developed a wordpress website in my localhost and it run perfectly. But when I moved that site in my server I saw a strange thing. When I logged in my admin panel (..wp-admin/index.php) my toolbar isn't showing up and any widgets that were showing fine in the dashboard in my localhost are gone! And also the screen option and help buttons aren't working. And when I hover over my menu items in the admin menu section sub menus were shown in my localhost, but here nothing. but everything works fine when i'm not in the index.php page. any idea from the experts?


title: How to display images that was uploaded in the media gallery and not by the current post?

text: I have uploaded images before in my other posts and now I want to display it in my Photo Gallery. I'm using an isotope layout so I'm not using the native gallery of WordPress. It's working just fine however I can't display the images that is not uploaded directly to that post. For example the images that I've uploaded before. If I upload a new one to this current post, then that will display. Here's my code:                       // DISPLAY ALL IMAGES FROM A PARENT GALLERY             $attachments = get_children(array('post_parent' => $post->ID,               'post_status' => 'inherit',               'post_type' => 'attachment',               'post_mime_type' => 'image',               'order' => 'ASC',               'orderby' => 'menu_order ID'));             foreach($attachments as $att_id => $attachment) {      So how can I display those past images in my gallery?


title: Using Conditional Statement in functions.php

text: I've got this code below in my `functions.php` and I'd like to add two filters with conditional statement not to effect every query_posts. Something like this               if(!is_admin() && is_page('Home')){ //two filters }      However, I don't know PHP well enough to know where to put it or how to use the `<?php>` tags. Can anyone advise? It is from this thread that was closed in WP Forums.               add_filter('posts_orderby', 'edit_posts_orderby');     add_filter('posts_join_paged','edit_posts_join_paged');          function edit_posts_join_paged($join_paged_statement) {         global $wpdb;         $join_paged_statement = "LEFT JOIN ".$wpdb->prefix."wpv_voting ON ".$wpdb->prefix."wpv_voting.post_id = $wpdb->posts.ID";         return $join_paged_statement;     }          function edit_posts_orderby($orderby_statement) {         global $wpdb;         $orderby_statement = "(".$wpdb->prefix."wpv_voting.vote_count) DESC";         return $orderby_statement;     }