title: Styling Admin comments in WP 3.1.3

text:
There's a lot of documentation on how to style 'autor' or 'admin' comments in WP, but most of it seems wildly outdated. I have a client for whom I am developing a Q&A site. I always figure it's best to use whatever tools Wordpress has already provided me with. That's why I decided to set up a form which pushes all "questions" to a custom post type. Which my client can then read and comment on with his answer. The only problem I've run into is that I need to style his comments in a couple ways. They need to stand out. This is easy enough to achieve really, as WP now dynamically generates a class for each authors comments. So I just wrote a little CSS for that:               .comment-author-myClient {     background-color: #bcd1f7;     padding: 10px;     border: 1px dotted black;     }      That did the job of making his comments look different. But it's still not quite enough. I really want to edit his specific comment template. Instead of it saying something like 'user says:" I want it to say "myClient's Answer:" I would also like for his comments to -always- remain at the top. Now, that shouldn't ever really become an issue, as standard WP comments are displayed in ASC format, so as long as is the first to comment (which he should always be) his comment should always be at the top. But, I just want to be safe. Additionally, I would like for his comment to appear before: X responses to "post-title": Just to make it easy for everyone who is going to try and help me.. Here is the twentyten comments.php file:               <?php     /**      * The template for displaying Comments.      *      * The area of the page that contains both current comments      * and the comment form.  The actual display of comments is      * handled by a callback to twentyten_comment which is      * located in the functions.php file.      *      * @package WordPress      * @subpackage Twenty_Ten      * @since Twenty Ten 1.0      */     ?>
     <?php if ( post_password_required() ) : ?>
<?php _e( 'This post is password protected. Enter the password to view any comments.', 'twentyten' ); ?>

     <?php             /* Stop the rest of comments.php from being processed,              * but don't kill the script entirely -- we still have              * to fully load the template.              */             return;         endif;     ?>          <?php         // You can start editing here -- including this comment!     ?>          <?php if ( have_comments() ) : ?>
<?php                 printf( _n( 'One Response to %2$s', '%1$s Responses to %2$s', get_comments_number(), 'twentyten' ),                 number_format_i18n( get_comments_number() ), '' . get_the_title() . '' );                 ?>
          <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>

<?php previous_comments_link( __( '← Older Comments', 'twentyten' ) ); ?>

<?php next_comments_link( __( 'Newer Comments →', 'twentyten' ) ); ?>

      <?php endif; // check for comment navigation ?>
                     <?php                         /* Loop through and list the comments. Tell wp_list_comments()                          * to use twentyten_comment() to format the comments.                          * If you want to overload this in a child theme then you can                          * define twentyten_comment() and that will be used instead.                          * See twentyten_comment() in twentyten/functions.php for more.                          */                         wp_list_comments( array( 'callback' => 'twentyten_comment' ) );                     ?>
          <?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : // Are there comments to navigate through? ?>

<?php previous_comments_link( __( '← Older Comments', 'twentyten' ) ); ?>

<?php next_comments_link( __( 'Newer Comments →', 'twentyten' ) ); ?>

     <?php endif; // check for comment navigation ?>          <?php else : // or, if we don't have comments:              /* If there are no comments and comments are closed,          * let's leave a little note, shall we?          */         if ( ! comments_open() ) :     ?>
<?php _e( 'Comments are closed.', 'twentyten' ); ?>
     <?php endif; // end ! comments_open() ?>          <?php endif; // end have_comments() ?>          <?php comment_form(); ?>
      And here is the part of functions.php that it refers to:               if ( ! function_exists( 'twentyten_comment' ) ) :     /**      * Template for comments and pingbacks.      *      * To override this walker in a child theme without modifying the comments template      * simply create your own twentyten_comment(), and that function will be used instead.      *      * Used as a callback by wp_list_comments() for displaying the comments.      *      * @since Twenty Ten 1.0      */     function twentyten_comment( $comment, $args, $depth ) {         $GLOBALS['comment'] = $comment;         switch ( $comment->comment_type ) :             case '' :         ?>         <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">             <div id="comment-<?php comment_ID(); ?>">
                 <?php echo get_avatar( $comment, 40 ); ?>                 <?php printf( __( '%s says:', 'twentyten' ), sprintf( '%s', get_comment_author_link() ) ); ?>
             <?php if ( $comment->comment_approved == '0' ) : ?>                 <?php _e( 'Your comment is awaiting moderation.', 'twentyten' ); ?>
             <?php endif; ?>
<a href="<?php echo esc_url( get_comment_link( $comment->comment_ID ) ); ?>">                 <?php                     /* translators: 1: date, 2: time */                     printf( __( '%1$s at %2$s', 'twentyten' ), get_comment_date(),  get_comment_time() ); ?><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' );                 ?>

<?php comment_text(); ?>

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

              <?php                 break;             case 'pingback'  :             case 'trackback' :         ?>

<?php _e( 'Pingback:', 'twentyten' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( '(Edit)', 'twentyten' ), ' ' ); ?>
         <?php                 break;         endswitch;     }     endif;      All the documentation I have found thus far on modifying admin comments has been from a previous version of WP and Twentyten, where the comments loop is all stored in comments.php, and has a much different format. So any help with the goals I am trying to achieve here would be very, very appreciated. TIA


title: Toolbar Hidden in a Virtual Page

text:
I am trying to create a virtual page, but my admin toolbar is not showing up. This is how I am creating the virtual page: ### functions.php               add_action('init', function()     {         add_rewrite_rule('register$', 'index.php?virtualpage=1', 'top');     });          add_filter('query_vars', function($query_vars)     {         $query_vars[] = 'virtualpage';         return $query_vars;     });          add_action( 'parse_request', function(&$wp)     {         if (array_key_exists('virtualpage', $wp->query_vars))         {             switch ($wp->query_vars['virtualpage'])             {                 case '1': include 'page-register.php';             }             exit();         }         return;     });      ### page-register.php               <?php     add_filter('wp_title', function($title, $sep, $seplocation) { return 'Register'; }, 10, 2);          get_header();     get_template_part('includes/breadcrumbs');     get_template_part('includes/top_info');     ?>

                  <?php             $form = new Zebra_Form('form');             $form->add('label', 'label_email', 'email', 'Email');             $form->add('text', 'email', '', array('autocomplete' => 'off'));             $form->add('submit', 'btnsubmit', 'Submit');             $form->render();             ?>

      <?php get_footer();      What am I doing wrong? ### Solution Based on the response, I attached a function to the 'template_redirect' action instead of the 'parse_request' action as follows:               add_action('template_redirect', function()     {         global $wp;              if (array_key_exists('virtualpage', $wp->query_vars))         {             switch ($wp->query_vars['virtualpage'])             {                 case '1': include 'page-register.php';             }             exit();         }         return;     });


title: What action is called when drafts are saved?

text: I would like to add a metadata field to the current post based on a checkbox in a custom meta box to be able to toggle my custom plugin on a post by post basis. For this I coded the following things   1. generate a meta box on the new post and new page page   2. handle the value of the checkbox in the meta box and set the metadata of the post or page accordingly I succeded in 1. but I have problems with number 2. I have the following code to handle the setting of the metadata: ### Update metadata depending on value of checkbox in meta box               // register action     add_action( 'save_post', 'cl_save_postdata');     /* When the post is saved, saves our custom data */          function cl_save_postdata( $post_id ) {       // check if $post_id is just a revision id and if so get the parent id       if($parent_id = wp_is_post_revision($post_id)){         $post_id = $parent_id;       }         // verify this came from the our screen and with proper authorization,       // because save_post can be triggered at other times            if ( !wp_verify_nonce( EMU2_I18N_DOMAIN, plugin_basename(__FILE__) ) )           return $post_id;       // verify if this is an auto save routine.        // If it is our form has not been submitted, so we dont want to do anything       if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )            return $post_id;            // Check permissions       if ( 'page' == $_POST['post_type'] ) {         if ( !current_user_can( 'edit_page', $post_id ) )             return $post_id;       } else {         if ( !current_user_can( 'edit_post', $post_id ) )             return $post_id;       }            // OK, we're authenticated: we need to find and save the data            if ($_POST['cl-activated']) {          add_post_meta( $post_id, 'cl-activated', true, true) or update_post_meta( $post_id, 'cl-activated', true);       } elseif (get_post_meta ($post_id, 'cl-activated', true)) {         delete_post_meta( $post_id, 'cl-activated');       }       return $cl_is_activated;     }      The idea of this code is to set or unset the 'cl-activated' metadata depending on the checkbox value. The form of the meta box is the following: ### Generate inner meta box HTML               function cl_generate_inner_box($post, $metabox) {           // Use nonce for verification       wp_nonce_field( plugin_basename(__FILE__), EMU2_I18N_DOMAIN );            // The actual fields for data entry       echo '<label for="cl-activated">';            _e("Activate collect links", EMU2_I18N_DOMAIN );       echo '</label> ';       echo '<input type="checkbox" id="cl-activated" name="cl-activated" value='.$metabox['args']['cl-parameter-name'];       if (get_post_meta($post_id, 'cl-activated', true)==true) {         echo ' checked="checked"';       }       echo ' />';     }      ### My problems   1. the metadata of the post is not set. I tried looking up the metadata in the wp-postmeta table in the database and it is not there, no matter what I do.   2. Is there a way to save the metadata even if the post or page is still a draft and the user only hits save draft? If I use the action `save_post` like I am doing now, I have the impression that it is called only when the post is already published. ### Edit **The first problem is solved.** I have double-checked the transition hooks that are provided by Wordpress. It seemed to me that the `save_post` hook should be fired when I edit a post. However what happens is that it is called when I click on the _new post_ button but not when I then save the post as a draft. To clearify I need a hook that allows me to get a function executed when the user has changed anything on the post to see if my custom checkbox has been changed so I can update the post's metadata accordingly.


title: I want to add one extra field to my URLs, I'm using Rewrite functions but it doesn't work

text: I think my question isn't in the right way, I just ask it. I want this routings for my wordpress site (for example in Custom PostType Archive page):               example.com/VALUE          =>  example.com/?mykey=VALUE     example.com/a/VALUE        =>  example.com/a/?mykey=VALUE     example.com/a/b/VALUE      =>  example.com/a/b/?mykey=VALUE     example.com/a/b/.../VALUE  =>  example.com/a/b/.../?mykey=VALUE      I searched for it, I read many articles and answers but they didn't work, or maybe I couldn't make them work! Most of the answers were how to use Rewrite API, add_rewrite_rule(), add_rewrite_endpoint() and so on... I really need this, I really need a working example please, thank you.


title: Javascript in wordpress

text:
I have featured images shown for different posts of same category in a page in a specific div. I need to show the whole post related to this image in the same page in another div. I know i must use JavaScript in this. But i need some reference which i can use for this. Can anyone help me with this? I am using the following code to show the images               <?php     /*     Template Name: Meet The Team Template     */     ?>     <?php get_header(); ?>
     <?php          $recent = new WP_Query("cat=6&orderby=title&order=ASC");          while($recent->have_posts()):$recent->the_post();         $desc_values = get_post_custom_values("description");          ?>
         <a href="<?php the_permalink() ?>" rel="title">             <?php                 if ( has_post_thumbnail() )                  {                      the_post_thumbnail();                 }             ?>
     <?php endwhile ?>
          <?php get_footer(); ?>      Thanks in advance


title: How to know which page/file WordPress is expecting?

text: I'd like to know if there's a way to know which page or file (`index.php`, `page.php`, `category.php`) WordPress is expecting when displaying a page. I get a 404 error on a `www.myblog.com/page/2`, meaning WP can't find the page. Just don't know which it's expecting.


title: Recommended Use of Bootstrap, or JQuery-UI in WP/plugin development?

text: It seems Bootstrap is becoming more and more popular lately, giving a consistent feel for responsive dialogs and forms. Is it generally best practice, for now and the future, to use Bootstrap, or jQuery-UI for things like dialogs, tabs, forms, etc.? From what I've seen they both may have advantages: For Bootstrap:   * It's a newer library, not as likely to interfere with some plugin's included jQuery-ui-css from 5 versions ago of jQuery-ui that is no longer supported. (Unfortunately it can conflict with jQuery-ui, requiring workarounds).   * The nature of Bootstrap makes Javascript code less necessary for simple stuff. (Dialogs can be opened from a button with an attribute target for example). For jQuery-UI:   * Has been standard part of WP for some time. (Unfortunately, changes its version from version to version in Wordpress.)   * Easy positioning and JS-centric api (position my top right at top + 100px is easy), modal y/n is a setting in initialization, along with many others.   * Resizable dialogs, jQuery-ui draggable, etc. Obviously both of these libraries are widely used, but which is generally considered best-practice in WP? Any thoughts?


title: Using wp_register_style to load CSS in footer?

text: I realise you can enqueue JS in the footer using `wp_register_script` as there is a `$in_footer` parameter for doing so. However, there isn't one for `wp_register_style` it seems. Is there a way to enqueue CSS in the footer in the same way, or do I have to manually hardcode the file path in my footer.php file?


title: Woocommerce Product Category Hide Out of Stock

text: I have `hide out of stock` applied in my woocommerce settings. The following short code               [product_category category="cat" per_page="8" columns="4" orderby="date" order="desc"]      Seems to be returning all 8 products and then hiding 2 out of stock items. This creates 2 "empty white spaces" on the frontend since only 6 products are in stock. How can I return and display 8 products that are in stock?


title: Adding a meta box to determine the sidebar

text: I was trying to customize my WordPress, and I have added some custom meta boxes (it adds custom field) to add values in it, but I don't know how to do this one... I want to a Meta Box, which will be a drop down menu. The value of this metabox will determine which sidebar to use in the post. Here's the picture: ![enter image description here](http://i.stack.imgur.com/4c5mX.png)


title: How can I change the label "Comments" to "Review" everywhere in the WP installation without translation

text: Got the way to change the labels everywhere for the post_type "Post". For a customer site, I need to use the WordPress comments. Just need to change the label from "Comments/Comment" to "Review" everywhere. But where for post_type "Post" we can use `$wp_post_types;`, what can we use for comments? I tried with `$wp_comments`, `$wp_comment` etc. but failed. How can I do it? PS: I don't want a way to translate all the strings etc. Just need a way like the link pasted above. And not just the menu labels, I need to change them everywhere, so that under the post writing page, in the checkbox saying "All comments" would also change.


title: SSL Certificate and Dedicated IP address with Woocommerce WordPress site

text: I have **wooCommerce WordPress** site (in develop phase), when i searched to have a good hosting company they advice me to **go with VPS solution not shard solution** because in VPS i can have multiple ( SSL certificate and dedicated IP), but is it actually important to have with the e-Commerce site ( what the benefit from having SSL certificate and dedicated IP) for the site. My question is did i need to have (SSL certificate and dedicated IP) for my wooCommerce ?


title: Where can i design and modify a new mail template for sending emails to users when commenting?

text: the mail sent by Wordpress is ok but its template is very simple and has no style or even a header or footer! its message has no information about my blog or logo. where can i edit its message body and/or where can i style this template?


title: the_content() not working in my Android mobile

text: I have got a little problem. I am working in a theme developed by someone I don´t know. I was testing the site in my cellphone and saw the_content() function does not show anything. I checked in one Ipad and it's working. I also checked my functions.php and I did not see anything weird. This is the link (sorry because it is Spanish site): http://decopeques.com/local-infantil/thanks-mum/ Any help would be greatly appreciated! Thanks! Frede


title: Filter WP_Query output before it is accessed (pre_get_posts)?

text: I have read Using pre_get_posts with WP_Query and I'm not sure where to go with it. I have a recent posts plugin which adds variables to WP_Query - one of which can be 'offset' posts. The problem is I have multiple instances of recent posts according to category and if I want an offset of 4 it offsets posts in the category rather than simply the latest 4 posts irrespective of category (I guess as part of `$args` see code). It feels like I need to filter the latest 4 posts from WP_Query before it is passed to recent posts but I'm not sure this is possible? I've played with various snippets but haven't got anywhere. So far I am left with...               add_action('pre_get_posts', 'skips_front_page_filter');     $flexible_posts = new WP_Query( $args );     remove_action('pre_get_posts', 'skips_front_page_filter');      All I've done is surround `$flexible_posts = new WP_Query( $args );` with an action. Am I going about this the right way and can anyone assist me to strip the first 4 posts irrespective of category before it hits `$flexible_posts`? There is a second part to this. I only want this filter to apply when my static front page is visible. I tried `if( is_front_page() )` but that hasn't helped although until I can get the filter working that's a secondary issue to worry about. Would appreciate any help.


title: Load and execute javascript from body

text: I am trying to have the following code posted in the body (from the admin interface)                   <div class="zx_ABCD zx_mediaslot">             <script type="text/javascript">                 window._zx = window._zx || [];                 window._zx.push({"id":"ABCD"});                 (function(d) {                      var s = d.createElement("script"); s.async = true;                     s.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//static.zanox.com/scripts/zanox.js";                     var a = d.getElementsByTagName("script")[0]; a.parentNode.insertBefore(s, a);                 }(document));             </script>         </div>      I wonder why the code gets loaded correctly(can see it from the source) but it's not executed ? Do you have any suggestions on workarounds for this? (Is it a feasible solution to put the script inside an js file? can that be loaded from the body?) I would like to be able to do this without having to touch the wordpress configuration/php. Just from the admin interface Cheers


title: How to add more than 1 user role to sub-menu pages

text: I create a plugin with 6 submenu pages. I need 4 of them to be accessible by administrator and a custom user role i created say 'coach' user. Then the 2 of them to be accessible by administrator and another custom user role 'player'. How would i do that to add 2 user role?


title: I need to add a custom "cover" to every new post — plugin or custom setup?

text: I'm creating a site that's basically like an online book, and every post is a chapter. Each chapter gets a customized, specially designed "cover" page that can't really be designed in the Wordpress WYSIWYG. There are certain aspects of each cover that can be templatized (like an h1, h2, and single paragraph — every chapter will have that) but everything else is going to be special to each chapter. This "cover" will also have specific CSS only relevant to this chapter. Ideally I'll be able to design and code these covers outside of Wordpress and somehow be able to inform each post which cover to use. Whether that means Wordpress actually imports that code or simply includes it with a php include doesn't much matter to me. I'd just like this to be as streamlined as possible. Suggestions?


title: Remove 'Publish to Facebook' checkbox for Facebook page publish plugin

text:
I am using Facebook Page Publish plugin and it adds a checkbox within the metabox submitdiv. I would like to remove that checkbox for my custom post type. Is there any way to do that using a function? This is the function from Facebook Page Publish that is printing the checkbox:               /**      * Renders a 'publish to facebook' checkbox. Renders the box only if       * the current post is a real post, not a page or something else.      */      function fpp_render_post_button() {         global $post;              $object_access_token = get_option('fpp_object_access_token');              if (!array_pop(get_post_meta($post->ID, '_fpp_is_published'))) {                 echo ' '.__('Publish to Facebook', FPP_TEXT_DOMAIN).' <input '.(((FPP_DEFAULT_POST_TO_FACEBOOK or fpp_get_default_publishing($post)) and !empty($object_access_token)) ? 'checked="checked"' : '').' type="checkbox" value="1" id="fpp_post_to_facebook" name="fpp_post_to_facebook" '.(empty($object_access_token) ? 'disabled="disabled"' : '').' />';         } else {                 echo ' '.__('Post again to Facebook', FPP_TEXT_DOMAIN).' <input type="checkbox" value="1" id="fpp_post_to_facebook" name="fpp_post_to_facebook" '.(empty($object_access_token) ? 'disabled="disabled"' : '').' />';         }         if (empty($object_access_token)) {                 echo '
'.sprintf(__('Facebook Page Publish is not set up.
Please check your plugin settings.', FPP_TEXT_DOMAIN), 'options-general.php?page='.plugin_basename(__FILE__)).'
';         }         if ($post->post_status == "private") {                 echo '
'.__('Private posts are not published', FPP_TEXT_DOMAIN).'
';         }         echo '<input type="hidden" name="fpp_send_from_admin" value="1" />';              $error = get_option('fpp_error');         if (!empty($error)) {                 echo '
'.sprintf(__('Your Facebook Page Publish plugin reports an error. Please check your plugin settings.', FPP_TEXT_DOMAIN), 'options-general.php?page='.plugin_basename(__FILE__)).'
';         }      }


title: Two different registraton forms for buddypress

text: I have to different user types on my buddypress site, athletes and coaches. Is their any way to have two different registration forms on buddypress? The ultimate solution would be to have a dropdown menu and when the user chooses their selection relevant to them (for example athlete) the xprofile field group specefic for them would show up below. Any help or advice would be greatly appreciated. Thanks, Tom


title: Woocommerce query all products and categories

text:
I need to generate xml file from all my products. My current query shows all product names, but how to access categories for each products? All the products have categories and subcategories. My current query:               $args = array(                      'post_type' => 'product',                      'orderby' => 'post_excerpt',                      'order' => 'ASC',                     //'product_cat' => 'My Product Category',                     'post_status' => 'publish'                 );                 $loop = new WP_Query( $args );                      while ( $loop->have_posts() ) {                     $loop->the_post();                     echo '' . get_the_title() . '

';                 }


title: How to Post to Specific Pages?

text: I'm working on this WP blog: http://millerat.com/blog/ I want to post newer articles on the blog's home page and older archived articles from PDFs to the "Articles"page. The "How's your posture?" article is one of the articles I don't want to show up on the blog's home page, only on the Articles page. How can I do this?


title: Formatting WordPress Menus (without bullets, inline with text)

text:
I'm trying to add a copyright statement and footer menu to the footer area of my Twenty Ten child theme. So far I've created the child theme and added the copyright statement and footer menu to the footer.php file. My code for the child footer.php file is:               <?php     /**      * The template for displaying the footer.      *      * Contains the closing of the id=main div and all content      * after. Calls sidebar-footer.php for bottom widgets.      *      * @package WordPress      * @subpackage Twenty_Ten      * @since Twenty Ten 1.0      */     ?>

          <?php         /* A sidebar in the footer? Yep. You can can customize          * your footer with four columns of widgets.          */         get_sidebar( 'footer' );     ?>
                                          Copyright (c) 2013 Acme Inc. All rights reserved.                     <?php wp_nav_menu( array( 'theme_location' => 'footer-menu' ) ); ?>

          <?php         /* Always have wp_footer() just before the closing           * tag of your theme, or you will break many plugins, which          * generally use this hook to reference JavaScript files.          */              wp_footer();     ?>                The problem is the formatting. **Everything should be on one line without any bullets. Like:**               Copyright (c) 2013 Acme Inc. All rights reserved. Privacy Policy Terms & Conditions      Instead the copyright statement is on its own line followed by the links (each on a separate line with bullets). I tried float: left; AND list-style: none;. This works somewhat but the links are still on a separate line. Maybe it's my div structure?


title: WordPress plugin options and jQuery

text: I'm creating a plugin that uses jQuery to modify some css, but what I can't figure out is how you can control the execution of the jQuery with WordPress plugin options (like checkboxes true/false). Can WordPress options be used as "variables" in jQuery? Or would every case require a unique .js file?


title: Link to Particular Page Within Template PHP Code

text: I want to simply create a link to a page that I know the title (or ID), but I want to make sure it works on any Wordpress install. What is the best way to do this?


title: How to add a class to the attachment images

text: When I'm in the Wordpress editor and I add an external image with the 'img' button, my html result wil be like this:                     How can automatically have a class being added to the img tag? Like this:                     I would like to apply the same principle to the 'Add Media' option. This output is like this:                     And I want the output to be like this:                     I'm new with PHP, so I'm not sure how to this via a filter. I'm started like this, but I don't know what to do next:               function image_tag_class($class, $id, $align, $size) {         return $align;     }     add_filter('get_image_tag_class', 'image_tag_class', 0, 4);


title: Get post object in shortcode function

text: I have to display a post from another page (index.php), so my code is               $section_id = 16;     $section_home = get_post($section_id);          setup_postdata( $section_home );      the_content();      This post (with ID 16) has a few shortcodes inside. I can't access the $post object inside of the shortcode functions, for example I tried               function tp_sc_flipcoin($atts,$content = null){         global $post;         var_dump($post);         return "";     }          add_shortcode( 'tp_flipcoin', 'tp_sc_flipcoin' );      and it displays the post with ID=1, I also tried:               function tp_sc_flipcoin($atts,$content = null){         var_dump($post);         return "";     }          add_shortcode( 'tp_flipcoin', 'tp_sc_flipcoin' );      and in this case it displays NULL. What am I doing wrong?


title: Display image from an external rss feed on wordpress without plugins

text: I am trying to add an external RSS Feed to my wordpress theme. Displaying the feed content and title was a success. But I don't see any option to display the image from the external feed. I tried reading about it, but most of the answers I found suggests using a plug-in like SimplePie. I'm wondering if there's another way to do it without plug-ins.


title: Multiple tag cloud filtering

text: I am writing a plugin which creates a custom post type and two associated custom taxonomies. The custom post type list/archive page should be filterable by terms in one or both taxonomies i.e not just a filter by one taxonomy term. The filters should be displayed as two separate tag clouds. Does anyone have experience of implementing this functionality and can recommend any suitable plugins?


title: Display Custom Taxonomy of custom post type

text: I am stuck on trying to create a template page that displays a list of the names in a specific custom taxonomy of a custom post type I created. The custom taxonomy is `locations` and clicking on a location like _New York_ , should take you to a list of all the post types that are connected to that location. I have looked at `get_the_terms_list` but I have not been able to produce the list. Don't really know what steps and pages I have to create to do all this so any help would be appreciated.


title: How to debug WordPress "Cron" wp_schedule_event

text: How can I debug problems with WordPress Cron? I think it will trigger when users go to your site but any errors wont be shown to them, as the jobs are run "asynchronously". So how might I debug errors? I use `wp schedule event`


title: Sort admin menu items

text: On a related note to "Changing the Order of Admin Menu Sections?", I'm looking for a way to alphabetically sort the entries in each sub-section of WordPress's admin area. Currently, whenever a new plugin is added, its entry will appear in a seemingly random location under Settings / Tools / Plugins, and it's often hard to locate the new menu item. (I have a lot of plugins already, so my menus are pretty full.) Being that I add and remove plugins fairly regularly, I would rather not need to continually go into the settings page for a menu-ordering plugin and adjust the order. Sorry for the long question; I just want to make it clear what I'm looking for. ### Example Instead of:                   Settings         - General         - Writing         - Reading         - Discussion         - (rest of core items)         - Plugin 4         - WP something         - A plugin to help with stuff         - Google-related plugin         - RSS plugin         - FeedBurner plugin         - etc.      Can I have the menu sorted alphabetically (or by another logical method), e.g.:                   Settings         - A plugin to help with stuff         - Discussion         - FeedBurner plugin         - General         - Google-related plugin         - Plugin 4         - Reading         - (rest of core items)         - RSS plugin         - WP something         - Writing         - etc.      Even better would be a sort method that keeps the core entries where they are by default and only sorts items added by plugins:                   Settings         - General         - Writing         - Reading         - Discussion         - (rest of core items)         - A plugin to help with stuff         - FeedBurner plugin         - Google-related plugin         - Plugin 4         - RSS plugin         - WP something         - etc.


title: All new plugins generating 311 chars of unexpected output?

text: At some point, I started getting a message about 311 characters of unexpected output at every plugin activation. The number is always the same, and it happens for every plugin activation, including reactivating plugins that were temporarily deactivated. The exact message: > The plugin generated 311 characters of **unexpected output** during > activation. If you notice “headers already sent” messages, problems with > syndication feeds or other issues, try deactivating or removing this plugin. Is this likely to be a problem with a plugin that has extra whitespace in its files or something? I haven't yet gotten any problems with headers already having been sent. Possibly it's related to the weird 404 errors I get in wp- admin, but that problem was around long before this unexpected output issue.


title: Plugin that provides the [edit] shortcode?

text: Several months ago, I was browsing around the Internet and came across a WordPress site that had updates on the posts enclosed in `[edit]...[/edit]`. Obviously this was a function provided by a plugin that was no longer active. I searched Google and the WordPress plugin directory for a plugin that provided this shortcode, but found nothing. Presumably the content within `[edit]...[/edit]` (or `[edit date="yyyy-mm-dd"]...[/edit]`) was displayed in a special way, like a revision list below the post or something. Are there any plugins that do this? I immediately wanted to add the functionality a plugin that would use a shortcode set up in that way to my site, but couldn't find the plugin.


title: How to create a static player top or bottom of wordpress?

text: I'm creating two websites, one radio station and one bands website. I want to add a player (already have a php with the player in it) to the top of the page, like a frame. The main point is to have the player playing music while people can navigate to other pages without interrupting the player. I've created the following:               <frameset framespacing="0" border="0" frameborder="0" rows="*,65">         <frame name="main" target="_self" src="http://www.website.com/index.php" scrolling="auto">         <frame name="footer" scrolling="no" noresize="noresize" src="http://www.website.com/player">         <noframes>      However this creates a loop.


title: Where are the options "template" and "current_theme" derived from

text: My theme is in a folder called "mytheme" and the "Theme Name" in the style.css is "My Theme". From that, I'm guessing that the option "template" in the options table is a reference to the folder, not the "Theme Name". I'm asking because I want to be sure that the value I should pass to switch_theme() is a reference to the foldername mytheme, not the theme name "My Theme" ?               switch_theme('mytheme', 'style.css')


title: Define menu_order on Creation of New Custom Post?

text: I've created a custom post type called `video` and I'm using a plugin called `Playlist_Order` (which changes the `menu_order` field) to allow the user to use a drag and drop interface to order their videos in a playlist. However, when adding a new post the video appears at the top of the playlist because it's given a default `menu_order` value of `0`. On creation of a new video post I would like it to appear last in the playlist - i.e. query all `video` post types, find the largest `menu_order` value and then set this `+1` for the new post. How can I implement this?


title: How can I make an Ajax login form work with FORCE_SSL_ADMIN enabled?

text: I'm working on a site that requires an https secured admin area and a secure front-end area as well where private information will be shown. My preference for user login is an Ajax-enabled widget that can be shown on every page of the site, but I'm not able to make it work when passing submitted form data from the non-secured pages to the login page. I started by using the Login With Ajax plugin, which with a few modifications, plays well with SSL for the most part, and it works fine when logging in from a page that's being accessed by https... and it also works fine when FORCE_SSL_ADMIN is turned off. But when trying to log in from the widget on a non-secured page with FORCE_SSL_ADMIN on, I can't get an response from the server. Are there any existing plugins which solve this problem? And if not, anyone have any solutions? Maybe a secured form embedded in an iframe is my best idea so far... just thinking that there must be an easier way. ### *Edit: Offering Bounty* I'm adding a bounty to this question because I'm still curious. I worked around this in my project by just giving up on the widget and displaying a link to the wp-login page. But being able to embed a secure login form on a non secure page would be a much better solution. I'll award the bounty to anyone who can show code that would work to make that happen, or point me to a plugin that already does this.


title: Headers already sent - Wordpress core

text: I'm getting an error on my site regarding "headers already sent": > Warning: Cannot modify header information - headers already sent by (output > started at ........./wp-admin/menu-header.php:161) in ....../wp- > includes/pluggable.php on line 881 I read the Wordpress FAQ that discusses this, but - as you can see - this error is caused by the Wordpress core (and not even at the end of a file). Interestingly, I don't get this error on my local machine. Only on my server. What can I do about this? I'm running Wordpress 3.4.2


title: Loop after page content

text:
I just upgraded to 3.4.2 from 2.9 (i know, i know, but if it ain't broke...) I have page templates that are (or at least were) set up to display the page content first, then start a loop of posts, like so:

ABOUT THE SITE

             <img src="<?php bloginfo('template_url'); ?>/images/headline.gif" />
<?php the_content(); ?>

POSTS BY DATE

                 <?php                     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;                     $args= array(                         'cat' => 8,                         'paged' => $paged                     );                     query_posts($args);                 ?>                 <?php if (have_posts()) : ?>                 <?php while (have_posts()) : the_post(); ?>                 <?php                     $key="main img";                     $my_main_img = get_post_meta($post->ID, $key, true);                     $key="thumb img";                     $my_thumb_img = get_post_meta($post->ID, $key, true);                 ?>                 <div <?php post_class() ?>>

                 <?php endwhile; ?>                 <?php else : endif; ?>

<?php previous_posts_link(' ') ?>

<?php next_posts_link(' ') ?>

      This worked great in 2.9 but in this new upgrade it isn't displaying the page content. I have multiple page templates and was able to fix it on the pages that ran simple queries (like list of the blog contributors) by putting               <?php if (have_posts()) : ?>     <?php while (have_posts()) : the_post(); ?>      before `<div id="content">`, but as you can imagine on the main blog archive page this isn't an option. (I tried just to be sure). So how does one get the contents of the page outside the main loop? Do I have to run two loops? It seems this would be a simple enough thing but I can't work out how. I can't run a simple query in this page because there's all sorts of crazy stuff going on in there. Or can I?


title: How to disable core and plugin updates

text: Is there any way to disable core and plugin updates? I am modifying a plugin and bit of **WordPress Core** (I know its a sin to do so), but can't help it.


title: How to get post meta in functions?

text: I set an email button in functions php. The email is sent when clicking on a front-end update post button. The problem is: the email is sent but I can't get the post title to appear in the post. I guess I didn't correctly set the post_title variable... Anyway, here's the code (taken and partially edited from a old wp answers thread). For the button               function show_publish_button2(){     Global $post;         echo '<form name="front_end_publish" method="POST" action="">                 <input type="hidden" name="pid" id="pid" value="'.$post->ID.'">                 <input type="hidden" name="FE_PUBLISH" id="FE_PUBLISH" value="FE_PUBLISH">                 <input type="submit" name="submit" id="submitp2" value="" onClick="return confirm(\'are you sure?\')">             </form>';     }      for updating the post and emailing               if (isset($_POST['FE_PUBLISH']) && $_POST['FE_PUBLISH'] == 'FE_PUBLISH'){     if (isset($_POST['pid']) && !empty($_POST['pid'])){     update_post_meta((int)$_POST['pid'], 'rivedi_check', 'false');     $ogg = $post->post_title;         $to = 'email@adress.com';     $subject = 'Post updated';     $message = 'Post title '.$ogg;             wp_mail(                 $to,                 $subject,                 $message             );      }     }      I also tried with:               $ogg = get_post($post->ID, post_title);      But it's the same, it doesn't work. The only thing that is written in the email body I receive is: "Title of the post: ".


title: wordpress page is broken when trying to connect to facebook php SDK

text: I have a strange issue when trying to connect to Facebook php SDK from my WordPress site. I have followed all instructions as shown on Facebook developers and other sites - I have an app on Facebook and I have downloaded the latest Facebook SDK.               session_start();     require_once(ABSPATH . 'facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookSession.php');     require_once(ABSPATH . 'facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookRequest.php');     require_once(ABSPATH . 'facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookResponse.php');     require_once(ABSPATH . 'facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookSDKException.php');     require_once(ABSPATH . 'facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookRequestException.php');     require_once(ABSPATH . 'facebook-php-sdk-v4-4.0-dev/src/Facebook/GraphObject.php');     require_once(ABSPATH . 'facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookRedirectLoginHelper.php');     require_once(ABSPATH . 'facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookAuthorizationException.php');     require_once(ABSPATH . 'facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookJavaScriptLoginHelper.php');          use Facebook\FacebookSession;     use Facebook\FacebookJavaScriptLoginHelper;     use Facebook\FacebookRedirectLoginHelper;     use Facebook\FacebookRequest;     use Facebook\FacebookResponse;     use Facebook\FacebookSDKException;     use Facebook\FacebookRequestException;     use Facebook\FacebookAuthorizationException;     use Facebook\GraphObject;          FacebookSession::setDefaultApplication('172357792955421', 'b0a5bc2aeb8b2a8712c0af6f01e45c1a');          $helper = new FacebookJavaScriptLoginHelper();     try {       $session = $helper->getSession();     } catch(FacebookRequestException $ex) {       echo 'Facebook returns an error';     } catch(\Exception $ex) {       echo 'When validation fails or other local issues';     }     if ($session)       echo 'logged in';     else       echo 'not logged in';      I have also tried:               require_once( ABSPATH . 'facebook-php-sdk-v4-4.0-dev/autoload.php' );      instead of requiring each single php. The problem is that the page is broken - cut off, with no header and side tab. I dont see any errors or warnings. **if I make some of the require_once as comments (with //), then the page is not cut** (but then of course this doesn't work). ![screenshot of how the page looks like](http://i.stack.imgur.com/3Q5jI.png) I guess something in WordPress is doing the problem, but I can't figure out what it is. Appreciate any help with this. Thanks


title: Get style and script file versions and use them while writing a cache manifest file

text: Earlier I've learned how to remove file versions from wordpress style and script file source links inside the `wp_head` function. From here: How to remove file versions from the file source links in wp_head? I had a good reason needing that action. Why? While writing a cache manifest file, inside that file I managed to write also absolute source links, but without `?ver=` parameter. `wp_head` has generated the used theme with `?ver=` parameter the syle and script file inclusions. So there was smooth differences between the cache data and theme data. I don't know if that was the reason not getting the styles while being offline my test site. **Question:** Now what I'd like to know, is the way how can I add `?ver=` parameter to the cache manifest file entries. I'm writing this way the cache file's lines:               $hashes = "";     $network = array("\n\nNETWORK:");     $cache = array("\n\nCACHE:");     $path = get_stylesheet_directory()."/";     $dir = new RecursiveDirectoryIterator( $path );          foreach(new RecursiveIteratorIterator($dir) as $file) {         if ($file->IsFile() && $file != "./manifest.php" && substr($file->getFilename(), 0, 1) != ".") {             if(preg_match('/.php$/', $file)) {                 if (isAllowedExtension($file))                     array_push($network,"\n" . str_replace($path, './', $file));             } else {                 if (isAllowedExtension($file))                     array_push($cache,"\n" . str_replace($path, './', $file));             }                  $hashes .= md5_file($file);         }     }      Hence this aren't absolute url's, I'm just curious how could be possible adding the `?ver=` parameter to this file url's? :) === Update:               if( !strpos( $file, '?ver=' ) ) {         $file = add_query_arg( 'ver', $file );         return $file;     }      This is only a try... Not complete code. First I think we should check if the file has any version, then add the version parameter after the source url.


title: Combining multiple conditional statements

text: I need a 3 part conditional statement with all negatives but I can't get it to work. I need to say that the post isnt in category 'videos' or its child categories and isn't from the author with the id of 3. This is what I had but obviously doesn't do the trick.               if (!in_category('videos') || !post_is_in_descendant_category(9) && !is_author('3'))


title: Posting to most pages throws 404

text: I have a problem with a Wordpress installation where POST requests to any page apart from a couple in the root fail with a 404. POSTing to wp-atom.php succeeds, but POSTing to another custom page in the root fails with a 404. Wordpress is processing the request as its the Wordpress 404 page that is being returned. Is there some filter that could be intercepting the request and denying all but a few POST requests?


title: What is the major difference between child theme and normal theme

text: What is the exact difference between child theme and normal theme? And what are the advantages of using child theme.?


title: Get comments after specific date

text:
I don't think this is a parameter in get_comments( $args ); so I'm using a SQL statement. First I obtain a comment date from a separate table I created. Afterwards, I want to retrieve all comments made after that date.               $last_updated_comment = "         SELECT comment_date FROM wp_last_comment         ORDER BY comment_date DESC LIMIT 1";     $last_updated_comment = $wpdb->get_results( $wpdb->prepare($last_updated_comment));     print_r( $last_updated_comment );      This produces:               Array ( [0] => stdClass Object ( [comment_date] => 2012-03-09 09:03:00 ) )       Therefore, I add the foreach statement to access the object within the array:               foreach($last_updated_comment as $key => $object){     print_r( $object);     echo "

";     }      @Stephen Harris, Thanks for the syntax help. Next, foreach object, get the date:               foreach($object as $key => $date_lookup){         echo $date_lookup . '

';     }      With output:               $date_lookup = 2012-03-09 09:03:00      * * * Part 2: Comparing dates in SQL statement Now that I've obtained the reference date, I want to get all comments from wp_comments after $date_lookup:               global $wpdb;     $sql = "         SELECT comment_post_ID, comment_author, comment_author_email, comment_date, comment_content, comment_approved, comment_type, comment_parent         FROM wp_comments WHERE comment_date > '%$date_lookup%' ";     $new_comments = $wpdb->get_results($sql);     print_r( $new_comments );      Now it seems that the > operator is looking at the time and ignoring the year because my output includes an array of comments with dates from 2011. Is the > operator the correct tool to use?


title: Filter posts under multiple categories?

text: How do I filter the posts by multiple categories? For example, if some of my posts are categorized under just apples and some as just oranges and some both, how would I filter the results to show only posts marked under both apples and oranges? In other words, I don't want the results to list all posts under apples and all posts under oranges. I only want to show posts listed under both apples and oranges. Is there a way to do this?


title: Auto embeding Vimeo/Youtube in custom fields (tinyMCE editor)

text: I'm using 2 extra TinyMCE editors on my pages to add extra textfiels in my theme pages. I now realize that the auto-embed feature is not supported on content delivered thought custom fields. So i need to tell WordPress to enable this on these two extra custom fields. Here is an example of the back-end part included in my functions.php file:                   function monster_meta_options() {         global $post;         $custom = get_post_custom($post->ID);         $monster_tiny_1 = (isset($custom['monster_tiny_1'][0]) ? $custom['monster_tiny_1'][0] : '');         //Use nonce for verification         wp_nonce_field( plugin_basename( __FILE__ ), 'myplugin_noncename' );              //TinyMCE field! :)         $args = array('wpautop' => true, 'media_buttons' => true, 'quicktags' => true,'textarea_name' => 'monster_tiny_1');         wp_editor( html_entity_decode($monster_tiny_1), 'lower-left', $args);        }      This is an example of how i output my custom field on the front end. A custom page named om-monster.php                                       <div class="entry-content-left">                             <?php                                  $custom_field = get_post_meta($post->ID, 'monster_tiny_1', true);                                 $monster_tiny_1 = (isset($custom_field) ? $custom_field : '');                                  if ($monster_tiny_1 != '') {                                      echo wpautop(html_entity_decode($monster_tiny_1));                                  } ?>                         </div><!-- .entry-content-left -->      So how can i enable autoembed on the content written in the custom TinyMCE editor (should be the same as a normal text field).


title: wp_redirect() function is not working how to solve this

text: wp_redirect($post->guid) is not working,how to solve this. this is my code:                    if(isset($_REQUEST['vid']) ){           $id=$_REQUEST['vid'];               $post_title = 'sasa';          $post_content ='zxczxczxc';          $new_post = array(           'ID' => '',           'post_author' => $user->ID,            'post_content' => $post_content,           'post_title' => $post_title,           'post_status' => 'publish',           // NOW IT'S ALREADY AN ARRAY              );          $post_id = wp_insert_post($new_post);          // This will redirect you to the newly created post     $post = get_post($post_id);     $url=$post->guid;           wp_redirect($post->guid);             }


title: Attach form output as TXT-file in notification email

text: (How) Is it possible to attach the form output (contact form 7 or similar) in a TXT-file with the notification email to the admin? Is it possible to make a template for this TXT-file with only some of the data in the form?


title: How can I just show portfolio items from 1 category on portfolio page?

text:
I have a website I am setting up for a client of mine which has a portfolio page which you can see here... http://lenhamsportscars.com/cars-for-sale You will notice that there is an option at the time to filter by category (Cars For Sale OR Cars Sold). I need to amend the code so it automatically just shows the portfolio items from the category I choose, rather than showing both on the same page. Here is the current code that will need amending...                   <?php     /*     Template Name: Portfolio Template          */     ?>     <?php get_header(); ?>

<?php the_title(); ?>
              <?php              $categories=get_categories('taxonomy=section');            if ( !empty( $categories ) ){               ?>

view by:

All
              <?php  wp_list_categories('taxonomy=section&title_li=');    ?>
             <?php  } else {    $categories = array(); } ?>                      <?php                      $count = 0;                 //   custom_query_posts(array('post_type' => 'portfolioitems','posts_per_page'  => 50))         global $wp_query;         wp_reset_query();         $paged = get_query_var('paged') ? get_query_var('paged') : 1;         $wp_query = new WP_Query(array('post_type' => 'portfolioitems','posts_per_page' => 50,'paged'=> $paged));                      ?>
                       <?php while (have_posts() ) : the_post(); ?>                      <?php                            $custom = get_post_custom($post->ID);                         $bimg = $custom["bimg"][0];                         $shortxt = $custom["shortxt"][0];                              $terms = get_the_terms( get_the_ID(), 'section' );                             ?>                                    <li class="portfolio-item2" data-id="id-<?php echo $count; ?>" data-type="cat-item-<?php foreach ($terms as $term) { echo $term->term_id; } ?>">
                                                 <a class="image-zoom" href="<?php the_permalink() ?>" rel="" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('portfolio-img', array('alt' => ''.get_the_title().'', 'title' => ''.get_the_title().'')); ?>
                         <h2 class="post-title-portfolio" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>

<?php echo $shortxt; ?>

                                         <?php $count++;  ?>                  <?php endwhile; ?>                       <?php wp_reset_query(); ?>

             <?php if(function_exists('pagenavi')) :pagenavi();  ?>                      <?php else : ?>

<?php previous_posts_link('« Previous') ?>

<?php next_posts_link('Next »') ?>

          <?php endif; ?>

         <?php get_footer(); ?>      I have researched this for days and played around but am not great with code and can't get it to work. Any help would be much appreciated as the client wants this site finished a.s.a.p. Thanks! Here is the code for the functions.php file:               <?php     /**      * @package WordPress      * @subpackage Granit      */               // Add custom post type     include("include/portfolio-custom-post-type.php");          // Add latest tweets custom widget     include("include/widget-twitter.php");          // Disable WordPress’s auto-formating filters     include("include/disable-autoformat.php");          if ( !function_exists( 'optionsframework_init' ) ) {          /*-----------------------------------------------------------------------------------*/     /* Options Framework Theme     /*-----------------------------------------------------------------------------------*/          /* Set the file path based on whether the Options Framework Theme is a parent theme or child theme */          if ( STYLESHEETPATH == TEMPLATEPATH ) {         define('OPTIONS_FRAMEWORK_URL', TEMPLATEPATH . '/admin/');         define('OPTIONS_FRAMEWORK_DIRECTORY', get_bloginfo('template_directory') . '/admin/');     } else {         define('OPTIONS_FRAMEWORK_URL', STYLESHEETPATH . '/admin/');         define('OPTIONS_FRAMEWORK_DIRECTORY', get_bloginfo('stylesheet_directory') . '/admin/');     }          require_once (OPTIONS_FRAMEWORK_URL . 'options-framework.php');          }          if ( function_exists('register_sidebar') ) {         register_sidebar(array(             'name' => 'Sidebar',             'before_widget' => '
',             'after_widget' => '
',             'before_title' => '
',             'after_title' => '
',         ));         register_sidebar(array(             'name' => 'Footer1',             'before_widget' => '
',             'after_widget' => '
',             'before_title' => '
',             'after_title' => '
',         ));     }          // Register Post Thumbnail     add_theme_support( 'post-thumbnails' );      set_post_thumbnail_size(605,200,true);     add_image_size( 'blog-img', 605, 200, true );     add_image_size( 'portfolio-img', 225, 140, true );          // Register Custom Menus     add_action('init', 'register_my_menu');     function register_my_menu() {     register_nav_menu('menu-1', __('Menu 1'));     }               function custom_blog_posts(array $query = array())     {         global $wp_query;         wp_reset_query();              $paged = get_query_var('paged') ? get_query_var('paged') : 1;              $defaults = array(             'paged'             => $paged,             );         $query += $defaults;              $wp_query = new WP_Query($query);     }                    function custom_query_posts(array $query = array())     {         global $wp_query;         wp_reset_query();              $paged = get_query_var('paged') ? get_query_var('paged') : 1;              $defaults = array(             'paged'             => $paged         );         $query += $defaults;              $wp_query = new WP_Query($query);     }          /*-----------------------------------------------------------------------------------*/     /*  Get related posts by taxonomy     /*-----------------------------------------------------------------------------------*/          function related_projects_taxonomy($post_id, $taxonomy, $args=array()) {       $query = new WP_Query();       $terms = wp_get_object_terms($post_id, $taxonomy);       if (count($terms)) {         // Assumes only one term for per post in this taxonomy         $post_ids = get_objects_in_term($terms[0]->term_id,$taxonomy);         $post = get_post($post_id);         $args = wp_parse_args($args,array(           'post_type' => $post->post_type, // The assumes the post types match           'post__in' => $post_ids,           'taxonomy' => $taxonomy,           'term' => $terms[0]->slug,           'posts_per_page' => 4         ));         $query = new WP_Query($args);       }       return $query;     }          function wpe_excerptlength_blog($length) { return 60; }     function wpe_excerptlength_index($length) { return 25;  }     function wpe_excerptmore($more) { return '...'; }     function wpe_excerpt($length_callback='', $more_callback='') {         global $post;         if(function_exists($length_callback)){         add_filter('excerpt_length', $length_callback);         }         if(function_exists($more_callback)){         add_filter('excerpt_more', $more_callback);         }         $output = get_the_excerpt();         $output = apply_filters('wptexturize', $output);         $output = apply_filters('convert_chars', $output);         $output = '
'.$output.'
';         echo $output;         }          function mytheme_comment($comment, $args, $depth) {        $GLOBALS['comment'] = $comment; ?>        <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">          <div id="comment-<?php comment_ID(); ?>">
              <?php echo get_avatar($comment,$size='30',$default=''); ?>

              <?php printf(__('%s'), get_comment_author_link()) ?>                <?php if ($comment->comment_approved == '0') : ?>              <?php _e('Your comment is awaiting moderation.') ?>
           <?php endif; ?>
<?php printf(__('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?> <?php edit_comment_link(__('(Edit)'),'  ','') ?>
                <?php comment_text() ?>

              <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>

     <?php }           function pagenavi( $p = 2 ) { // pages will be show before and after current page       if ( is_singular() ) return; // don't show in single page       global $wp_query, $paged;       $max_page = $wp_query->max_num_pages;       if ( $max_page == 1 ) return; // don't show when only one page       if ( empty( $paged ) ) $paged = 1;       echo 'Page: ' . $paged . ' of ' . $max_page . '  '; // pages       if ( $paged > $p + 1 ) p_link( 1, 'First' );       if ( $paged > $p + 2 ) echo '... ';       for( $i = $paged - $p; $i <= $paged + $p; $i++ ) { // Middle pages         if ( $i > 0 && $i <= $max_page ) $i == $paged ? print "{$i} " : p_link( $i );       }       if ( $paged < $max_page - $p - 1 ) echo '... ';       if ( $paged < $max_page - $p ) p_link( $max_page, 'Last' );     }     function p_link( $i, $title = '' ) {       if ( $title == '' ) $title = "Page {$i}";       echo "{$i} ";     }     ?>      This is the code for includes/portfolio-custom-post-type.php...               <?php     add_action('init', 'buildPortfolio');     function buildPortfolio() {                  $labels = array(             'name' => _x('Our Portfolio', 'post type general name'),             'singular_name' => _x('Portfolio Item', 'post type singular name'),             'add_new' => _x('Add New Item', 'portfolio item'),             'add_new_item' => __('Add New Portfolio Item'),             'edit_item' => __('Edit Portfolio Item'),             'new_item' => __('New Portfolio Item'),             'view_item' => __('View Portfolio Item'),             'search_items' => __('Search Portfolio'),             'not_found' =>  __('Nothing found'),             'not_found_in_trash' => __('Nothing found in Trash'),             'parent_item_colon' => ''             );                  $portfolio_args = array(                 'labels' => $labels,                 'label' => __('Portfolio2'),                 'singular_label' => __('Portfolio3'),                 'public' => true,                 'show_ui' => true,                 'capability_type' => 'post',                 'hierarchical' => false,                 'rewrite' => true,                 'supports' => array('title', 'editor', 'thumbnail', 'excerpt')             );             register_post_type('portfolioitems',$portfolio_args);                   $labelsPortfolioSection = array(         'name' => _x( 'Sections', 'taxonomy general name' ),         'singular_name' => _x( 'Section', 'taxonomy singular name' ),         'search_items' =>  __( 'Search Sections' ),         'all_items' => __( 'All Sections' ),         'parent_item' => __( 'Parent Section' ),         'parent_item_colon' => __( 'Parent Section:' ),         'edit_item' => __( 'Edit Section' ),         'update_item' => __( 'Update Section' ),         'add_new_item' => __( 'Add New Section' ),         'new_item_name' => __( 'New Section Name' ),       );                register_taxonomy('section','portfolioitems',array(         'hierarchical' => true,         'labels' => $labelsPortfolioSection       ));          }          add_action("admin_init", "addPortfolio");     add_action('save_post', 'updateDetails');          function addPortfolio(){         add_meta_box("portfolio_details", "Portfolio Options", "portfolioOptions", "portfolioitems", "normal", "low");     }          function portfolioOptions(){         global $post;         $custom = get_post_custom($post->ID);         $shortxt = $custom["shortxt"][0];         $bimg = $custom["bimg"][0];         $year = $custom["year"][0];         $client = $custom["client"][0];         $performance = $custom["performance"][0];         $lnk = $custom["lnk"][0];               ?>

Short Text:<input name="shortxt" value="<?php echo $shortxt; ?>" />

Big Image URL:<input name="bimg" value="<?php echo $bimg; ?>" />

Project Year:<input name="year" value="<?php echo $year; ?>" />

Client Name:<input name="client" value="<?php echo $client; ?>" />

Performance:<input name="performance" value="<?php echo $performance; ?>" />

Site Link:<input name="lnk" value="<?php echo $lnk; ?>" />

             <?php          }     function updateDetails(){         global $post;         update_post_meta($post->ID, "shortxt", $_POST["shortxt"]);         update_post_meta($post->ID, "bimg", $_POST["bimg"]);         update_post_meta($post->ID, "year", $_POST["year"]);         update_post_meta($post->ID, "client", $_POST["client"]);         update_post_meta($post->ID, "performance", $_POST["performance"]);         update_post_meta($post->ID, "lnk", $_POST["lnk"]);          }           add_filter("manage_edit-portfolio_columns", "portfolio_edit_columns");          function portfolio_edit_columns($portfolio_columns){         $portfolio_columns = array(             "cb" => "<input type=\"checkbox\" />",             "title" => "Project Title",         );         return $portfolio_columns;     }     ?>


title: Certain BuddyPress Member Profile Data Getting Hyperlinked

text: Very odd behavior in BuddyPress. When we enter various pieces of information in the About Me textbox on the members profile data in BP, some content is getting hyperlinked as `../members/?s=my content` Has anyone seen that? How can I correct it or shut off the hyper-linking? Thanks.


title: How to add a element with walker menu right after begin of the navigation tags?

text:
I was trying to add a element right after begin of the navigation tags and before the ul will start. So add a element directly after opening nav tag. I tried this, but this will add a list item after all li's. Maybe we can use it to solve my problem:               add_filter('wp_nav_menu_items', 'add_li_to_nav', 10, 2);          function add_li_to_nav($items, $args)     {         $items .= '
SEARCH
';         return $items;     }      What my goal is, is to add a link `<a href="#" "mobile">` right after `primary-navwrapper`. Like the following markup:

         Fotografie


title: How to hide some categories in category list under post in wordpress?

text: In My wodpress Blog there are some categories use for the internal work. I want to hide that categories in blog homepage category list show under each post. I print category list as `print(the_category($postID));` How to hide or make filter for that category list print under each post?


title: How to export a Wordpress blog with no export function?

text: So I have this blog on a polish blog hosting service (blox.pl) that's incompatible with pretty much everything. There's two tools I can use to get data off it; one is to use a program that just simply won't work, and the other is to use another polish blog service (blog.pl), which is just wordpress, but it has a script that can import from blox. Here's the kicker; now that I have the content on wordpress, blog.pl doesn't allow exports. I can't use the script either, since it's not available anywhere. My question is this: does anyone have a script that parses a whole Wordpress blog and creates an useful .xml import file from it?


title: Slideshow/Gallery plugin based on WP Core Gallery

text: Looking for a plugin that I can hardcode into my custom post type template that pulls the images from gallery images added into the standard WP gallery. Thoughts?


title: buddypress edit profile

text: I have installed buddypress, I don't see any errors or success message when a person updates their profile details. Also for some reason it only seems to update admins details, a normal user/subscriber, cannot update its on profile. has anyone come across this? help please.


title: How to add code to Header.php in a child theme?

text: I'm creating a child theme for the first time and I had a few questions regarding code added to header. In a non child theme there is certain code I add to my header.php file such as google analytics, google webmaster tools, buy sell ads, Facebook open graph, etc.... How do you do this in a child theme? Do you create a header.php file in your child theme? If so how is this done? Is it the same as the @import as I used on the css? Thanks.


title: featured posts order

text: I'm trying to build a featured posts with a "tabbed" interface in my homepage. I'm using the "sticky" option of the posts in order to get them out of the main loop and in the "featured tabs". No problem here. The problem is I can't control the stickies order. Is there a way to set the order of sticky posts? A plugin, custom field... Is this stickies approach completely wrong? Thanks


title: I have geocoded posts with latitude longitude - How to search by radius?

text: I have posts which are geocoded with latitude and longitude from Google. I basically can enter an address in a post custom field and the latitude and longitude are placed into two separate meta fields. I'd like to create a custom search letting visitors search their zip/postal code and find the nearest locations. I've found this plugin which does all that bundled in one with custom post types then a search page http://wordpress.org/extend/plugins/wp-find-your- nearest/ I was thinking to try and modify it to work with my custom meta fields and only use the search page/function. Does anyone know of any other plugins or methods to create a custom search using postal codes and radiuses from lat / long meta fields Thanks


title: Archives and Categories in Custom Menu

text: What is the easiest way to place the Archives and Categories lists within my menu under a parent tab. I'd like both of the lists, such as "Archives" leading to the "archives" sub-menu, and the same for Categories. I'm looking for a non-programmatic (admin-panel only) solution for this.


title: Why use widgets?

text: I am very new to using WordPress and I was wondering what the benefits of using widgets is? Looking here it sounds like they are for people who are not programmers that want to add plugins to their site. Is that correct? or do widgets allow the site to be more robust in some way?


title: MIssing feature image link function

text: I need to be able to add a feature image to a post as a link. The link is good, it's green check. And no i cannot upload the file and insert into post dont do anything good. I have the link to the image i just whant feature image to use it. Why i dont what ti upload it, it's because my gallery is completely OUTSIDE awfull WP gallery system ! and work great as this SO the question is. If my link is : http://www.notreaventure.com/photo-0007/images/_MG_2133.jpg and i like WP to use it as feature image, can i put this link in a custom files, let's say featureimg : http://www.notreaventure.com/photo-0007/images/_MG_2133.jpg, and add a funtion that tell the WP system to get this field and get it to feature image, so nothing will be broken. I just cannot seem to know how to hack wp to get the funtion feature image to get it's image from custom field... can you help, thanks in advnace


title: How to use the WP Plugin List Category Post widget (!) with more than one category?

text: The Plugin List Category Post used as shortcode in a post/page allows to display a number of random posts from several categories. But when I use the plugin's widget I can choose only one category. Is there a way to use the widget and allow to choose several categories?


title: Using a loop to build and update widgets

text:
So I have a widget Im making which allows users to update 4 switches. Each switch has the same fields, name, description, price, amount so I decided to build the widget using a for loop instead of hard coding each field to avoid repeating myself. I cant figure out how to save the values tho, because from teh tuts I've looked at for building widgets, the name field has to be $this->get_field_name which produces something like widget-switches-widget[4][name] So my form() function looks like               for($i =0; $i<4;$i++){         $name = $instance[$i]['name'];           $description = $instance[$i]['description'];             $amount = $instance[$i]['amount'];           $price = $instance[$i]['price'];     ?>              <div id="<?php echo $i; ?>" class="switch_form" style="background-color:<?php echo $i%2 == 0 ? '': '#DFDFDF' ;?>; border-radius:4px; padding:5px;">
Switch # <?php echo $i+1;?>

                 <label for="<?php echo $this->get_field_id( 'name' ); ?>"><?php _e('Name:', 'Name'); ?>                 <input style ="width:90%;" name="<?php echo $this->get_field_name($i); ?>['name']" value="<?php echo $name; ?>" />

                 <label for="<?php echo $this->get_field_id( 'description' ); ?>"><?php _e('Description:', 'Description'); ?>                 <input style ="width:90%;" name="<?php echo $this->get_field_name($i); ?>['description']" value="<?php echo $description; ?>" />

                 <label for="<?php echo $this->get_field_id( 'amount' ); ?>"><?php _e('Amount:', 'Amount'); ?>                 <input style ="width:90%;" name="<?php echo $this->get_field_name($i); ?>['amount']" value="<?php echo $amount; ?>" />

                 <label for="<?php echo $this->get_field_id( 'price' ); ?>"><?php _e('Price:', 'Price'); ?>                 <input style ="width:90%;" name="<?php echo $this->get_field_name($i); ?>['price']" value="<?php echo $price; ?>" />

     <?php     }      and my update() function looks like:               function update( $new_instance, $old_instance )     {         $instance = $old_instance;              for($i =0; $i<4;$i++){             $instance[$i]['name'] = strip_tags( $new_instance[$i]['name'] );             $instance[$i]['description'] = strip_tags( $new_instance[$i]['description'] );                   $instance[$i]['amount'] = strip_tags( $new_instance[$i]['lights_fill'] );             $instance[$i]['price'] = strip_tags( $new_instance[$i]['price'] );         }         return $instance;          }      How would I save these values into an array?


title: Setting a permalink for the home page?

text: I have a static default wordpress home page. As you know if you have a homepage on wordpress you can not set a permalink through the admin options, you can only set permalinks for non homepages. Does anyone know of a way that I can set a permalink for my homepage? So that when I visit my site at example.com, it automatically turns to example.com/examplelink when the site loads? Thank you!!


title: Put multiple custom loops on same page

text:
I want multiple loops on my homepage, however only the first loop shows up. My homepage looks like this:               <?php     /*     Template Name: Home     */     get_header(); ?>

                     <?php get_template_part('loop', 'land'); ?>

                     <?php get_template_part('loop', 'home'); ?>

“Simplicity is the ultimate sophistication.”

Leonardo da Vinci

     <?php get_footer(); ?>      Here is loop-land:               $grids = 3; //Grids per row          global $query_string; //Need this to make pagination work               /*Setting up our custom query (In here we are setting it to show 12 posts per page and eliminate all sticky posts) */     query_posts($query_string . '&caller_get_posts=1&posts_per_page=9');               if(have_posts()) :  while(have_posts()) :  the_post();      ?>     <?php     //Show the left hand side column     if($counter == 1) :     ?>

                         <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('home-thumb'); ?>

<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>

<?php the_excerpt(); ?>

     <?php     endif;     ?>          <?php     endwhile;     //Pagination can go here if you want it.     endif;     ?>      Here is loop-home               <?php /* Start loop */ ?>     <?php while (have_posts()) : the_post(); ?>                  <?php the_content(); ?>         <?php wp_link_pages(array('before' => '
' . __('Pages:', 'reverie'), 'after' => '
' )); ?>     <?php endwhile; // End the loop ?>      Any ideas on how to fix this?


title: Splitting the main query in multiple loops with query_posts and/or pre_get_posts?

text: I have a custom post type 'events', to which I have associated a custom taxonomy 'calendar'. The calendar has 12 fixed terms, for each month of the year ( 'august', 'october', 'november, etc.). I'm in the process to make the archive page for the 'events' post type. I was thinking to display 12 different lists of max 10 posts each, for each month of the year == terms in the 'calendar' taxonomy. Since this would be an archive page, Wordpress would have already queried the database for 'events' post type. I was about to use `query_posts` to alter the main query, but I suddenly wondered if there was a better way to make a more optimized use of the default query. `query_posts` would essentially throw away the main query and with 12 lists to generate, it would cause more hits to the database. Which is the best practice for this case? Would you just run 12 instances of query_posts, one for each list, or you'd rather do something else, ie with `pre_get_post`s or something? thanks for sharing your ideas


title: Adding (image) caching to my Tumblr widget

text:
I've hacked together a simple plugin to show the latest image from a Tumblr blog. To avoid upsetting the Tumblr API (v1), I want to cache that image within Wordpress... I think perhaps I can do this somehow using the Transients API, but have no idea where to start with this... or is there a simple way to do it with straight up PHP? Thanks :)               <?php     /*     Plugin Name: Topshop Tumblr Widget     Plugin URI:       Description: Displays images from the Topshop Tumblr using their v1 API     Author: James Greig     Version: 0.1     Author URI: http://greig.cc     */          /*     Based on the Tumblr plugin by V.J.Catkick - http://www.vjcatkick.com/     Data source: http://topshop.tumblr.com/api/read?start=0&num=1&type=photo          */               function widget_topshop_tumblr() {         if ( !function_exists('register_sidebar_widget') )             return;              function widget_topshop_tumblr_photos( $args ) {             extract($args);                  $options = get_option('widget_topshop_tumblr_photos');             $tuid = $options['tumblr_recents_src_uid'];                  $output = '
';             $output .= '';             // $output .= '';             // $output .= '';               if ( function_exists('simplexml_load_file') ) {              $tumblr_userid = $tuid;         $tumblr_num = '1';         $img_style = $tumblr_recents_img_style;         $tumblr_size = '250';         $pagecounter = 0;              $_tumblrurl = 'http://' . $tumblr_userid . '.tumblr.com/api/read?start=' . $pagecounter . '&num=' . $tumblr_num . '&type=photo';         $_tumblrurl  = urlencode( $_tumblrurl );         $_tumblr_xml = @simplexml_load_file( $_tumblrurl );          if( $_tumblr_xml && $_tumblr_xml->posts[0] ) {              // 0.1.2         if( $tumblr_recents_additional_html ) {             $output .= str_replace( "\\","", $tumblr_recents_additional_html );         }              foreach( $_tumblr_xml->posts[0]->post as $p ) {             $photourl = $p->{"photo-url"}[3];             $linkurl = $p[url];             $output .= "
";             // $output .= '';             $output .= '';             $output .= '';             $output .= '';             $output .= '
';         }     }          } else {         $output .= 'Requires PHP 5.1';     }                  $output .= '
';                  // These lines generate the output             echo $before_widget . $before_title . $title . $after_title;             echo $output;             echo $after_widget;         }              function widget_topshop_tumblr_photos_control() {             $options = $newoptions = get_option('widget_topshop_tumblr_photos');             if ( $_POST["tumblr_recents_src_submit"] ) {                 $newoptions['tumblr_recents_src_uid'] = strip_tags(stripslashes($_POST["tumblr_recents_src_uid"]));             } /* if */             if ( $options != $newoptions ) {                 $options = $newoptions;                 update_option('widget_topshop_tumblr_photos', $options);             } /* if */                  // those are default value             if ( !$options['tumblr_recents_src_uid'] ) $options['tumblr_recents_src_uid'] = 'topshop';             $tuid = htmlspecialchars($options['tumblr_recents_src_uid'], ENT_QUOTES);     ?>                  <?php _e('Tumblr ID:'); ?> <input style="width: 100px;" id="tumblr_recents_src_uid" name="tumblr_recents_src_uid" type="text" value="<?php echo $tuid; ?>" />.tumblr.com
                  <input type="hidden" id="tumblr_recents_src_submit" name="tumblr_recents_src_submit" value="1" />          <?php         } /* widget_topshop_tumblr_photos_control() */              register_sidebar_widget('Topshop Tumblr Widget', 'widget_topshop_tumblr_photos');         register_widget_control('Topshop Tumblr Widget', 'widget_topshop_tumblr_photos_control' );     } /* widget_topshop_tumblr() */          add_action('plugins_loaded', 'widget_topshop_tumblr');          ?>


title: How to display the_post_thumbnail if a post has one or otherwise display the first image in a post?

text: I would like to create a condition that checks to see if a post has a thumbail and if it does display it, otherwise display the first image in a post. I tried something like this in my loop.php but it didn't seem to work:               <?php if (has_post_thumbnail()) { ?>     <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(array(640,320)); ?>     <?php } else { ?>     <a href="<?php the_permalink(); ?>"><img src="<?php echo catch_that_image(); ?>" />     <?php } ?>      This goes in my functions.php file:               <?php         function catch_that_image() {             global $post, $posts;             $first_img = '';             ob_start();             ob_end_clean();             $output = preg_match_all('//i', $post->post_content, $matches);             $first_img = $matches [1] [0];                  // no image found display default image instead             if(empty($first_img)){                  $first_img = get_bloginfo('template_url')."/images/no_image.gif";             }                 return $first_img;         }              $imgURL = catch_that_image();     ?>


title: Taxonomy Rewrite Rules Redirecting Instead of Masking

text: I have a custom post type of **_items_** set up. I also have a taxonomy set up with **_items_** called _categories_. functions.php code:                   regsiter_post_type('items',                     array('labels' => array                         (                             'name' => 'Items',                             'singular_name' => 'Item'                         ),                         'public' => true,                         'rewrite' => array                         (                              'slug' => 'items'                         ),                         'supports' => array                         (                             'title',                             'excerpt',                             'editor',                             'comments',                             'revisions',                             'thumbnail'                         ),                         'taxonomies' => array                         (                             'categories',                             'tags'                         )                     ));        register_taxonomy ( 'categories', 'items', array('hierarchical' => true,                         'label' => 'Item Categories',                         'rewrite' => array                         (                             'slug' => 'categories',                             'hierarchical' => ture                         )));          require 'rewrites.php'; // load rewrite class         Rewrites::init(); // call init function in rewrite class      rewrites.php code:               class Rewrites         {             // Start class methods                  public static function init()             {                 // Rewrite urls                 add_action ( 'generate_rewrite_rules', array( __CLASS__, 'rules' ) );                      add_filter ( 'query_vars', array( __CLASS__, 'vars' ) );             }                  public static function rules ( $wp_rewrite )             {                 $new_rules = array();                 $new_rules['categories/(.+?)/view/(.+)/?'] = 'index.php?categories=$matches[1]&view=$matches[2]';                      return $new_rules + $wp_rewrite->rules;             }                  // End class methods         }      So when looking at posts in the taxonomy of categories the url would be: /categories/%name_of_taxonomy%/ I need to also append to the url to add in query_vars /categories/%name_of_taxonomy%/view/%type_of_view%/ %type_of_view% would be a couple different options. list, grid etc. Here is my rewrite rule:               [categories/(.+?)/view/(.+)/?] => index.php?categories=$matches[1]&view=$matches[2]      But when I go to the url /categories/%name_of_taxonomy%/view/grid/ it redirects back to /categories/%name_of_taxonomy%/


title: Remove all nav menu classes except those which begin with certain letters

text: I'm currently using a function which strips out all the unwanted classes from my nav menus, leaving only the classes I want to keep (the ones listed in the array inside the function). It looks like this:               function remove_menu_classes($var) {     return is_array($var) ? array_intersect($var, array (         // List of allowed menu classes         'current-menu-item',         'current-menu-ancestor',         'menu-item-has-children',         'current-post-ancestor',         'first',         'last',         'vertical',         'horizontal'         )     ) : '';     }     add_filter( 'nav_menu_css_class', 'remove_menu_classes' );     add_filter( 'nav_menu_item_id', 'remove_menu_classes' );     add_filter( 'page_css_class', 'remove_menu_classes' );      Now, I want to add some additional classes to some of my menu items, using the "CSS Classes" field of each menu item, in order to add Font Awesome icons next to the menus. This is accomplished using a plugin. All I need to do is add (for example) "fa-home" into the CSS Classes field, or whatever Font Awesome class I want to use. The plugin checks for any CSS class starting with `fa-` that exists within the nav `<li>` tags, and if they exist, the plugin adds the appropriate `<i class="fa-whatever">` tag inside the `<li>` tag for me, which displays the icon. Very handy. The problem is that my function above strips these `fa-` classes out before the plugin is able to see them and act on them. I've tried changing the priorities of the "add_filter" lines in the function (to both '1' and '999') but that didn't help. So I'm wondering if there's any way to modify my function above, so that it will not strip out any classes that begin with `fa-`. I don't think I can use wildcards in an array like that, but my knowledge of PHP is not advanced enough to know if there are any other ways of writing this function that will achieve this goal (maybe using a completely different method for example). I'd prefer to keep it as simple as possible though, preferably without using a walker. :) Any ideas?!


title: How to include custom code on a page that's set to act as homepage?

text:
I have a page called 'home' which is set to be the front of my site, but I'd like it to show the most recent blog post or two at the bottom. I have some PHP that will do this from another site               <?php      query_posts('showposts=1');     while (have_posts()): the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
     <?php the_content('Read the rest of this entry »'); ?>
<a href="<?php echo $siteroot .'/blog/' ?>">Go to the Blog...
     <?php endwhile; ?>      But I'm not sure where to put it in order to make it so it only shows on this one particular page since `is_home()` returns false for the page.


title: Hooks for trashing, deleting, saving, restoring custom post type

text: I need some hooks especially for trashing and untrashing custom post types. However the hooks are not so clear in this case. For example, to run a function on trash, I can use                    add_action('wp_trash_post','my_function');      However there doesn't seem to be any other action specific to custom post types. So how would I execute my function on trashing of a custom post type?


title: How to change "attachment_id" in attachment permarlink?

text: I changed attachment permalink by `add_filter('attachment_link','my_media_url');` from               http://domain.com/?attachment_id=123      to:               http://domain.com/?media=123      **The change is successful. But, with the new URL, the page is not found**. Some suggest rewrite rules like: this               'media/(.+)' => 'index.php?attachment=' . $wp_rewrite->preg_index(1)      I tried, it doesn't work in my case. Instead of modify patterns before or after "attachment_id", I want to **replace "attatchment_id" with "media" and keep all the other stuffs unchanged.** Is this a question of rewrite, or should I study something else? I tried this, not working either:               function attachment_rewrite( $wp_rewrite ) {          $rule = array(              '/?media=' => 'index.php?attachment_id=' . $wp_rewrite->preg_index(1)          );              $wp_rewrite->rules = $rule + $wp_rewrite->rules; } add_filter( 'generate_rewrite_rules', 'attachment_rewrite' );


title: Heavy SQL queries

text: I have got rid of one of SQL problems but the story isn't over. Now hoster has detected another problematic SQL query and again threatens to disable the account. Can anyone advise on what's going on here and if there is anything that can be done to fix it?               Executed 107 min ago for 2 sec on Database --> my_db_name.      SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_author = 25 AND wp_posts.post_status = 'private') ORDER BY wp_posts.post_date DESC LIMIT 0, 20          Executed 98 min ago for 1 sec on Database --> my_db_name.      SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.post_type = 'post' AND (wp_posts.post_status = 'publish' OR wp_posts.post_author = 26 AND wp_posts.post_status = 'private') ORDER BY wp_posts.post_date DESC LIMIT 0, 20      Those users mentioned are just typical registered users with 'subscriber' level without any privileges (no installed `user roles/capabilities plugins` whatsoever). I've got 24 hrs to solve this stuff and I'm nearly desperate.


title: Customize multisite site creation with user data

text: No, I've never made a plugin. But I would like to, or find someone who can work with me on it. What I'm hoping to accomplish is setup presets on site creation. I need my multisite to do this:   1. When creating a site, require information from the user creating it that is not normally requested.   2. Upon obtaining this information, create the site with a preset path (using the information previously provided)   3. Then, when logging in for the first time, redirect the site owner to a setup page where they can choose a theme, a layout, and other options. I know of the `wpmu_create_blog` function, but am unsure of where to "include.php" it. Also I don't know what function to use for editing the site creation page or how to use this information in the `wpmu_create_blog` function.


title: Using wp_redirect and .htaccess to re-route searches (and pass along the remaining GET vars)

text: I'm trying to use `wp_redirect()` to redirect searches to a format that I have established in `.htaccess`. Unfortunately, I'm running into some problems doing this. I need to redirect search to a series of folders, and then append the remaining parameters to then end of the URL, the end result would look like this:               http://www.xxxxxxx.com/search/Used/MT/Billings/?s=BMW&z=59105&r=150&m=150000&pmin=1000&pmax=30000&submit=Refine      I've written this function so far:               function redirect_search() {         $var_status = var_status();         $var_ci = var_ci();         $var_st = var_st();         if (is_search() && !empty($_GET['s'])) {             wp_redirect(home_url("/search/".$var_status.'/'.$var_ci.'/'.$var_st));             exit();         }     }     add_action('template_redirect', 'redirect_search' );      This function results in the url looking like this: `http://www.xxxxxxx.com/search/New/Billings/MT` I've added the parameters into it, and the function looks like this:               function redirect_search() {         $var_status = var_status();         $var_ci = var_ci();         $var_st = var_st();         $zip = var_z();         $radius = var_r();         if (is_search() && !empty($_GET['s'])) {             wp_redirect(home_url("/search/".$var_status.'/'.$var_ci.'/'.$var_st.'/?s='.get_search_query().'&z='.$zip.'&r='.$radius.'etc... etc...'));             exit();         }     }     add_action('template_redirect', 'redirect_search' );      Unfortunately, this approach seems to cancel out the folders that were created, and the resulting url looks like this:               http://www.xxxxxxx.com/search/?s=BMW&z=59101      Any ideas on how to get both the folders and the parameters in there? Thanks!


title: Bigger images when sharing a link with facebook

text: please help here, i am struggling to find a way to share a larger image on my pages when new post is made on my blog.. i am using a wordpress site unfortunately when i share the link of my post on facebook wall it shows v small image with some description in it. it is not nice for me. i want to share only a very big image form the post with the link to the post. like https://www.facebook.com/mvbay I want to know how that page posts bigger images without description Can anyone please help me .. :(