title: Filter posts by tax (dropdown) and meta value

text: I'm having a page on which all my custom post types are displayed. I now need to add another to the existing ones:               $args = array(         'post_type' => 'bkroadkill',         'post_status'    => 'publish, future',         'posts_per_page'    => '15'     );          if ( 'POST' == $_SERVER['REQUEST_METHOD']  && isset($_POST['filterform']) && wp_verify_nonce($_POST['filterform'],'filterform') )     {                    if (isset($_POST['own']) && !empty($_POST['own'])){                 $args['author'] = get_current_user_id();             }             if (isset($_POST['comments']) && !empty($_POST['comments'])){                 $args['orderby'] = 'comment_count' ;             }                }     query_posts( $args );      This is working perfeclty fine. What I want to do now is add these filters   * Filter by selecting one or more categories from `wp_dropdown_categories` of my custom taxonomy   * Filter by meta value which is already set For all of the filters except the category simple checkboxes are used. I just check if they are set and when they are I change my string. My attempts for the other 2 filters failed:                   if (isset($_POST['cat']) && !empty($_POST['cat'])){             $args['roadkill_category'] = $_POST['cat'];         }      As I am very new to wordpress even this simple stuff is confusing me **EDIT:** I was able to create the filter for my meta value now:               if (isset($_POST['bestimmung']) && !empty($_POST['bestimmung'])){                $args['meta_query'] = array(array(                                                 'key'     => 'bestimmung',                                                 'value'   => 'nein',                                                 'compare' => 'IS'                                             ));         }      So I'm just missing the filter for the custom taxonomy.


title: Dumping variable in custom pre_gets_post function in functions.php, returns NULL

text:
## **Problem Summary:** I am using firePHP to analyze my variables in a custom function, but it does not display their contents into the console as I would expect. I also used var_dump(), it returns NULL. * * * ## Problem Details: I am using firePHP exactly as described by @brasofilo as seen on http://wordpress.stackexchange.com/a/71599/41479 . It is normally very helpful, but I am confused why sometimes I cannot see contents of my variables in the console. * * * Here is a specific example, this is in **page-sr2.php:**               <?php get_header(); ?>

                     <?php while ( have_posts() ) : the_post(); ?>                         <?php get_template_part( 'content', 'page' ); ?>                         <?php get_template_part('nav_menu', 'explore');?>                          <?php logit( $wp_query, '$wp_query:' ); ?> /*Logit function from @brasofilo*/                     <?php logit( $variable, '$variable: '); ?>                     <?php var_dump($variable); ?>/* This outputs NULL on the page*/                     <?php endwhile; // end of the loop. ?>
                 <?php// get_sidebar(); ?>

               <?php get_footer(); ?>
      * * * In **functions.php** I am using a custom pre_get_posts action:               add_action('pre_get_posts', 'page_sr2_pgp');          function page_sr2_pgp( $query )     {              if( is_page('sr2') ){             return $query;         }              //global $variable;   //tried this, didn't help         $variable ="something";         logit( $variable, '$variable: ');               if( isset($_GET['yr']) )         {                  $query->set('meta_key', 'yr');             $query->set('meta_value', $_GET['year']);              }                 // always return         return $query;          }      * * * The result is that `logit()` works for `$wp_query`, but not for `$variable`. ![Screenshot of console, page-sr2.php](http://i.stack.imgur.com/pNJqT.jpg) > **Note:** Yes I am calling `logit( $variable, '$variable: ');` in both > `page-sr2.php` and in the function `page_sr2_pgp` inside of `functions.php`. > I am doing that because I don't know which location is correct, and I didn't > believe it would cause a problem.


title: FTP access downloading files from live site to XAMPP sandbox

text: Where do I enter the IP address of my other live server so I can start my sandbox on XAMPP so I can start downloading the data file across. XAMPP just refers me to `C` drive, do I download the files separately or is there an option in XAMPP?


title: Handeling Multi-level custom taxonomy hierarchy

text: I am trying to sort through a multi level hierarchy in a custom taxonomy. I have custom taxonomy's with multiple sub taxonomy's. Eg:               Level1     -Level2     --Level3       ect At the moment I can use `get_term_children()` to return the children for a top level taxonomy but this doesn't tell me anything about there position in the hierarchy.


title: Prevent installation of style.css cookies and file caching

text: I'm having a problem which I have never encountered before. When I update my `style.css` file within my child theme, the webpage does not use the new style. I have pinpointed that to a cookie within my browser which seems to use `style.css?ver=3.8.1` instead of the basic `style.css`. Incidentally, 3.8.1 is my version of WordPress. The only fix I found is to manually delete the cookie, but it's a hassle to do whenever I make changes. Any ideas on how to fix ?


title: Moving Plugin Code into a Theme - Class Declaration - what hook should I use to create new instance?

text: I'm planning on moving a Plugin Inside a Theme I'm creating. The Plugin currently utilizes a Class to declare and set up the Custom Post Type and all of the other functionality of the plugin itself. The plugin both has a CPT that is populated in the Admin Dashboard and shortcodes that output data into the Theme. Since the plugin itself declares a new instance of the class, where should I move this declaration if I move the plugin code into the theme so that it only creates one instance of this class? Thanks!


title: What is the best way to move an entire multi-site Wordpress to a new domain?

text: I have a multi-site Wordpress 3.x instance set up with over 100 sites. I'm preparing to upgrade to version 3.7.x I want to allow my users to test what version 3.7 is going to look like ahead of time. They want to test to see if any plugins or their custom themes break after the upgrade. My production instance is running on mywordpress.mydomain.com. I have another server, mydevwordpress.mydomain.com that I could use to stage the upgrade. How can I do this best ? I could copy the code base from production to dev. Then I could use mysqldump to export the database and import into the other server. But what about all the links and base-site variables ? How would you accomplish this ?


title: Redirect if not logged in?

text: I've tried this to redirect people who aren't logged in to certain page. It ultimately shouldn't matter what front end page they visit, but should redirect to whatever page is chosen as the landing page (which I'm assuming would be the URL in the wp_redirect). I still need access to wp-login and dashboard etc... I placed the following code in my functions.php, but did not work.               function my_redirect() {            if ( $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'] == 'mybigfatsite.com/' ) {         if ( ! is_user_logged_in() ) {            wp_redirect( 'mybigfatsite.com/landing/' );            exit;         }     }     }     add_action( 'init', 'my_redirect' );      Thanks for any help!


title: how could I get the pagination as I want to when query posts using get_posts function

text: I am using WP3.5, and I have a `post_list.php` which will show all the posts order by post date DESC. Everything is ok except `pagination`. I have 15 posts, for test purpose, I want to every page show 2 posts, others will be show next page like this.               Prev 1 2 3 4 5 Next      Some parts of post_list.php               define('WP_USE_THEMES', false);     require_once '../blog/wp-load.php';          $query_args = array(         'orderby' => 'date',         'order' => 'DESC',         'post_type' => 'post',         'post_status' => 'publish',         'posts_per_page' => 2,         'offset' => 0          );     $lateset_posts = get_posts($query_args);          <?php      global $post;     foreach($lateset_posts as $post) :         // do something         the_content();     <?php endforeach;?>          <?php next_post_link(); previous_post_link(); ?>      Yes, as you see, every page show 2 posts as I set, but I cannot get the pagination as I want to. Instead, it shows me like this               Post1's title >> << Post2's title      How could I get the pagination style like below               Prev 1 2 3 4 5 Next      Thanks. Edit: Now I use `paginate_links` function, yes, I got what I want.               $query_args = array(         'orderby' => 'date',         'order' => 'DESC',         'post_type' => 'post',         'post_status' => 'publish',         'posts_per_page' => 2,         'offset' => 0          );     $lateset_posts = get_posts($query_args);               $paging_args = array(         'base'         => '%_%',         'format'       => '?paged=%#%',         'total'        => count($lateset_posts),         'current'      => max(1, get_query_var('paged')),         'end_size'     => 1,         'mid_size'     => 1,         'prev_next'    => True,         'prev_text'    => __('« Previous'),         'next_text'    => __('Next »')     );     $lateset_posts_paging = paginate_links($paging_args);      I have 15 rows , and it shows like this                1 2 3 .. Next      Now I am in the first page, and I want to go to the second page, so I click the number 2, and I notic the url is :               http://localhost/x/post_list.php?paged=2      But after I click it ,it `still in the first page`, and the data is also the first two rows. Where is am I wrong , Thanks.


title: How to limit characters of the post title?

text: How do I limit the number of characters in a post title? I've seen it done in Yoast's Wordpress SEO plugin but I want to do something similar for the WP title. I checked out a plugin called Limit a post title to X characters but it seems like it's been abandoned and it also breaks the Edit Media page since the media too has a title.


title: How can 2 blogs share the same users

text: I have a running normal WP blog (blog 1). I want to create a Q&A section for my users, so I setup another blog with WP-Answer theme (blog 2). The problem is I don't want my users at blog 1 have to register at blog 2 to post questions. I want they automatically grant the same privileges at blog 2. How can this be achieved? Do you have any advice for me? Thank you very much.


title: How can I create a user generated photo wall

text: I'm looking for a way to create a user generated photo wall. Like a memorial site so to speak. I would have a big header image up top, than people could submit their own photo and it would post below the big header image I posted. Does anyone know of a way I can do this either with a plug in or a theme? Thanks!


title: Custom Post Type Pagination & duplicate posts

text:
I'm working on a template which will use some custom-post-types & custom- taxonomies.. I'm having problems with pagination and duplicate posts. **HOME.PHP** LOOP #1 On the homepage (home.php) I have 2 Loops. The fist one shows 1 post (custom post type: Projects) which has the custom-taxonomy "Featured" assigned to it. LOOP #2 On the second loop I have the six most recent "Projects" (Custom post type) but I dont want a duplicate from the first loop. Under the six posts I'd like a pagination Both loops in home.php work.. but I still have that duplicate and I can't get pagination to work.. **PasteBin**   * home.php: http://pastebin.com/6ac2asue   * functions.php: http://pastebin.com/1SK206Bh              <?php $do_not_duplicate = array();     $folio_loop = new WP_Query( array         (             'featured' => 'featured-post',             'post_type' => 'projects',             'posts_per_page' => '1',             )         );               while ( $folio_loop->have_posts() ) : $folio_loop->the_post();         $do_not_duplicate[] = $post->ID; ?>

               <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >                          <?php                 global $post;                 $text = get_post_meta( $post->ID, '_cmb_project_meta', true );                 echo $text;             ?>
             <?php                 global $post;                 $text = get_post_meta( $post->ID, '_cmb_client_meta', true );                 echo $text;             ?>

                  <?php if ( has_post_thumbnail()) : ?>                 <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >                     <?php the_post_thumbnail('featured'); ?>                              <?php endif; ?>
          <?php endwhile; ?>


title: Can an update corrupt my installation?

text: Ive got a wp theme I use on a website - the theme in question was purchased from a popular site ending in forest... So the code is not mine and I can’t speak as for its quality either way. Every time a new version / update of WordPress comes out I update to it, but before I do I get a warning in my dashboard, saying that I should backup my site, as the update might corrupt the site. I’ve always backed up the site, using the export setting and also exported my theme settings. But what I was wondering is how necessary is this, as my host makes auto 24hr backups of the site both the files and mysql db. From those site backups would I be able to easily restore my site in the event of it becoming corrupted? Also out of interest I know its a bit of a vague question but how common is it to see a WordPress update corrupting a site ?


title: How to set featured image from a variable

text: I have an image displayed on my post via a variable {$poster}. How could I set this variable to a featured image? This is what I have in my post:


title: Custom post-type, multiple loops not displaying on page?

text: I have an issue with a loop within my page not displaying. The first loop I created (OUR SPONSORS) is displaying fine but the second (OUR PARTNERS) loop isn't displaying (confused!) Below is the site link. See the bottom where I have three sections. Partners, Judges and Sponsors. And you will see partners doesn't display. You can see the page here: http://chimpmarketing.com/testing/msa/?page_id=35 Any help would be much appreciated. Regards Gary


title: add bootstrap modal after login in wordpress

text:
I'm trying to add a boostrap modal just after login in my website. I have my javascript:               jQuery(document).ready(function($){          $('#after_login_modal').modal();          });      I have my div:

                     <button type="button" class="close" data-dismiss="modal">×Close</button>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.

                     Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur purus metus, imperdiet id blandit sit amet,                     ornare et nisl. Nullam elit nunc, fermentum id diam eget, auctor ultricies urna. Ut sodales maximus sodales.                     Fusce lacus libero, blandit quis maximus ut, lacinia in velit. Maecenas ligula leo, cursus vel turpis id, fermentum venenatis purus.                     Donec eleifend nisl auctor ex ullamcorper semper. Pellentesque nec varius elit, sed mollis urna.                     Integer suscipit orci id sapien dapibus vulputate. Suspendisse mollis, est non condimentum vulputate, quam quam suscipit nunc,                     eu blandit nibh massa et augue. Curabitur ultrices pretium massa vel egestas.

      I have my action in functions.php:               function after_login_display_modal() {         //stuff     }     add_action('wp_login', 'after_login_display_modal');      But I need to integrate everything...and I'm a bit stuck... Ideal would be load div and javascript only just login.


title: How to use rewind_comments() - when and how to use it?

text: I've never messed with the comments loop before, but I'm trying something out here. Basically, I have my comments form in a popup iframe, an ajax action which handles the form submission, inserts the comment, and updates the list of comments. I'm having a problem running the comments loop a second time on the page, though. The comments form comes through fine, but the comments don't show on the Ajax refresh. `have_comments()` turns up false, and `wp_list_comments()` outputs nothing. Any ideas what's going wrong? Here's my Ajax handler, in case there's an issue in there:               /* Submit Comments Through AJAX */          add_action ( 'wp_ajax_submit_comment', 'ajax_insert_comment' );     add_action ( 'wp_ajax_nopriv_submit_comment', 'ajax_insert_comment' );          function ajax_insert_comment() {              /* obviously all of this needs sanitization,             its oversimplified, just to get the idea across */         $data = extract( wp_parse_args( $_POST ) );         $current_user = wp_get_current_user();         $comment = wp_insert_comment( array(             'user_id' => $current_user->ID,             'comment_author' => $current_user->display_name,             'comment_author_email' => $current_user->user_email,             'comment_post_ID' => intval( $comment_post_ID ),             'comment_parent' => intval( $comment_parent ),             'comment_content' => $comment,             'comment_type' => $comment_type             ) );              wp_reset_query();         global $post; $wp_the_query;              $post = get_post( $comment_post_ID );         setup_postdata( $post );              /* Here's the problem: How to rewind the comments query              so that it will actually display comments. I've tried              all of these things, but they're not working right now */         $wp_query->current_comment = -1;         $wp_query->rewind_comments();              // send comments list again.         include( get_stylesheet_directory(). '/comments.php' );              die(0);         }      The callback just takes the Ajax reponse and updates the comments div with the result. But its missing the whole comment list. Any ideas what I need to call to rewind the comments loop and make it actually display?


title: How make modular WP plugin based on OOP?

text: For example I have _"my-plugin"_ plugin created using class:               class My_Plugin {              public function __construct() {              }         /**          * Other code where I creating plugins admin pagec etc.          */     }     new My_Plugin();      So basically functionality is simple - it creates its option pages in admin. But I want to extend it. For example: one module for adding filter to `the_content` and second module for adding filter to `the_title`. Yes, it is simple may be used in one plugin but this is just for example to understand how to make modular plugin using OOP. So most idea is - user may download only needed part/module of plugin. So if he need only filtering title then he loading `The_Title` module. So question is - how to develop this plugin modules using OOP in WordPress? Maybe code classes that extend main class or additional classes for every module? If so, please, provide me some examples.


title: Mobile version redirects to a whole different website?

text: I have everything set up fine on my desktop/laptop version of the site, but anybody that types my site in on their mobile phone gets redirected to another site that belongs to the same hosting. Is there a way to fix this?


title: Featured image and Media Grid

text:
I am trying to get an image in Media Grid's lightbox to another page. I have the images set up in the media grid plugin and when you click on the image it opens a lightbox with a larger version of the image. At the bottom of the lightbox modal there are links to social and then a link that I added that is just text that says "request info" when the user clicks the request info they are taken to a page with a form (I'm using contact form 7) and there is a field that populates with that image title. What I also want to do is grab that image and have it show up next to the request form. The image variable is $mg_id which shows up in the address bar when you click the original image. The code I'm using to get the title is:
     <?php      global $post;     echo 'Request Info'; ?>
      then there is some shortcode that you put into the contact form 7 admin. I just want to know how to grab the image from the previous page and have it show on the info page. Like I said I can see the $mg_id variable when the lightbox is open I just want to know how to get it to the other page. Thank you


title: custom sort posts in archive/taxanomy page

text: I want to override the default sort order of posts in archive and taxonomy pages. what hooks should I implement?


title: Meta box values are displayed on Custom Fields list. Is it possible to hide them?

text: I have multiple meta boxes for my Custom Post Type posts. I want my users to add new fields using Custom Fields. The problem is - Custom Fields display all the garbage from my metaboxes and it might be very confusing for users. Here's a screenshot, the two first fields were added by an user and the rest comes from the theme itself (there are metaboxes above this "Custom Fields" box which use / reset these fields on post save). How do I hide them? ![](http://i.stack.imgur.com/mSQbJ.png)


title: Replace .wordpress.com url with a domain name

text: I purchased a domain and set redirection to my WordPress blog. If some user shares any of my posts to Facebook it shows the URL example.wordpress.com instead of example.com. What changes should I make to see my original URL (www.example.com) in the Facebook shares?


title: Custom Module, Extending WP with a Plugin?

text: I'm trying to determine the best way to expand on WP. I love the base of WP for a website... it has pretty much everything needed for a website. But now and again I need to be able to create some custom "pages" or small apps within the WP framework. For example, I've created a small app within a sub-directory of my WP install (/cart) for a purchase form. I'm including the WP head for access to the WP methods, but I don't feel that this is the most effective way of extending WP. I've also looked into integrating other PHP frameworks like CodeIgniter and Yii ... again, I'm not sure this is the best approach. Is there a way to create a WP plugin that has it's own "directory" or path? http://mywpinstall.com/customapp/ WP has so many great things going for it, that I'd love to be able to expand on it without touching the core. Thanks in advance.


title: Collect posts from last 48 hours

text: I want to create a custom rss feed               <?php     /*     Template Name: Custom Feed     */          function filter_where($where = '') {         //posts in the last 30 days         $where .= " AND post_date > '" . date('Y-m-d', strtotime('-2 days')) . "'";         return $where;       }     add_filter('posts_where', 'filter_where');         $args=array(           'post_type' => 'post',           'post_status' => 'publish',           'showposts' => -1,           'caller_get_posts'=> 1           );     $my_query=new WP_Query($args);     remove_filter('posts_where', 'filter_where');     header("Content-Type: application/rss+xml; charset=UTF-8");     echo '<?xml version="1.0"?>';     ?><rss version="2.0">     <channel>       <title>Something</title>       <link>#</link>       <description>The latest blog posts from #</description>       <language>en-us</language>     <?       if( $my_query->have_posts() ) {         while ($my_query->have_posts()) : $my_query->the_post(); ?>           <item>         <title><?php the_title(); ?></title>         <link><?php the_permalink() ?></link>       </item>          <?php         endwhile;       } //if ($my_query)?>     </channel>     </rss>     <?PHP wp_reset_query(); //just in case     ?>      Now the final code for Custom Rss feed fetch from 48 hours. I can get right results from it. Thanks for your help. Mohammad Umer


title: How to add defer="defer" tag in plugin javascripts?

text: I couldn't add defer tag in plugin javascripts. Google developer pagespeed test suggests me to add defer tag in **contact form 7** javascripts. This is how contact form 7 includes javascript in header.               add_action( 'wp_enqueue_scripts', 'wpcf7_enqueue_scripts' );          function wpcf7_enqueue_scripts() {         // jquery.form.js originally bundled with WordPress is out of date and deprecated         // so we need to deregister it and re-register the latest one         wp_deregister_script( 'jquery-form' );         wp_register_script( 'jquery-form', wpcf7_plugin_url( 'jquery.form.js' ),             array( 'jquery' ), '2.52', true );              $in_footer = true;         if ( 'header' === WPCF7_LOAD_JS )             $in_footer = false;              wp_enqueue_script( 'contact-form-7', wpcf7_plugin_url( 'scripts.js' ),             array( 'jquery', 'jquery-form' ), WPCF7_VERSION, $in_footer );              do_action( 'wpcf7_enqueue_scripts' );     }      Now how to add **defer="defer"** tag in the above code?


title: Mapping multiple URLs to same page

text: I just came across this page with almost similar requirements as mine Multiple endpoints to same page i have to achieve same functionality but i also want to pass some parameters to the page where all these URL will be map. say example               http://mysite.com/test/link1     http://mysite.com/test/link2      http://mysite.com/test/link3       i want to map them to same URL               http://mysite.com/test/finalDestination      along with it i also want to send some other parameters like   1. user email   2. user name so that i can use them at that page for my custom logic.i know how to do it in JSP/Java where i can send them as a request parameters in POST request and can reterieve them in the final JSP how i can achieve this is wordpress using php.my prefrences are not to use any query string. Or is it possible like if i create URL with like               http://mysite.com/test/user1     http://mysite.com/test/user2      http://mysite.com/test/user3      where user1 etc can be fetched from the database and we can ensure that they will be unique through the application and mapping these URLs to same end point. how can i fetch the username in my final page? Thanks in advance


title: Home Custom Menu Link not Working

text: I'm trying to have the menu link per default when using my custom menus, and in my `functions.php` document I have this:               function home_page_menu_args( $args ) {         $args['show_home'] = true;         return $args;     }     add_filter( 'wp_page_menu_args', 'home_page_menu_args' );      The thing is, in the custom menu options > pages I have this: "No items." So not sure what's going on, it was working in other websites but not in this one, any idea?


title: Add body class of category parent

text: I am not a coder, but I usually get by with Wordpress by doing my research and find my solution. I can't find what I need to do this time so I have attempted to crib together some code - what I am attempting to do is, when I am on the Category Archive, I want to add a body class of the category parent. This is what I have tried and it is working apart from I am getting the parents category ID, but I want the slug/nicename:               add_filter('body_class','hw_custom_body_class');       function hw_custom_body_class($classes){       if(is_category()){       $categories = get_the_category();       $category = strtolower($categories[0]->category_parent);       $classes[]='category-'.$category;       return $classes;    }}


title: Removing short versions of category archive URL

text: I'm looking after a site where someone has configured /%category%/%postname% as the Permalink structure. A side-effect of this seems to be that a category archive will appear both at the usual /category/foo and also /foo. One downside of this is that it creates a duplicate page. Another is that any "Older posts" link on that second page won't work, since it will point to /foo/page/2 which will return a 404. Is there any way to _disable_ the /foo version of the page without changing the Permalink structure?


title: Copying post thumbnail to custom field

text: I've just moved to another theme, and it uses the custom field `bigimage` for associating an image with a post, instead of using WordPress's post thumbnails. How do I copy the URLs of all existing post-thumnails to their corresponding post's `bigimage` custom field? Could we possibly write a bunch of MySQL statements to achieve this?


title: CAPTCHA plugin where I can use my own images and ask my own questions?

text: Just wondering if any of you have run across this kind of plugin. Basically I'd like to be able to (a) specify my own image; (b) specify my own challenge question; (c) specify my own answer. As in: (a) an image of the word "orange" written in Old English (b) "Type the word you see in the picture" (c) the answer is "orange" Does such a plugin exist? Thanks!


title: Category listing with thumbnail and description on home page

text:
I really need a comprehensive solution to this, so I'm offering up almost a quarter of my rep in bounty :) I would like to have a plugin that creates a custom category listing on my home page. To do this, I'd like the "Category Edit" screen to be augmented with some additional functions as described below...   * Adds "Upload/Delete Image" handler to the Category Edit Screen for a Given Category (this allows the end user to upload an image that will be used to represent the category. Ideally, it should automatically be resized to 125 pixels wide by the plugin when uploaded.   * Adds "Category Title" input field to the Category Edit Screen for a Given Category. This is in addition to the existing default "Name" field.   * Adds a checkbox titled "Show on homepage listing" to allow selective display of each category on the home page listing.   * When the home page is viewed, the plugin appends the_content with the custom category listing, including each category's custom thumbnail and title. The resulting markup should be an unordered list with no nesting, like so...

                          Category 1 Title The category description text goes here

                          Category 2 Title The category description text goes here
         etc...
      Here's a stub file I've started...               add_filter( 'the_content', 'cb_category_listing' );          function cb_category_listing( $content )     {         if ( is_home() ) {             $cat_args['title_li'] = '';             $cat_args['exclude_tree'] = 1;             $cat_args['exclude'] = 1;             $myContent = wp_list_categories(apply_filters('widget_categories_args', $cat_args));              $content .= $myContent;         }         return $content;     }


title: raw code vs wordpress

text: I am currently a CS student and an aspiring programmer/web developer. I am wondering whether it is worth taking the time to master html and css to make websites when CMS services/wysiwyg like wordpress and various others seem to be becoming more and more functional. **Does anyone think these publishing services might eventually make the need to design websites from raw code unnecessary? If not, please explain why.** If designing a website eventually becomes as simple as using Photoshop I would much rather invest my time in programming languages.


title: Remove the theme info from main dashboard screen- not appearance

text: I've successfully used the code from the post: Restrict ADMIN menu items based on username, replace username with an actual user's name. The problem is the theme still shows on the main dashboard and by clicking on the theme name the admin is taken to the appearance menu which had been hidden by using the code. Any thoughts how to get around this? Here is the code from the post mentioned:               function remove_menus()     {     global $menu;     global $current_user;     get_currentuserinfo();          if($current_user->user_login == 'clients-username')     {         $restricted = array(__('Posts'),                             __('Media'),                             __('Links'),                             __('Pages'),                             __('Comments'),                             __('Appearance'),                             __('Plugins'),                             __('Users'),                             __('Tools'),                             __('Settings')         );         end ($menu);         while (prev($menu)){             $value = explode(' ',$menu[key($menu)][0]);             if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}         }// end while          }// end if     }     add_action('admin_menu', 'remove_menus');


title: Form to Add Posts to Custom Post Type (Again)

text: I pretty much got my answer in my last question, but not quite. I was supposed to add one last code to my source and it would have worked but the person helping hasn't replied now and I don't know what to do :S Form to Add Posts to Custom Post Type So can anybody tell me where to put `wp_redirect(get_permalink($pid)); exit;` in my code to have it redirect to the post after the post is added to the database?


title: Get custom post_type's archive URL

text: It seems like stupid question. But, I can't figure it out :(. I need to display button at home that goes to custom post_type's archive URL (archive-{post_type}.php). How do I do that?


title: Back End Interface Plugin

text: The Back-end of Wordpress is nice, but I would like to customize the UI to some degree. My goal is to make the user experience REALLY simple for untrained users. I suspect plugins exist for this, but I thought I would ask the experts of Stack Exchange, before chasing any ideas down potentially deep rabbit holes. So, what is the preferred method of UI customization in wordpress?


title: Edit / delete custom post types through web page (not admin)

text: I want it to be possible for the users to edit and delete their own posts, not only through the admin panel as it is by default. I've look around on the net but haven't found any information about it. How can this be done?


title: changing permalink for custom template in posts of a certain category

text: I've created a unique single post template to give people the option of reading all posts of a certain category using the awesome "reveal.js" which they access via this link               presentation      The problem is the ugly URLs, which end up looking like               website.com/post-name/?show=presentation     website.com/completely-different-post-name/?show=presentation      I would like them to look like               website.com/post-name/presentation/     website.com/completely-different-post-name/presentation/      I've spent the last 10 or so hours trying to figure this out (I haven't even gone to sleep yet, lol); unfortunately, nothing has worked. Is there a way to do this? As a side note, the site I'm trying to do this on is installed in a subdirectory (localhost/wp) but I'm developing this for my actual website which is installed in a top level directory


title: Add page as static html into another page

text:
Is there a way to include a wordpress Page into another one? I'm not just talking about getting the content using get_page(), but to import the whole page (theme + content). I have been looking around for hours for a way to achieve this but I can't find a way, I guess it's a pretty unusual thing to try to do, but it's necessary for what I want to do with my site. What I want to achieve is this: Page1 uses this template:               <?php     /*     Template Name: page-template1     */     ?>
      <?php if (have_posts()) : while (have_posts()) : the_post();?>
      <h2 id="post-<?php the_ID(); ?>"><?php the_title();?>

       <?php the_content('
Read the rest of this page »
'); ?>

      <?php endwhile; endif; ?>

     Hello     import_page("page2");
      Page2 uses this template:               <?php     /*     Template Name: page-template2     */     ?>
     World
      <?php if (have_posts()) : while (have_posts()) : the_post();?>
      <h2 id="post-<?php the_ID(); ?>"><?php the_title();?>

       <?php the_content('
Read the rest of this page »
'); ?>

      <?php endwhile; endif; ?>

      Result:
     World
      <?php if (have_posts()) : while (have_posts()) : the_post();?>
      <h2 id="post-<?php the_ID(); ?>"><?php the_title();?>

       <?php the_content('
Read the rest of this page »
'); ?>

      <?php endwhile; endif; ?>

     Hello
     World
      <?php if (have_posts()) : while (have_posts()) : the_post();?>
      <h2 id="post-<?php the_ID(); ?>"><?php the_title();?>

       <?php the_content('
Read the rest of this page »
'); ?>

      <?php endwhile; endif; ?>


title: What's the difference between post thumbnails and featured images (if any)?

text: On the Codex on Post Thumbnails, I see: > Post Thumbnails is a theme feature introduced with Version 2.9. It was > quickly changed to Featured Images with Version 3.0. Post Thumbnail, now > Featured Image, is an image that is chosen as the representative image for > Posts, Pages or Custom Post Types. On the changelog for Version 3.0: > Change Media UI labels from "Post Thumbnails" to "Featured Image" Is there any difference in behaviour of post thumbnails and featured images, or was in 3.0 only the name changed? Why did the name change? It is a source of misunderstanding, as the image size is still called `thumbnail` or `thumb`, while it on the UI everywhere says Featured Image.


title: Valid characters for actions, hooks and filters

text: I haven't ever seen a tag such as `do_action('something_10')`. Is it invalid if I use numbers? If the method is valid, how can I write different numbers in the tag string conditionally? For example, is the following code correct($grade is the number)?               do_action("new_grade_$grade")


title: Export specific menu

text: How can I export a specific menu out of wordpress? I have a list with many URLs and I need to copy it to multiple sites. But I don't want to do it manually.


title: is_user_logged_in returning nothing on custom page

text: I am trying to use WordPress authentication on a custom PHP page however when checking "is_user_logged_in" it returns nothing at all and other functions are also returning nothing helpful. The code I am using is:               require $_SERVER['DOCUMENT_ROOT'] . "/wp-load.php";     require $_SERVER['DOCUMENT_ROOT'] . "/wp-blog-header.php";     print_r(is_user_logged_in());      I have logged into the admin area prior to testing this. When being logged in or logged out the function still doesn't return anything and there are no PHP errors.


title: Move site to new server causes 500 Server error

text: I am moving my WordPress site from my old hosting company to the new one. I am at the current version, 3.5.1. I created the domain on the new site copying over all the files inclusive of any hidden ones, at least to my knowledge, and placed it on the new server. I made sure that the system has PHP5. For the time being, wp-config.php points to the old server for the database. I did copy the database over, but for the time being, as said, the database points to the old site. The problem that I have is that going to the new site causes a 500 server error. How do I find out what the problem is and how to fix the problem? Here is the complete text of the error:               Internal Server Error     The server encountered an internal error or misconfiguration and was unable to complete your request.     Please contact the server administrator to inform of the time the error occurred and of anything you might have done that may have caused the error.          More information about this error may be available in the server error log.


title: Wordpress Gallery shortcode: Display one category ID only

text:
Good Day. I am using a Gallery shortcode in my wordpress site to display images. Problem is that I wasnt the gallery to show only images from a certain category, for example category id 35. How do I specify it in the shortcode? Shortcode:                [custom_gallery style="1" source="**cat=%cat_id%**" link="image" description="0" size="200x200" limit="10"]      Now I have tried the following, but does not work -               cat=%35%     cat=%cat_id=35%      Any suggestions? Thank you SHORTCODE code:               /**      * Gallery posts shortcode      */          function gallery_posts_func($atts, $content = null) {         extract(shortcode_atts(array(             "limit" => '5',             "cat" => '',             "thumb_width" => '',             "thumb_height" => '',         ), $atts));         global $wp_query,$paged,$post;         $temp = $wp_query;         $wp_query= null;         $wp_query = new WP_Query();              $query .= '&posts_per_page='.$limit;         $query .= '&post_type=gallery';         $query .= '&taxonomy=gallery_cat';         $query .= '&gallery_cat='.$cat;              $wp_query->query($query);         ob_start();         ?>         <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
     <?php                          $gogo_gallery_video_url = get_post_meta($post->ID, 'gogo_gallery_video_url', true);                     $gogo_gallery_links_to = get_post_meta($post->ID, 'gogo_gallery_links_to', true);                     $gogo_gallery_title_links_to = get_post_meta($post->ID, 'gogo_gallery_title_links_to', true);                     $gogo_gallery_custom_link = get_post_meta($post->ID, 'gogo_gallery_custom_link', true);                          if ($gogo_gallery_title && $gogo_gallery_video_url && $gogo_gallery_title_links_to=="gallery_title_links_image") {                     echo '
';                         echo '';                     echo ''.get_the_title().'';                     echo '';                     echo '
';                          } elseif ($gogo_gallery_title && $gogo_gallery_title_links_to=="gallery_title_links_image") {                     echo '
';                         echo '';                     echo ''.get_the_title().'';                     echo '';                     echo '
';                          } elseif ($gogo_gallery_title && $gogo_gallery_title_links_to=="gallery_title_links_content") {                     echo '
';                         echo '';                     echo ''.get_the_title().'';                     echo '';                     echo '
';                          } elseif ($gogo_gallery_title && $gogo_gallery_title_links_to=="gallery_title_links_link") {                     echo '
';                         echo '';                     echo ''.get_the_title().'';                     echo '';                     echo '
';                          } elseif ($gogo_gallery_title) {                     echo '
';                         echo ''.get_the_title().'';                     echo '
';                          } else {                     echo '';                     }             ?>

             <?php if (has_post_thumbnail()) { ?>                 <?php                     $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');                          if ($gogo_gallery_video_url && $gogo_gallery_links_to=="gallery_links_image") {                      echo '';                     echo '';                     echo '';                          } elseif ($gogo_gallery_links_to=="gallery_links_image") {                     echo '';                     echo '';                     echo '';                          } elseif ($gogo_gallery_links_to=="gallery_links_content") {                     echo '';                     echo '';                     echo '';                          } elseif ($gogo_gallery_links_to=="gallery_links_link") {                     echo '';                     echo '';                     echo '';                          } else {                     echo '';                     }                 ?>             <?php } ?>
     <?php if ($gogo_gallery_short_desc) { ?><?php echo $gogo_gallery_short_desc; ?><?php } ?>

         <?php endwhile; ?>                   <?php $wp_query = null; $wp_query = $temp;         $content = ob_get_contents();         ob_end_clean();         return $content;     }     add_shortcode("gallery_posts", "gallery_posts_func");


title: Add a custom text to admin footer in a Custom Post Type page

text: I want to customize the footer text in a Custom Post Type admin page. I have a plugin that creates this custom post type and want to add in it a function to customize admin_footer_text. As you can see in code below I can change the footer text, but only globaly.               function my_custom_footer_admin_text () {         echo 'my custom message,';     }     add_filter('admin_footer_text', 'my_custom_footer_admin_text');      Does someone knows the hook of a custom post type page? Or how can I change the footer text of a certain Custom Post Type page?


title: Dynamic sidebar nav with current page highlighting

text: My sidebar loops through all of the child pages based on the parent page. For example, if you're in the "About" section you'll only see "About" child pages in the sidebar. My problem is that I have no way of highlighting the current page. For example, if you're on the child page "Our Team" (under "About") I'd like to give the sidebar "Our Team" a tag link a "current-page" class. Is there a way to add a "current-page" class dynamically to the child page you're on?               <?php      if ( $post->post_parent == '4' ) {         query_posts("post_type=page&post_parent=4&orderby=menu_order&order=asc");      } elseif ( $post->post_parent == '6' ) {         query_posts("post_type=page&post_parent=6&orderby=menu_order&order=asc");     } elseif ( $post->post_parent == '8' ) {         query_posts("post_type=page&post_parent=8&orderby=menu_order&order=asc");      } elseif ( $post->post_parent == '10' ) {         query_posts("post_type=page&post_parent=10&orderby=menu_order&order=asc");      }     if ( have_posts() ) : while ( have_posts() ) : the_post();     ?>     <a href="<?php the_permalink(); ?>"><?php the_title(); ?>     ...


title: How to reset post data properly

text: I have this piece of code that I am calling within the loop to get image metadata ( title/caption and description ). It works fine but it only works for the first post in the loop. So I assume it needs to be reset. From looking here I think `wp_rest_postdata();` is the right way to reset the query, but still the output fails for all but the first post, it repeats the data from the first post for every other post.               function get_image_metadata() {              $image_id = get_post_thumbnail_id($post->ID);         $args = array(             'post_type' => 'attachment',             'post_status' => null,             'post_parent' => $post->ID,             'include'  => $image_id             );          $image_data = get_posts($args);              if ($image_data && isset($image_data[0])) {             $meta_output['title'] = $image_data[0]->post_title;              $meta_output['caption'] =  $image_data[0]->post_excerpt;              $meta_output['description'] =  $image_data[0]->post_content;          }         //wp_reset_query();         wp_rest_postdata();         return $meta_output;     }


title: Problem display only posts with comments

text: I'm trying to make a page that will show only the posts that have comments. I have this in my page template:               <?php     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     query_posts( 'cat=-8378, -13444&orderby=comment_count&paged=' . $paged );     while (have_posts()) : the_post();     ?>      But it's not working. It still just shows my normal post display. Any suggestions? Thanks!


title: Use wp_localize_script for non existing script

text: ## Task: What I'm trying to do I'm fetching data via the WP Http API from a remote server. The data I'm getting back is `JSON` encoded. In one of my methods, I'm converting them back and then push it into a class variable, so I can use it later in some scripts. ## Example: How I'm trying to do it               // Simplified... please note, that all names/vars/etc. in my class got unique names.     // ...the same goes for the script handler.     class http_api_example     {         public $remote_data;         public $response;              public function __construct()         {             $this->request();         }              public function request()         {             $request = wp_remote_request( 'http://example.com/HereYouGetSomeJSON' );             $this->response = json_decode( wp_remote_retrieve_body( $request ) );         }              public function deliver_to_javascript()         {             wp_enqueue_script( 'json_handler', null, array(), null, true );                  // ...then I'm trying to localize it             wp_localize_script( 'json_handler, 'json_object', array(                  'ajaxurl'    => admin_url( 'admin-ajax.php' )                 ,'ajax_nonce' => wp_create_nonce( 'json_handler_nonce' )                 ,'action'     => 'json-handler-action'                 ,'data'       => $this->response              )              }     }      * * * ## Problem: What's not working > For some reason, I can't access the `json_object` from the console (it works > for other objects in other classes just fine). * * * ## Debug so far ### Is it registered and queued? I tried to take a look if the script is registered:               // 'registered': TRUE     var_dump( wp_script_is( 'json_object' ) );          // 'queue': TRUE     var_dump( wp_script_is( 'json_object', 'queue' ) );      to be sure, I've also taken a look into the `global $wp_scripts` and can confirm, that it's there. ### Is it localized?               // Data shows up, JSON encoded     var_dump( $GLOBALS['wp_scripts']->registered['json_object']->extra;      ### Where in core does it stop? I went into core and backtraced it the following way:   1. `wp_localize_script()` **✓**   2. » `$wp_scripts->localize()` **✓**   3. »» `WP_Dependencies: add_data()` **✓**   4. »»» `WP_Dependencies: add_data()` **FIN!** The **FIN!** notes a call to itself. As you can see from the Link to the WP repo on GitHub, inside `->add_data()`, there's another call to `->add_data()` (to itself). I dumped the result and got `TRUE` back. I'm currently out of "what can I try else?"-options. Maybe someone got an idea, how this is supposed to work or maybe just where I could try to look further. Thanks.


title: Help With A Reverse Pagination Plugin

text: I saw this presentation about why pagination on the Internet is weird. https://speakerdeck.com/u/espylaub/p/pagination-on-the-internet-and-why-its- weird It inspired me to try and make a WordPress plugin to do just that. Here's what I've got so far...               <?php     /*     Plugin Name: Reverse Pagination     Description: Pagination starts higher and goes lower for more consistent archive page numbering.     Author: Russell Heimlich     Version: 0.1     */                function reverse_pagination_pre_get_posts($t) {            $q = $t->query_vars;          if ( empty($q['order']) || ((strtoupper($q['order']) != 'DESC') && (strtoupper($q['order']) != 'ASC')) ) {             $q['order'] = 'ASC';          }               $t->query_vars = $q;     }          function reverse_pagination_wp() {         global $wp_query;         $wp_query->posts = array_reverse($wp_query->posts);     }          if( !is_admin() ) {         add_action('pre_get_posts', 'reverse_pagination_pre_get_posts');         add_action('wp', 'reverse_pagination_wp');     }       I hook into the `pre_get_posts` action and switch the order query var to ASC instead of the default DESC. Next I needed to reverse the order of the posts returned so they are in reverse chronological order. I chose the `wp` action for the reasons outlined in this answer http://wordpress.stackexchange.com/a/22768 So things are looking good so far. I just need to fix the first page. Right now if my blog has 50 pages and there is no `paged` parameter set the blog index page will show my very first post instead of the latest post. I need some logic to check if `paged` isn't set to set it to the same value of `$wp_query->max_num_pages` for that query. I also need to disable the canonical redirect that removes /page/1/ from the URL and tweak the `get_pagenum_link()` function so it returns /page/1/ for `get_pagenum_link(1)` http://hitchhackerguide.com/2011/02/12/get_pagenum_link/ If there is anything else that can be added to make this plugin better please speak up! Thanks and I hope we can make this happen by working together on it.


title: Associating post id with its post type

text:
i'm making modifications to a portfolio theme. the theme has the blog and portfolios. the portfolios are custom post types with their respective taxonomies. the theme homepage only displays one portfolio. that is, it only shows the posts for one custom post type. the theme displays the most recent posts for each category of the custom post type and creates a filter menu that is populated with the categories. this way a user can filter the displayed posts by category like "graphic design" and a JS script hides the posts that are not of that category. i need to mix the posts of all portfolios and the blog on the homepage. so i need to query all the recent posts from all portfolios and the blog, populate the filter menu with post types, and then pass that over to the JS script to hide the posts that are not of the selected post type. i've managed to query all the recent posts from all portfolios and the blog, and populate the filter menu with post types using the code below: THE COMMENTED CODE IS THE ORIGINAL CODE, e.g. $terms                <?php      $args=array(         'post_type' => array('post', 'test-bscm', 'test-btum', 'test-other', ),         'posts_per_page' => 16     );     $temp = $wp_query;      $wp_query = null;     $wp_query = new WP_Query();     $wp_query->query($args);     /*$terms = get_terms($pcat);*/     ?>          //populate the filter with post types     <?php      $args=array(  'show_in_menu' => true);     $output = 'names';     $terms = get_post_types($args);     ?>                    <?php if ($home_portfoliolayout=="No Categories") {          echo '
';     } else if ($home_portfoliolayout=="Categories") {         echo '
';     } ?>
             <?php             echo '
'.__('All Projects', 'apex').'|
';             foreach ( $terms as $term ) {                 $filter_last_item = end($terms);                 if($term!=$filter_last_item){                     echo '
'.ucwords(str_replace('-', ' ', $term)).'|
';                 }else{                     echo '
'.ucwords(str_replace('-', ' ', $term)).'
';                 }             }             ?>

      i am able to see a 16 posts that represent the most recent posts to the blog, test bscm portfolio, test bum portfolio, and the test other portfolio. the filter shows: All Projects, Post, Pages, Test Bscm, Test Btum, and Test Other. i need to remove Pages from the results because it is not needed. here's the code to how the results are displayed and so how the JS script hides posts...                             <div class="sixteen columns row <?php echo $folioteasers ?> portfolio">              <?php if ($wp_query->have_posts()) : ?>         <?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>              <?php                $custom = get_post_custom($post->ID);             $foliocatlist = get_the_term_list( $post->ID, $pcat, '', ', ', '' );             $entrycategory = get_the_term_list( $post->ID, $pcat, '', '_', '' );             $entrycategory = strip_tags($entrycategory);             $entrycategory = strtolower($entrycategory);             $entrycategory = str_replace(' ', '-', $entrycategory);             $entrycategory = str_replace('_', ' ', $entrycategory);             $entrytitle = get_the_title();             $blogimageurl = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );             if($blogimageurl==""){                 $blogimageurl = $templateurl.'/images/demo/460x272.jpg';             }         ?>              <div class="<?php echo $foliocolumns ?> columns teaser all-group <?php echo $entrycategory ?>">            <a href="<?php the_permalink(); ?>" data-text="» <?php _e('Visit Project', 'apex'); ?>" class="hovering"><?php echo ''; ?>
                <a href="<?php the_permalink(); ?>" class="bigplus">
<a href="<?php the_permalink(); ?>"><?php echo $entrytitle ?>

<?php echo $foliocatlist ?>

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

<?php _e('Oops, we could not find what you were looking for...', 'apex'); ?>

         <?php endif; ?>              <?php          $wp_query = null;          $wp_query = $temp;         wp_reset_query();         ?>

      as you can see it's based on the post category. so of course when i try to filter by one of the listed post types all results are hidden. so the solution is to associate the post id with its post type. i know it comes after the $custom = get_post_custom($post->ID); and i'll replace all that code for foliocatlist and entrycategory i just haven't found it in the codex. thanks.


title: Applying post title filter: Last Viewed Posts + qTranslate

text: I'm using Last Viewed Posts (LVP) plugin on a qTranslate-enabled website. LVP shows post titles in both languages. I found this hint: titles in recent posts appear together in all languages with qtranslate But not sure how to apply this filter. Relevant code in LVP:                       foreach ($zg_post_IDs as $value) { // Do output as long there are posts             global $wpdb;             $zg_get_title = $wpdb->get_results("SELECT post_title FROM $wpdb->posts WHERE ID = '$value+0' LIMIT 1");             foreach($zg_get_title as $zg_title_out) {                 echo "post_title . "\">". $zg_title_out->post_title . ", \n"; // Output link and title             }      Instead of `echo $post->post_title;` it has `$zg_title_out->post_title`. Replacing the whole zg string with `apply_filters('the_title',$post->post_title)` didn't work.


title: How do post a Photo to Facebook when a post is published?

text: I have a wordpress site. It is now using the official Facebook plugin. When a new post is published, an action will be posted to Facebook. The posted message contains a small thumbnail , post title and some description. But I want to change this approach. I found Posterous allow user post a photo to Facebook when a post is published. Does anyone know any Wordpress plugin which can post a photo to Facebook when publishing? Thanks all. :)


title: How to know which wordpress plugin is exporting site information to plugin author?

text: Is there any plugin or method to know outgoing data? Nowadays every 5th plugin use to fetch data from sites. And I noticed that plugin authors are very enjoying this function. But as plugin users I'm liking it sometimes. So far I've been digging into plugin files to remove their codes. But its not possible to do after every plugin update. I think this features is facilitated by wordpress own functions. Is there any method to turn it off? **Edit:** For example Yoast seo plugin uses this file to fetch information about users. He even gets contents from database queries. Isn't it too much? The same way any plugin can get passwords too.


title: Creating and Using Tables in the Wordpress Database

text: I plan on having over 2,000 pages per subject on my WordPress website and since each subject will require custom page types I would like to create tables for each subject in the WordPress Database. Each page will also require lat/long and alternate title's for each page created. Can someone explain how you would go about making and using a dedicated table for each custom Page Type? I assume that you could use an exact copy of wp_post table?


title: Identical members roles on all sites in a multisite

text: In a multisite system I need editorial accounts with custom rights. Therefore I have chosen the members plugin. As I do have lots of sites, creating and synching the roles for all sites becomes quite tedious. a) is it possible to manage my roles for all sites globally (network-wise)?   b) would you suggest to use a different plugin?


title: How to create pagination that links to Posts directly and not a numbered page?

text: I have site that displays 1 post per page, I would like to paginate this automatically with numbers underneath the post. Default function for pagination is to link to say ?page=2. I searched but can't find specifics that closely match my requirements, I also attempted to use this answer: But it would not automatically update. So, the function required. 8 post = 8 numbers, Click on a number, takes you directly to that post, < and > to take you to the next post, This has to be done from index and not from inside a post, Automatic and dynamic So far I can get it to work it's neither dynamic nor automatic pagination. Already answered? how could I get the pagination as I want to when query posts using get_posts function I don't think it has been answered, That person has 2 posts per page and wants the pagination to link different. From reading the page which was difficult I was unable to establish a similarity. I want to have 12 posts, the index aggregates these 12 posts, if I set to show 1 post per page that is 12 pages for 12 posts in the pagination and when I select it say number 2,the url becomes the page/2/. What I want is when you click the pagination number 2, it takes me to /%date%/%post_name% Which is a different setup from the post linked as already being answered, hope this makes better sense.


title: Add a widget to a static front page

text: I'm using a premium theme, which I purchased and would like to add a social widget to the static front page. I've made a static page with a image slider my home page. An example of the page can be found here. How do I go about adding a social widget to this page? Any help will be greatly appreciated. Thanks in advance.


title: add_action in a function, is it possible?

text: I am trying to add some js to the head using `add_action('wp_head', 'js_func');` which works when posted just after the function, however I do not want it posted on every page, just the page that it's relevant to and I am trying to do it like so               function things_to_do_on_this_page() {         add_action('wp_head', 'js_func');         //other functiony things     }      However when it is called like so the js isn't placed at all, thus breaking the page. Is it possible to do this?


title: White screen on front page only

text: I've got the famous white screen, but only on my home page. Deeper pages load just fine. I moved my `themes` directory to `themes-old` and made a new `themes` directory that only has twentyten in it. I changed my theme to twenty ten. I don't have any plugins enabled, but I moved my plugins directory and created a new, empty plugins directory. I turned debugging on. I'm at a total loss here. I did make some theme tweaks today, but I already restored the back up of my theme which didn't help, and anyway I've now set twentyten as my theme.


title: Make a difficult page editable

text: There's this page http://voitair.com/scent-system/scent-system I need to make editable via admin panel. It has to be understandable for a non-programmer. What system or plugin or anything can I use to make it still function as now but be editable?


title: wordpress login blank screen

text: i wanted to make an offline copy of my live website on my pc so i installed xamp and installed on it wordpress and exported the database and took a copy of files on fttp and after i have done eveything and i wanted to make open my live website to edit something it gives me a blank page when i open                "www.sitename.com/wp-admin"       but when i open               "www.sitename.com/wp-login.php"      it open put when i insert username and password it also gives me blank page i opened the wp-config and i found that dp host became **"localhost"** i think this is my problem but how can i get my dbhost back is there a way to find it


title: Can I host WP-admin locally for a remote blog?

text: I'm having an issue where my theme creates a pile of images sizes on uploads (because it's supposed to), and my server periodically gags on the process. It's resulting in a pile of "MySQL server has gone away for..." problems, and I end up with media uploads that contain no data. A dedicated server isn't in the budget. And my web host isn't a big fan of making more RAM available to my account. So moving from my current hosting solution isn't an option. However, I've got a test server sitting here in my office with 4 CPUs and 16GB of RAM, and I thought, "Hey, is there a way I can host all the WP-admin functions locally, and simply push changes to the remote server?" A thousand apologies if this has been asked elsewhere. Everything I could find on the subject was just about setting up a local testing server. My case is different - I want the back end hosted somewhere other than the front end (and yes, the final DB should obviously also be remote, unless I can find a way to simply push DB changes to the live server).


title: save_post not called in plugin / custom field still saving overwriting metaboxes

text: I have a plugin that writes metaboxes to certain pages. It writes the metaboxes fine and everything works as should...until I save. The save_post is not getting called, and I can't figure out why. Here is the code in my __Construct               class Plg_Admin_Meta {          public static function start() {      return new self();     }           public function __construct() {       $this->plugin_url = WP_CONTENT_URL . '/plugins/' . basename(dirname(__FILE__));       $this->plugin_dir = dirname(__FILE__);            add_action('admin_init', array($this, '_admin_init'));         add_action('save_post', array($this, '_save_post'), 99);     }      The metaboxes are made from custom fields, and if I edit a custom field text area it saves fine, but I want it to save the data entered from the metabox instead. For whatever reason the save_post will not fire. I tried putting a die(var_dump($_POST)) at the start of my _save_post function and it isn't even firing. Here is my _save_post function               public function _save_post($post_id) {       //die(dump_var($_POST));       update_post_meta($post_id, 'content__service_overviews', "test2");       // Post meta isn't sent for autosaves       if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {         return;       }     }          Plg_Admin_Meta::start();      As you can see I am just manually trying to update a field right now, but the function isn't even getting called. EDIT: Requested entire class:                 class Plg_Admin_Meta {              public static function start() {          return new self();         }               public function __construct() {           $this->plugin_url = WP_CONTENT_URL . '/plugins/' . basename(dirname(__FILE__));           $this->plugin_dir = dirname(__FILE__);           $this->prefix = 'content__';           $this->page_fields = array(             'site' => array(               'textarea:slideshow',               'text:address',               'text:phone',               'text:fax',               'text:twitter_link',               'text:weather_link',               'text:meta_description',               'text:meta_keywords',               'text:google_analytics_account_number',               'text:google_site_verification_code'             ),             'home' => array(               'textarea:about_enernex',               'textarea:introducing_utility_stats',               'textarea:recent_content',               'textarea:workshop_button'             ),             'about' => array(               'textarea:what_we_do_photo',               'textarea:what_we_do',               'textarea:our_mission_photo',               'textarea:our_mission',               'textarea:get_to_know_us_photo',               'textarea:get_to_know_us_principals',               'textarea:get_to_know_us_staff'             ),             'careers' => array(               'textarea:why_enernex_photo',               'textarea:why_enernex',               'textarea:support_our_mission_photo',               'textarea:support_our_mission',               'textarea:the_innovation_valley_photo',               'textarea:the_innovation_valley_our_location'             ),             'contact' => array(               'textarea:photo',               'textarea:contact_information',               'textarea:map_image',               'textarea:directions'             ),             'employees' => array(               'text:title',               'textarea:text',               'textarea:photo'             ),             'support' => array(               'textarea:announcing_utility_stats',               'textarea:faq',               'textarea:utility_ownership_key',               'textarea:support'             ),             'newsroom' => array(               'textarea:service_overviews',               'textarea:media_contacts',               'textarea:industry_resources_and_related_links'             ),             'services' => array(               'textarea:main_text',               'textarea:power_systems_consulting_photo',               'textarea:smart_grid_engineering_photo',               'textarea:smart_grid_labs_photo',               'textarea:workshops_photo'             ),             'iec-workshop' => array(               'textarea:first_photo',               'textarea:course_overview',               'textarea:topics_covered',               'textarea:our_instructors',               'textarea:workshop_dates',               'textarea:who_should_attend',               'textarea:key_benefits',               'textarea:schedule_location_and_cost',               'textarea:second_photo',               'textarea:location'             ),             'cyber-security' => array(               'textarea:meet_the_team',               'text:media_kit_download_link'             )           );                $this->post_fields = array(             'news' => array(               'textarea:overview',               'textarea:story'             ),             'press' => array(               'textarea:overview',               'textarea:story'             ),             'whitepapers' => array(               'textarea:overview',               'textarea:uploads'             ),             'areas' => array(               'textarea:overview',               'textarea:uploads',               'textarea:projects'             ),             'links' => array(               'text:URL'             ),             'jobs' => array(               'textarea:basic_function',               'textarea:education_and_experience',               'textarea:skills',               'textarea:duties_and_responsibilities',               'textarea:contact_information',               'textarea:notes'             ),             'employees' => array(               'text:position',               'text:department',               'text:year_joined',               'text:power_industry_years',               'text:education',               'text:expertise',               'text:phone',               'text:email_address',               'textarea:biography',               'textarea:headshot'             ),             'blog' => array(               'textarea:author',               'textarea:content'             ),             'announcements' => array(               'text:link_to_announcement',               'textarea:content'             )           );                          add_action('admin_init', array($this, '_admin_init'));             add_action('save_post', array($this, '_save_post'), 99, 2);                           }                   public function _admin_init() {                $post_id = isset($_REQUEST['post']) ? $_REQUEST['post'] : false;           if ($post_id) {                  $content = get_post($post_id);             $slug = $content->post_name;             $post_type = $content->post_type;                  if (isset($post_type)) {                    switch($post_type) {                      case 'page':                   $this->_create_metaboxes('page', $this->page_fields[$slug]);                 break;                      case 'post':                   $category = get_the_category($post_id);                   $slug = $category[0]->slug;                   $this->_create_metaboxes('post', $this->post_fields[$slug]);                 break;                    }                  }                }              }              public function _create_metabox_content($post, $metabox) {                $post_id = $post->ID;              $meta_key = $metabox['args']['meta_key'];           $meta_value = get_post_meta($post_id, $meta_key, true);                switch ($metabox['args']['type']) {                  case 'text':                    ?>                    <input type="text" name="<?php echo $meta_key; ?>" value="<?php echo $meta_value; ?>" style="font-family:'Georgia', 'Times New Roman', 'Bistream Charter', 'Times', 'serif';font-size: 13px; line-height: 19px; color: #333; width: 100%;" />                    <?php                  break;                  case 'textarea':                    wp_editor(                  $meta_value,                 $meta_key,                 array(                   'textarea_name' => $meta_key,                   'textarea_rows' => 4,                   'tinymce' => array(                     'content_css' => $this->plugin_url . '/tinymce.css'                   )                 )                       );                       break;                }              }              public function _create_metaboxes($post_type, $fields_array) {                if (!empty($fields_array)) {                    wp_enqueue_style('admin', $this->plugin_url . '/admin.css');                      foreach ($fields_array as $field) {                        $tokens = explode(':', $field);                   $type = $tokens[0];                   $meta_key = $this->prefix . $tokens[1];                   $id = 'metabox_' . $tokens[1];                   $title = ucwords(preg_replace('/\_/', ' ', $tokens[1]));                                    add_meta_box(                     $id,                     $title,                     array($this, '_create_metabox_content'),                     $post_type,                     'normal',                     'high',                     array(                       'meta_key' => $meta_key,                       'type' => $type                     )                                     );                      }                }              }                public function _save_post($post_id) {              //die(var_dump($_POST));         // Post meta isn't sent for autosaves         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {           return;         }              update_post_meta($post_id, 'content__service_overviews', "test2");                     if (isset($_REQUEST['post_ID'])) {                         foreach ($_REQUEST as $meta_key => $meta_value) {                 if (strstr($meta_key, $this->prefix)) {                      //update_post_meta(intval($_REQUEST['post_ID']), meta_key, meta_value);                      }                    }                     }              }                 }                 Plg_Admin_Meta::start();


title: WP_Nav Highlight Parent Issue

text:
I'm trying to figure out how to highlight the parent nav of a page and becoming stuck. I've seen something like this :               <li <?php if(is_page('services')) { echo 'class="current_page_item"'; } ?> >          Services
      I have different post types going on and I've split each post type into a page, the problem begins when I click down into the "services" tab and click a "service request" the blog navigation highlights instead of the services one. How can I fix this? I don't mind using PHP or CSS for this as the site is for myself.


title: Error timed out with succesfull wp_remote_post

text: **What I'm trying to do:** Passing POST data by using wp_remote_post.               foreach ( $articles as $article_id ) {         $postarray = array(         'method'        => 'POST',         'timeout'       => 5,         'redirection'   => 5,         'httpversion'   => '1.0',         'blocking'      => true,         'headers'       => array(),         'body'          => array(             'article_id' => $article_id             ),         'cookies' => array()         );              $response = wp_remote_post($url, $postarray);              if ( is_wp_error($response) ) {             $error_message = $response->get_error_message();             echo $error_message;         } else {             // the rest of my code here         }     }      I'm working with 20+ posts per call. Everytime the loop finish, I get this error message: > "Operation timed out after 5001 milliseconds with 0 bytes received" The strange thing is, the data are actually received and stored successfully on the designated `$url` server. Can anyone point me to the right direction, where should I look to avoid getting that error message? Reference: wp_remote_post


title: Dynamic Sidebars based on page name

text: I would like to do a dynamic sidebar for my WordPress site, so it would pull in the correct Sidebar template based on the page title of the page. So if I had 10 sidebars all named like this: Sidebar Template Name: About Sidebar Template Name: Contact Sidebar Template Name: Jobs Sidebar Template Name: Etc Sidebar Template Name: Page1 So the Sidebar 'About' would appear on the About page, and the same for contact, etc... Any idea How I would do this? Or Is there an alternative way on how to do it?


title: Dont' charge customer until product ships - woocommerce

text: Is it possible to set woocommerce to not charge the customer until the product actually ships?


title: How to display first post

text: I want to display in the front page of my theme the first most recent post in the header and then continuing the loop in the main content section starting from the second to post and so on, how can i achieve this?


title: Child Site doesn't appear in the Network menu

text: As you see in the snapshot, just the main site appear in My Sites menu, Although it appears correctly in the "Network Admin". I used the subdomain installation when I configured the Wordpress MU. And this is the Wordpress MU part in wp-config.php               define('WP_ALLOW_MULTISITE', true);          define('MULTISITE', true);     define('SUBDOMAIN_INSTALL', true);     define('DOMAIN_CURRENT_SITE', 'www.mydomain.com');     define('PATH_CURRENT_SITE', '/');     define('SITE_ID_CURRENT_SITE', 1);     define('BLOG_ID_CURRENT_SITE', 1);      ![just the main site appearing](http://i.stack.imgur.com/8e4nB.png)


title: How do I create custom tags for Wordpress SEO?

text: I'm using Wordpress SEO by Yoast, the free version and wondering if there is a way to create custom tags such as %%city%%. I want to make my own that can pull data from another plugin i'm using as a "directory" called Web 2.0 Directory. I want to input options inputted from that such as %%doctorname%% and %%city%%. Is this possible? If so what file(s) should I reference and can you give me a brief overview on how to go about that?? Each directory listing has separate fields for these items, but I cannot seem to figure out where I can create my own tag calls to produce these custom tags. Thanks!


title: Wordpress Search documentation: how to improve search query using taxonomy terms, custom meta fields?

text: I'm trying to understand how Wordpress search works. I haven't found much info on the Codex. Arguably, search is not the best WP feature. Even Wordpress.org uses Google Search. I would like to make a custom search form to allow people search using my custom taxonomies and custom meta fields. I'd imagine the search query would work exactly as a normal WP query, therefore a tax query and a meta query should be possible. But how to pass the user submitted form data to a search query? Is it possible to pass form variables to the /?s= search string in the address bar? that would make things easier... I know there are many plugins around. Some of them quite complex. But I don't mind learning my own way and eventually the few I tried would require some adaptation for my theme (which uses almost ten different post types and a bunch of custom taxonomies, plus loads of custom fields handled by Advanced Custom Fields plugin). Is there any detailed article that goes in depth regarding this matter? EDIT I just came up with an idea, to make a form in one page, then pass the input fields variables with $GET to another page template which holds a custom WP_Query and with some IFs and ELSEs perform a custom query... Eventually I will post an answer with the code when I'm done. This is close to what I was asking, although I wanted to know if it was possible without creating a new template with a new query, oh well...


title: Can't save postmeta data

text:
I am trying to save custom fields data in custom post type but nothing reach the database. Same code was working fine in another plugin but won't work here. Here is the code.               class SH_job_post_class{                        public function metaboxes(){             add_action('add_meta_boxes', function(){                 add_meta_box('SH_job_listings_metabox', __( 'Extra Information Required For Job*', 'sh_textdomain' ),                     array($this, 'cb_function_for_meta_box'), 'sh_job_listings', 'normal', 'high');             });         }              public function cb_function_for_meta_box($post){             // Nounce field to protect form             wp_nonce_field( 'my_meta_box_nonce', 'sh_meta_box_nonce' );             $value = get_post_meta($post->ID);          $applyby = isset($value['SH_applyby'])? $value['SH_applyby'] : '';             ?>
                 Apply For                 <input type="text"  name="applyby" id="applyby" value="<?php echo esc_attr($applyby);  ?>" />
                   <?php             add_action('save_post', function($post_id){                  // Stop the script when doing autosave                 if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;                      // Verify the nonce. If insn't there, stop the script                 if( !isset( $_POST['sh_meta_box_nonce'] ) || !wp_verify_nonce( $_POST['sh_meta_box_nonce'], 'my_meta_box_nonce' ) ) return;                 // Stop the script if the user does not have edit permissions                 if( !current_user_can( 'edit_post' ) ) return;                      // Save the textfield                 if( isset( $_POST['applyby'] ) ){                     update_post_meta( $post_id, 'applyby', strip_tags( $_POST['applyby'] ) );                 }                       });                   }                              }          add_action('init', function(){         new SH_job_post_class();     });


title: Rewrite post type slug only for child theme

text: I'm in multisite where some blogs share the same parent theme for maintenance reasons. All my cpts come from that parent theme, but I would really like that, for one of the blogs, it had an URL mask. I found this answer very useful to change labels, but I've tried to do the same and assign a different slug to `$wp_post_types[$post_type]->rewrite['slug']` and it fails, bringing the whole rewrite array to NULL. I've also tried .htacces with `RewriteRule ^/newslug$ /oldslug [L]` but with no success. Is there a clean way to do this?


title: Rewrite rules not working in WordPress

text: I'm trying to add the new rewrite rules using the rewrite API:                add_rewrite_rule('product/([A-Z0-9]{10})', 'index.php/product/?asin=$1', 'bottom');      add_rewrite_rule('product/(([A-Za-z0-9_])*)', 'index.php/product/?product=$1', 'bottom');      add_rewrite_rule('compare/((([A-Z0-9]{10}),?)*)', 'index.php/compare/?asin=$1', 'bottom');      add_rewrite_rule('categories/(([A-Za-z0-9]|\-|\_)*)', 'index.php/categories/?subcategory=$1', 'bottom');      After the permalink is updated it adds the following lines to the `.htaccess` file:               RewriteRule ^product/([A-Z0-9]{10}) /index.php/product/?asin=$1 [QSA,L]     RewriteRule ^product/(([A-Za-z0-9_])*) /index.php/product/?product=$1 [QSA,L]     RewriteRule ^compare/((([A-Z0-9]{10}),?)*) /index.php/compare/?asin=$1 [QSA,L]     RewriteRule ^categories/(([A-Za-z0-9]|\-|\_)*) /index.php/categories/?subcategory=$1 [QSA,L]      resulting to the following `.htaccess` file:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteRule ^product/([A-Z0-9]{10}) /index.php/product/?asin=$1 [QSA,L]     RewriteRule ^product/(([A-Za-z0-9_])*) /index.php/product/?product=$1 [QSA,L]     RewriteRule ^compare/((([A-Z0-9]{10}),?)*) /index.php/compare/?asin=$1 [QSA,L]     RewriteRule ^categories/(([A-Za-z0-9]|\-|\_)*) /index.php/categories/?subcategory=$1 [QSA,L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      But when I tried to access the following URL:               http://example.com/product/ABCDE324AB      It doesn't seem to work. I always get a page not found page. Any ideas?


title: custom post type tags

text: I have this code:               $args=array(             'post_type' => array ('portfolio'),             'orderby' => $orderby,             'order' => 'DESC',             'paged' => $paged,             'posts_per_page' => $post_per_page,             'ignore_sticky_posts' => $do_not_show_stickies           );             if($pf_categorynotin){                 $args['tax_query'] = array(                     array(                         'taxonomy' => 'portfolio_category',                         'field' => 'slug',                         'terms' => $pf_categorynotin,                         'operator' => 'NOT IN'                     )                 ); //category__in             }      What I'm asking is how to add also "portfolio_tag" taxonomy because I want to list tags from my custom post type. Any suggestions on how to achieve this ? Thanks! Later edit: here is snippet of the code that is used to retrieve portfolio categories and how they are displayed: snippet


title: How can I only display links from a child category

text: Using this code from the codex:                      <?php     $category = get_the_category();     if($category[0]){     echo 'term_id ).'">'.$category[0]->cat_name.'';     }     ?>      Codex link: http://codex.wordpress.org/Function_Reference/get_the_category I am able to display the category the post is in as a link (e.g. Business). However, I don't want to display the parent categories. I only want to display the child categories of a certain parent category. My category structure is like this: Premium (Parent) > Premium Themes (Child) > Ecommerce (Child), Business (Child), Photography (Child), etc. So I only want to display the children of the Premium Themes category. Any help much appreciated.


title: How to recognise on which site the content is being rendered?

text: I've created a child theme basing on twenty twelve. Since I present the content a little bit different on home and on the archive page, I'd like to know inside `content-[format].php` on which page the post is being rendered. Then, I can decide which image size I can present. How can I know it?


title: Is it possible to enqueue a script from a widget method (of extended WP_Widget object)?

text:
I am creating a widget plugin that a user could potentially use multiple iterations of the widget multiple times on a single widget-area / multiple widget-areas on a single page. Because of its functionality there will be differing widget-level variables that I will need to individually pass from PHP to JavaScript to take action on (via jQuery). I have used a `$widget_id` to wrap around the widget which works fine HTML-wise. However I am having trouble passing the information to JavaScript -- at least when attempting to use `wp_localize_script` to pass info to the JavaScript file. My attempt to accomplish this was done by adding the action-hook to enqueue the JavaScript in the widget method. Unfortunately it appears that I can't even get the JavaScript to be enqueued from there, let alone am able to pass it information! Here's what I have:               class my_widget extends WP_Widget {        private $widget_id;        private $variable;         private $plugin_location;            function my_widget() {         parent::WP_Widget(false, $name = 'My Widget Plugin');         $this->plugin_location = plugin_dir_url(__FILE__);       }            function widget($args, $instance) {            $this->widget_id="widget-".time().rand(1,100).rand(1,100); //make a unique id for widget, i know there are probably better ways to do this... but this works for now...         extract( $args );         $this->variable = $instance['variable'];         add_action('wp_enqueue_scripts', array( &$this, 'plugin_scripts' ));         echo '
widget_id . '">';         ...         create & output widget         ..         echo '
';        }             ... irrelevant widget administration functions ...       public function plugin_scripts(){         //here we set up & pass relevant information specific to EACH INDIVIDUAL widget (can have multiple in a single widget-area) for jQuery to execute functions & methods on to the JavaScript file         $widget_info_to_pass = array(           "widget_id"  =>  $this->widget_id,           "variables"  =>  $this->variables         );              wp_register_script( 'my-site-script'.$this->widget_id, $this->plugin_location . "js/my.js", array('jquery'),'1.2.0');         wp_enqueue_script( 'my-site-script'.$this->widget_id );         wp_localize_script('my-site-script'.$this->widget_id, 'php_params', $widget_id_to_pass);       }                }            add_action('widgets_init', create_function('', 'return register_widget("my_widget");'));      This doesn't enqueue the script, I am fairly certain because widget doesn't fire until after `wp_enqueue_scripts` hook has come and gone. Important to note: **it appears that to use`wp_localize_script` you have to call the function before wp_head.** To that note, I tried most of the hooks and was unable to even have the script enqueue at all let alone enqueue before `wp_head`. If I could even get the widget method to enqueue a script I can somehow manually add embedded JavaScript defining the information for each widget instance (maybe an associative array?) - but I can't get it to enqueue any scripts at all. Is it possible to enqueue a script from the widget method of the extended `WP_Widget` object or am I fighting an unwinnable battle here? Are the other ways to do this that I am missing? \------------------- UPDATE --------------------- I updated it using your advice like such:               class my_widget extends WP_Widget {        private $widget_id;        private $variable;         private $plugin_location;            function my_widget() {         parent::WP_Widget(false, $name = 'My Widget Plugin');         $this->plugin_location = plugin_dir_url(__FILE__);       }            function widget($args, $instance) {            $this->widget_id="widget-".time().rand(1,100).rand(1,100); //make a unique id for widget, i know there are probably better ways to do this... but this works for now...         extract( $args );         $this->variable = $instance['variable'];        //here we set up & pass relevant information specific to EACH INDIVIDUAL widget (can have multiple in a single widget-area) for jQuery to execute functions & methods on to the javascript file         $widget_info_to_pass = array(           "widget_id"  =>  $this->widget_id,           "variable"  =>  $this->variable         );         wp_register_script( 'my-site-script'.$this->widget_id, $this->plugin_location . "js/my.js", array('jquery'),'1.2.0');         wp_enqueue_script( 'my-site-script'.$this->widget_id );         wp_localize_script('my-site-script'.$this->widget_id, 'php_params', $widget_id_to_pass);         echo '
widget_id . '">';         ...         create & output widget         ..         echo '
';        }             ... irrelevant widget administration methods ...          }            add_action('widgets_init', create_function('', 'return register_widget("my_widget");'));      To make sure I am being passed the proper info, I made my.js contain the following:               widget_id = php_params.widget_id;     variable = php_params.variable;     console.log(widget_id + "---" + variable);      Unfortunately it only outputs to the console the FINAL `widget_id` and variable three times. Any reason why this happens? Any idea how to make it output the proper iterations?


title: Remove ?ver= from wp_register_script

text: I'm getting nags on google speed test regarding the querystrings in my scripts. So, I'm trying to remove them by passing false as the argument for that parameter. However, it does not seem to have effect:               wp_register_script('myscript', get_bloginfo('template_directory').'/scripts.myversionnumber.js',false,false,true);     wp_enqueue_script('myscript');      PS: the "myversionnumber" part of the js filename is my means of controlling cache/versioning rather than the ?ver= approach which apparently trips up some proxy servers (according to Google pagespeed test): > **Remove query strings from static resources** Enabling public caching in > the HTTP headers for static resources allows the browser to download > resources from a nearby proxy server rather than from a remote origin > server. Learn more > > **Suggestions for this page** > > Resources with a "?" in the URL are not cached by some proxy caching > servers. Remove the query string and encode the parameters into the URL for > the following resources:


title: Where does wp_redirect need to be placed to make it work?

text: I've got a front end post editing page located at mysite/post_id/edit and am trying to redirect users that are not the author back to the post. Here's the code I'm working with:                   <?php         global $current_user; get_currentuserinfo();         if($post->post_author != $current_user->ID):         wp_redirect( the_permalink() ); exit;         ?>      The problem I've been having is that this seems to just display the post's permalink rather than redirecting. wp_redirect says "wp_redirect will not be called if the page has started, so make sure to call it higher up." - but after having placed the code at the top of the header.php file I still received the same issue of the permalink being displayed rather than redirecting. Where would be the appropriate place to add this code to make it redirect? Thanks in advance! **EDIT** : Tried something with milo's advice, but will follow Tommix's post before I update on Milo's