title: Bizarre Permalinks Issue: 404 Errors Everywhere

text: First and foremost, this is definitely a duplicate of the age old question of "my Wordpress permalinks are generating 404 errors", but in a way it's different because no solutions I've tried have worked. **A little back-story to my problem:** I developed a Wordpress site locally, all permalinks and everything worked. I installed a new copy of Wordpress on the server, imported all of my local posts and everything on the homepage looked great, this is where the greatness ends. None of the permalinks work, the pages, posts (all posts are using custom post types), they all give me the message: **"Not Found The requested URL /content/we-need-to-talk-about-kevin/ was not found on this server."** The post type this post belongs to is called: "sketcphad" however I have a rewrite on my register_post_type function that makes it "content" which definitely works locally, so that's not the issue. **Things that I have tried:**   1. Manually replacing the .htaccess rewrite rules, then deleting it and re-adding it in again   2. Adding in flush_rewrite_rules() into my functions.php file   3. Visiting the settings -> permalinks page, then clicking save   4. Trying another permalink structure (currently it's /%postname%) I tried a few others to no avail   5. Tried deleting the content and re-adding it in manually   6. Tried re-adding in the pages manually The puzzling thing about this situation is the site works locally, what could be happening on my server to cause these issues? The server is running basically the same LAMP environment with exception my local LAMP environment is using XAMPP on Windows, but I've moved plenty of sites from local to a remote server without an issue like this. What am I not seeing? **See below for my functions.php code that registers the post types.**               function sketchpad_posttype()     {         // Labels for our custom post type         $labels = array(             'name' => _x('Content', 'sketchpad'),             'singular_name' => _x('Content Entry', 'sketchpad'),             'add_new' => _x('Add New', 'Content Entry'),             'add_new_item' => __('Add Content Entry'),             'edit_item' => __('Edit Content Entry'),             'new_item' => __('New Content Entry'),             'view_item' => __('View Content Entry'),             'search_items' => __('Search Content Entries'),             'not_found' =>  __('Nothing found'),             'not_found_in_trash' => __('Nothing found in Trash'),             'parent_item_colon' => ''         );              // Arguments that specify how we use our custom post type         $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             'menu_icon' => get_stylesheet_directory_uri() . '/images/icons/notepad.png',             'rewrite' => array('slug' => 'content'),             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => null,             'supports' => array('title','editor', 'thumbnail'),             'taxonomy' => array('category')         );              // Call the register_post_type function and make it official         register_post_type( 'sketchpad' , $args );     }          function article_posttype()     {         // Labels for our custom post type         $labels = array(             'name' => _x('Articles', 'article'),             'singular_name' => _x('Article', 'article'),             'add_new' => _x('Add New', 'Article'),             'add_new_item' => __('Add Article'),             'edit_item' => __('Edit Article'),             'new_item' => __('New Article'),             'view_item' => __('View Article'),             'search_items' => __('Search Articles'),             'not_found' =>  __('Nothing found'),             'not_found_in_trash' => __('Nothing found in Trash'),             'parent_item_colon' => ''         );              // Arguments that specify how we use our custom post type         $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             'menu_icon' => get_stylesheet_directory_uri() . '/images/icons/notepad.png',             'rewrite' => array('slug' => 'article'),             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => null,             'supports' => array('title','editor','thumbnail'),             'taxonomy' => array('category')         );              // Call the register_post_type function and make it official         register_post_type( 'article' , $args );     }          // Register our custom post types     add_action('init', 'sketchpad_posttype');     add_action('init', 'article_posttype');


title: Menus - Open items in new tab/window?

text: I have 3.1.2 running with the Boldy theme. Site link. I have a menu that has a number of external links listed in the items.   By default, these items do NOT load in a new tab/window. There is no option in the Admin --> Appearance --> Menus, to tick a box to say open in new window. How do I get them to do this?


title: Why not working jquery show() function in wordpress?

text:
I try create a quick comment form on my wordpress with a link like this: ![enter image description here](http://i.stack.imgur.com/vKDGW.jpg) My plan is when you click this link,you get a comment form with jquery show() function, where you can add a comment in ajax.   jquery:                $.noConflict();      jQuery( ".comment-mezo" ).click(function() {      jQuery( "#comment-mezo" ).show( "slow" );     });      html:               Quick comment
       <textarea id="comment"></textarea>
        <input type="submit">
      This function work outside wordpress(i tryed it on jsbin), but inside not.   Why?   We know this thanks for Rares P and sri.:   The jquery is loaded and working.   The id change not help.   The show.js is loaded when the paged is loaded.   And we use this for the script load:               <?php        function show() {       wp_enqueue_style( 'style-name', get_stylesheet_uri() );       wp_enqueue_script( 'script-name', get_template_directory_uri() . '/show.js', array() );        }        add_action( 'wp_enqueue_scripts', 'show' );?>


title: get a list of all registered actions

text: i'm trying to debug a plugin which i didn't create and i want to list all registered actions. i read this http://stackoverflow.com/questions/5224209/wordpress-how-do-i-get-all-the- registered-functions-for-the-content-filter but it's specific to one hook and it's about filters, not actions. Is there any variable like $wp_filter or something?


title: Post thumbnail dependant on category

text: I have two categories (our work and news) and only one single.php If looking at a single post in the news category then I want to show the thumbnail too so have inserted: `<?php if ( has_post_thumbnail() ) {the_post_thumbnail('medium');} ?>` But I dont want this to appear if viewing a single post within the our work category, what can I add to remove this for category ID#2?


title: Can You Require the Use of JavaScript in a WordPress Plugin?

text: I commonly use Mozilla Firefox for testing changes I make for a plugin that I'm developing. I also have the NoScript addon installed because it is also my main browser. I noticed that the Administrative menu in WordPress not only is missing icons ( I get the boxes with numbers which indicates that I failed to load the font icon set ), but completely fails to show when I click the appropriate menu button ( muscle memory ). I am assuming that this means the menu fails to work with JavaScript. Now, does this mean I can therefore require JavaScript for the administrative end of my plugin? What if I decide to use Ajax? Or, how about the end-user side; can I require JavaScript there? My main concerns for these questions lies in accessibility and compatibility...


title: get_results suddenly not working on a single table

text: I'm trying to get a list of rows from the DB. All tables work except the one I need. No errors are thrown, don't even get a blank array. My SELECT statement works fine in phpmyadmin directly, but not through Wordpress. Any ideas what might be going on? Its driving me nuts.               $wpdb->get_results("SELECT * FROM  properties")


title: child_of not working while searching

text: I'm trying to limit search to a parent page and its own child pages. I've changed searchform.php adding this code:               <input type="hidden" value="<?php         global $post;         $ancestors2 = $post->ancestors;         if ($ancestors2) {             echo end($ancestors2);         } else {             echo $post->ID;         } ?>" name="childof" />      Also I've add a function to my theme's functions.php:               function SearchFilter($query) {     if (is_search() && !empty($_GET['s']) && !empty($_GET['childof'])) {         $parent_page_id = intval($_GET['childof']);         $query->set('child_of', $parent_page_id );     }     return $query;     }     add_filter('pre_get_posts','SearchFilter');      I've tested variables with `var_dump($query)` and it returned:               ["child_of"]=>         int(104)      But, I still can see search results from other pages and not only from parent page (or its child pages). Why? Thanks!


title: ID of Front-Page

text: I like to get the ID of the selected front page. My page uses an Template for that page. I've read about `get_option('page_on_front')`, but this didn't work for me. Is there any function to get this ID?


title: custom post type template changes between preview and publish

text: I have set up a custom post titled `project` where I have also set a theme file `page-project.php`. When I create a post under that custom post type, and I preview it, it shows on the using the `page-project.php` template, however once I publish it and view the page, it uses the `index.php` template. Can someone tell me why this is happening? This is my custom post type from `functions.php` FYI: just found this out, if I turn permalinks to default settings, it uses the correct template as well.               add_action('init', 'project_register');      function project_register() {         $labels = array(             'name' => _x('My Projects', 'post type general name'),             'singular_name' => _x('Project', 'post type singular name'),             'add_new' => _x('Add New', 'project item'),             'add_new_item' => __('Add New Project Item'),             'edit_item' => __('Edit Project Item'),             'new_item' => __('New Project Item'),             'view_item' => __('View Project Item'),             'search_items' => __('Search Project'),             'not_found' =>  __('Nothing found'),             'not_found_in_trash' => __('Nothing found in Trash'),             'parent_item_colon' => ''         );         $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',             'rewrite' => true,             'capability_type' => 'page',             'hierarchical' => false,             'menu_position' => null,             'supports' => array('title','editor','thumbnail','author')           );              $labels = array(         'name' => _x( 'Project Types', 'taxonomy general name' ),         'singular_name' => _x( 'Project Type', 'taxonomy singular name' ),         'search_items' =>  __( 'Search Project Types' ),         'all_items' => __( 'All Project Types' ),         'parent_item' => __( 'Parent Project Type' ),         'parent_item_colon' => __( 'Parent Project Type:' ),         'edit_item' => __( 'Edit Project Type' ),          'update_item' => __( 'Update Project Type' ),         'add_new_item' => __( 'Add New Project Type' ),         'new_item_name' => __( 'New Project Type Name' ),         'menu_name' => __( 'Project Type' ),       );          register_taxonomy('project_type',array('project'), array('hierarchical' => true,         'labels' => $labels,         'show_ui' => true,         'query_var' => true,         'rewrite' => array( 'slug' => 'type' ),));         register_post_type( 'project' , $args );     }


title: Custom Rewrite for Profiles

text: I'm currently trying to modify my rewrites to allow for an additional URL segment e.g. http://example.com/vendors/username/ by default WP allows for additional numeric segments but everything else returns a 404 error. e.g. http://example.com/vendors/test. I'm curious as how I would go about allowing URL's like these. My current structure is: http://example.com/vendors/?username=example It should be: http://example.com/vendors/username AND/OR http://example.com/username But it still has to serve the original page: http://example.com/vendors/username/ I've previously examined this article, but still couldn't sort it out: http://www.hongkiat.com/blog/wordpress-url-rewrite/


title: How to run multiple websites from single WordPress setup

text: I want to create a website like visahq.com in WordPress, actually visahq.com has multiple websites like visahq.in for India, visahq.ru(will be shown in Russian) for Russia etc. and each TLD has multiple sub-domains like visahq.in has a sub-domain for Australia http://australia.visahq.in/ like on for each country. Content of all websites are almost same with some changes based on conditions. My problem is I want to manage all TLD and sub-domains on a single WordPress setup how can I do this with WordPress.


title: Wordpress get the latest plugin installed details

text: I dont know which plugin is giving the error "bp_setup_current_user was called incorrectly" calling before the buddypress installed. How can I get the details of latest plugin installed in the wordpress?


title: How to make javascript work on theme options page

text: Gentlemen! I'm composing a theme options page for my WP theme. And I bumped into the problem of finding the proper way to introduce inline jQuery interactions to the page. Ideally for me in the situation will be inline jQ code               <script type="text/javascript">         $(document).on({             ready: function(){                 alert('Hey!');             }         })     </script>      But this code fails because I guess the admin options page is rendered before the jQuery is included so js generates expected error. The same code with no jQ identifiers works ok means I get alert window when introduce:               <script type="text/javascript">          alert('Hey!');     </script>      Question is how to properly introduce inline js containing jQ (or any other framework) syntax and make it work?


title: pagenavi shows alot of pages calculated from all posts in the site with query_posts

text: I need to excute posts from 2 seprated keywords using `s=keyword` with `get_posts`, but only searching in titles. I found this answer. I created a custom template to use it in single page. Then I used a merged `get_posts` in my answer using this So, my custom template code is:               <?php /* Template Name: custom template posts */ ?>          <?php get_header(); ?>     <?php add_filter( 'posts_search', '__search_by_title_only', 500, 2 ); ?>     <?php     //first query     $blogposts = get_posts(array(         's' => 'keyword1', 'showposts' => -1,         ));     //second query     $authorposts = get_posts(array(         's' => 'keyword2', 'showposts' => -1,         ));     $mergedposts = array_merge( $blogposts, $authorposts ); //combine queries     $postids = array();     foreach( $mergedposts as $item ) {     $postids[]=$item->ID; //create a new query only of the post ids     }     $uniqueposts = array_unique($postids); //remove duplicate post ids     $mypostcount = count($posts);     $posts = get_posts(array(                 //new query of only the unique post ids on the merged queries from above         'post__in' => $uniqueposts,         'posts_per_page' => 12,         'paged' => $paged,         ));?>     <?php remove_filter( 'posts_search', '__search_by_title_only', 500 ); ?>     <div class="post-listing">     <?php foreach( $posts as $post ) : ?>     <?php setup_postdata($post); ?>     // layout code here     <?php endforeach; ?>     </div>     <?php query_posts('paged='.$paged.'&posts_per_page='. $cat_query); ?>     <?php if(function_exists('tie_pagenavi') ) { tie_pagenavi(); } ?>     <?php wp_reset_postdata();?>     </div>     <?php get_sidebar(); ?>     <?php get_footer(); ?>      When I go to wordpress admin, create new page change the default template for it, every thing is okay, but one problem my pagination showing a lot of pages which empty after the last page the number of all pages calculated from all posts in my database. I am using a custom theme which has an internal pagenavi in it called `tie_pagenavi()`. I also tried the `wp_pagenavi` plugin. **Note: I am using`$mypostcount = count($posts);` to calculate the number of posts. I tested it by echo. It is really returned by the actual posts number in this loop but I am not sure how to use it to limit the pagination numbers.** You can check every thing by your self in `http://elnhrda.com/e/sisi2posts/page/56/`. 56 is the last page which has posts. **Edit:** After searching and testing more, the problem is coming from this line query_posts('paged='.$paged.'&posts_per_page='. $cat_query); If I remove it the pagination disappears. If I add `'&showposts=2000'` to it the pages numbers changed the total number of my posts divided into 2000.


title: Remove line breaks from <code>?

text:
This code form HTML editor:               [shortcode]         [bar]foo[/bar]         [bar]foo[/bar]         [bar]foo[/bar]     [/shortcode]      Returns:               [shortcode]
        [bar]foo[/bar]
        [bar]foo[/bar]
        [bar]foo[/bar]
     [/shortcode]      Codes white-space is set to pre-wrap in css (and I want it this way) and I'm using this piece of code (works for shortcodes, usually):               remove_filter( 'the_content', 'wpautop' );     add_filter( 'the_content', 'wpautop' , 99 );`enter code here`      I don't want to use plugins or delete these line breaks using JavaScript. Any ideas? I can't edit WP core files too (only theme's). I know it's doable because I've seen many premium themes with pretty & clean code sections. [edit] Using `<code><pre>contents</pre></code>` somehow deletes all the `<br/>` tags from code (why?), but I don't want to add `<pre>` every time I write some code.


title: Add action to create new post after wp_insert_post fires? Think it's creating an infitnite loop

text: I need to take the post meta from a post, and create a custom post type post. I'm using the code below but think it's creating an infinite loop. When wp_insert_post fires I have create_cptpost function execute which gets the PID of the post created `$post_id` gets a custom field `ac_1` then I need to create a new post in the cpt post type and update the post meta. Is there another way to do this? I'm basically trying to copy the first normal post content to a new custom post type post.               function create_mycpt( $post_id ) {          $post = get_post($post_id, ARRAY_A);              if ( wp_is_post_revision( $post_id ) )             return;               $ac1 = get_field('ac_1',$post_id);          $my_post = array(       'post_title'    => 'The title',       'post_type' => 'mycpt'     );          $pid = wp_insert_post( $my_post );          update_post_meta($pid, 'ac_1', $ac1);               }     add_action( 'wp_insert_post', 'create_mycpt' );


title: how bbPress and buddypress add their own page templates to the page template drop down on the page editing screen

text: Im writing a plugin and need to know how to add a page template in the edit page screen from within a plugin. bbPress and Buddypress both add page templates to this drop down and I can't figure out how they do it. Not looking for template_redirect solution, needs to work in the backend. I am already making use of template_redirect and don't need any help with it! Any assistance would be appreciated.


title: How to hook into the quick edit action?

text: I found this solution to automatically assign parent terms when a child term is selected, which is working fine for the **save_post** hook:               add_action('save_post', 'assign_parent_terms');          function assign_parent_terms($post_id){     global $post;          if($post->post_type != 'product')         return $post_id;          // get all assigned terms        $terms = wp_get_post_terms($post_id, 'product_cat' );     foreach($terms as $term){         while($term->parent != 0 && !has_term( $term->parent, 'product_cat', $post )){             // move upward until we get to 0 level terms             wp_set_post_terms($post_id, array($term->parent), 'product_cat', true);             $term = get_term($term->parent, 'product_cat');         }       }     }      As I have a large number of posts, I need to hook into the **quick edit action** , not just into the save-post action. Anybody has a solution of this hook?


title: How to define  a term for custom taxonomy

text: I have a custom post type called `q-questions`, and it has a custom taxonomy that called `q-categories`.   I insert post via `wp_insert_post` and I want to define some terms for the taxonomy   My code is:                 $my_post = array(     'post_title' => 'Custom-tax',     'post_content' => 'This is my post.',     'post_type' => 'q-questions',      );          $post_id = wp_insert_post( $my_post );      What should I do to define the `q-categories` for this post as `my-category`?


title: Multiple loops on index page with sticky post and pagination

text:
First post on this site. Hope to get some help from you guys. Probably a simple answer for you experts. I have two category's (news & work). I want to show on my index page (wordpress startpage/blog) the five latest news at the top (cat. news). Below that i want to show my post (cat news & work). I also have sticky posts in the work cat, that I want to only on the first page. I think this means three loops. one for news, one for sticky in work & news, and then one for work & news, none sticky. I can get this to work, but the problem is that my sticky post shows up first on all the pages when I paginate on the index-file (eg. press the read prev post, /page/2, /page/3 etc.. How can I make the sticky post to be sticky only on the first page (index.php)? Here is my code:
          <?php $wp_query = new WP_Query(array('category_name' => News, 'posts_per_page' => 5)); ?>          <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>              <?php get_template_part( 'loop', 'index' ); ?>          <?php endwhile; ?>          <?php wp_reset_postdata(); ?>

                    <?php if ( $paged != True ): ?>          <?php $wp_query = new WP_Query(array('post__in' => get_option('sticky_posts'), 'category_name' => Work)); ?>          <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>              <?php get_template_part( 'loop', 'index' ); ?>          <?php endwhile; ?>          <?php wp_reset_postdata(); ?>          <?php endif ?>                                        <?php $wp_query = new WP_Query(array('post__not_in' => get_option('sticky_posts'), 'category_name' => Work, 'posts_per_page' => 8, 'paged' => $paged)); ?>          <?php while ($wp_query->have_posts()) : $wp_query->the_post(); ?>                  <?php get_template_part( 'loop', 'index' ); ?>              <?php endwhile; ?>          <?php wp_reset_postdata(); ?>
      Thanks /K My pagination code:               function pagination() {        global $wp_query;      $total = $wp_query->max_num_pages;      // Only paginate if we have more than one page      if ( $total > 1 )  {          // Get the current page          if ( !$current_page = get_query_var('paged') )               $current_page = 1;          // Structure of “format” depends on whether we’re using pretty permalinks         $permalinks = get_option('permalink_structure');         $format = empty( $permalinks ) ? '&page=%#%' : 'page/%#%/';         echo paginate_links(array(               'base' => get_pagenum_link(1) . '%_%',               'format' => $format,               'current' => $current_page,               'total' => $total,               'mid_size' => 2,               'prev_next' => False         ));     }     }


title: How to Remove the Custom Theme Panel from a Theme?

text: How does one remove the custom theme admin panel from a theme that has the options to change colours, layouts, etc? Thanks. K


title: Rewrite /category/cars into /topics/cars

text: I know there are plenty of question and posts about this out there, however I couldn't find a solution or existing thread to my specific question. If I list my categories and click on "cars" the url looks like this `url/category/cars` Is it simply possible to use some function in functions.php to change the word `category` into e.g. `topics` `url/topics/cars` Any ideas on that? Thank you in advance!


title: What types of files can I upload with the Wordpress Uploader?

text: I have a domain with Wordpress 3.4.2 installed on it. (This is NOT a Wordpress.com site) What kind of files can I upload? I know .jpeg, .gif, .png, .mp3, etc. are accepted, but where can I find a complete list of the accepted file types? Basically, what can I upload via this screen: ![enter image description here](http://i.stack.imgur.com/22Y4g.jpg)


title: How can I use "getarchives_where" to get monthly archives for static pages?

text: I would like to get monthly archives for static pages. I tried to use the next code:               add_filter('getarchives_where','my_archives_filter');     function my_archives_filter($where_clause) {     return "WHERE post_type = 'page' AND post_status = 'publish'";     }      and in the sidebar I write:               add_filter('getarchives_where','my_archives_filter');                    wp_get_archives('type=yearly');     remove_filter ('getarchives_where','my_archives_filter');      But it doesn't work. Can you help me? Thanks.


title: Wrong user registration date in wordpress

text: I have this funny problem and I'm not able to locate where it happens.   The problem is when a user registers on my site his/her registration date is wrong (not just wrong but total rubbish, even if I add them manually from the admin panel).   I tried deactivating every plugin and theme installed on wordpress to no avail.   The problem persists no matter what. Here is a screen shot from phpmyadmin.   ![enter image description here](http://i.stack.imgur.com/qtPOj.png)   Help me, please.


title: Long permalinks get split with multidots and get broken

text: I have pages which are nested in 3 levels, i.e:               www.example.com/cinema-in-our-country/our-festivals/first-festival-with-very-long-name As you can see the permalink gets quite long. If I go to the TinyMCE editor, write festival name and try to add a link on it to direct to that festival page, I get such generated link (notice three dots):               www.example.com/cinema-in-our-country/our-festivals/first-f...l-with-very-long-name And the link does not work, it directs to 404 page. If I update the link with the correct, it saves well. Actually I cannot repeat this behavior all the time. Sometimes this works just fine from the beggining. Any ideas what can couse this?


title: Detect what page was linked-from

text: Is there a Wordpress way of detecting which post or page on the site you linked-from? The aim is to display custom content, in this case a category archive grid at the bottom of the current page, depending on which page you were last on. If not a directly Wordpress way, then a best-practices php way of doing this, like an easily-accessible place in the database?


title: Single.php different behaviour from admin to non-admin

text:
For the same post, I have suddenly a weird behaviour of `single.php` file between normal user and administrator. In the beginning of the loop, I perform:               echo '
';     print_r($GLOBALS['wp_query']);     echo '
';      And the result is different. **In the case of administrator:**               [queried_object_id] => 603         [request] => SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = 'test' AND wp_posts.post_type = 'aya-bi-aya'  ORDER BY wp_posts.post_date DESC       **In the case of non-administrator:**               [queried_object_id] => 0         [request] => SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  WHERE 1=1  AND wp_posts.post_type = 'aya-bi-aya' AND (wp_posts.post_status = 'publish')  ORDER BY wp_posts.post_date DESC LIMIT 0, 10      I spent one day and a half trying to figure out what can be the reason behind this dysfunctionning, but in vain. Your time is really invaluable.


title: Add custom content to nonexistent page

text: I am trying to add content to what would otherwise be a 404 page. For example I want to define post content for mysite.com/existing-page/imaginary-page instead of showing the 404 page. I've tried several different approaches and none work, so I greatly appreciate your help. My actual structure is this: mysite.com/personal-development/class. mysite.com/personal-development exists but mysite.com/personal-development/class does not. mysite.com/personal- development/class will display altered content from mysite.com/personal- development if seems like add_rewrite_rule would work if the class page actually existed.               add_action( 'init', 'dynamic_classes_class_type_rewrite' );     function dynamic_classes_class_type_rewrite()     {         global $wp_rewrite;         add_rewrite_tag( '%personal-development%', '([^&]+)' );         add_rewrite_rule(             '^personal-development/([^/]*)/?',             'index.php?page_id=17318&class_type=$matches[1]',             'top'         );         }      This one catches the page and cancels the 404. It then shows the home page content but does not use the template style-sheets or allow me to change the content. The example below is my attempt to get the appropriate content and display it. I also tried displaying a different template. I was able to display the template, but was still not able to display any content.               add_filter('template_redirect', 'dynamic_classes_class_type_redirect' );     function dynamic_classes_class_type_redirect()      {     //for best seo I am setting up a redirect for pages.         global $wp, $wpdb, $wp_query;         if(!$post_title=get_post($post)->post_title)//looks like we hit a 404         {             $url=explode('/',dynamic_classes_page_url());//see if its one of our dynamically created pages.             if(count($url)>4)//we need to make sure this long enough             {                 $db_prefix= $wpdb->prefix;                 $sql='SELECT ID                       FROM '.$db_prefix.'posts                       WHERE post_name=\''.implode('',array_slice($url,-2,1)).'\' /*get the second to last*/                       LIMIT 1';                 $rs_class = $wpdb->get_results($sql);                 if($rs_class)                 {                     status_header( 200 );                     $wp_query->is_404=false;                     wp_reset_query();                     setup_postdata(get_post($rs_class[0]->ID));                 }             }         }     }      add_action and 'the_post' will allow me to alter content as I need to, but not for 404s - even if I cancelled the 404 as in the above example.               add_action( 'the_post', 'my_the_post_action' );     function my_the_post_action( $post_object ) {         $post_object->post_content='Programmer test.';     }


title: WP_LINK_PAGES Generating Unnecessary </p> Tag

text:
This is the current output for my WP_LINK_PAGES, notice the unnecessary `</p>` tag at the end. My code for my custom WP_LINK_PAGES can be found here.
 1 2 3 4 Next page


title: Why can't I click on my content or highlight text with my tooltip?

text: The front page works, but I can't seem to click on any content within the site. I can click on my header/footer fine to access the pages, but I can't seem to do anything with the content between header and footer. For example, if I click on "Business Models", I can't click on "Affordability", or highlight the text with my tool tip. I don't know what I did wrong! It was working before. I disabled all my plugins, so you'll see a lot of short codes through out the content if you venture out that far. http://knowledex.org/stella/energymap/ Thank you beforehand for the support! I'm on Chrome and have tested on multiple computers on Safari/Chrome.


title: check if wordpress is updating or publishing a post

text: Very simple question: How can I check when wp is doing an update or a publishing to a post? Because I have to check a postmeta value which could be only true if the post is actually being published and so it has not to be already present in the system. E.g. if( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) it's defined when wp is doing an autosave. Is there anything like this when it's doing an update? Thank you!! ok so               add_action('save_post', 'fields_news_save');     function fields_news_save($post_id){     $errors = false;            if(get_check_key($_POST['checks_news'])==0){         $errors = true;              update_option('custom_token', $errors);         update_option('custom_admin_errors', $txt_err=error_text($errors, 2));              remove_action('save_post','fields_news_save');         wp_update_post(array('ID' => $post_id, 'post_status' => 'draft'));         add_action('save_post', 'fields_news_save');              return false;     }     }      The "if" clause check if there are meta post values set as $_POST['checks_news'] and this is the function which does the quer: `function get_check_key($checker){ global $wpdb; $data = array(); $wpdb->query(" SELECT * FROM $wpdb->wp_postmeta WHERE`meta_value`= $checker; "); return $wpdb->num_rows; }` Now what i would like to do is the "if" at the beginnig checks if the number of rows is 0 AND wp is doing a publish not an update.


title: Exclude parent category when getting category posts by slug

text: I have the following category layout:               Resources         -- Documents      I want to list the posts in the documents category, and have the following code:               $args = array(             'posts_per_page' => '-1',             'orderby'          => 'ID',             'order'            => 'DESC',             'category-name'    => 'documents'                          );     $surveys = get_posts($args);      This returns the posts in both documents AND resources categories. I only want those in 'documents'. I know there is ways to exclude categories by ID but I need to use the category slug as my dev and live databases do not match.


title: Is get_permalink also the canonical URL?

text: The question says it all. Does permalink equal canonical URL? Or is there another way to get the canonical URL?


title: Multisites - Select homepage based on location

text: Would it be possible to have index.php of domain.com to be a dropdown to choose the homepage based on whether the user is in city x or city y? I'd then like a cookie to be set that remembered the user's choice.


title: Closing WP_LINK_PAGES DIV ID w/After Argmuent

text:
In my code below I need to close the div "link_wrap" which I created with `$args['before'] = '<div id="link_wrap">';` When I try to paste `$args['after'] = '</div>';` _above_ `return $args;` it adds the appropriate closing div but also renders the rest of my code, which allows _both_ previous/next links and pagination, completely useless. How do I properly close the div while maintaining the functionality of the rest of my code?               // WP_LINK_PAGES: Add prev and next links to a numbered link list     add_filter('wp_link_pages_args', 'wp_link_pages_args_prevnext_add');              function wp_link_pages_args_prevnext_add($args)     {         global $page, $numpages, $more, $pagenow;              $args['before'] = '
';         $args['link_before'] = '';         $args['link_after'] = '';              if($page-1) # there is a previous page             $args['before'] .= ' '. _wp_link_page($page-1)                  . $args['link_before'] . $args['previouspagelink']  . '' . ' '             ;              if ($page<$numpages) # there is a next page             $args['after'] = ' '. _wp_link_page($page+1)                . $args['link_before'] . $args['nextpagelink']  . ''             ;              return $args;          }


title: Nav menu items disappearing (but not immediately)

text: I'm working on a site where some of the nav menu items disappear (from the front end, the back end, and the database). However, debugging is extremely difficult since they don't disappear immediately! As a result, I'm unable to figure out what's triggering the deletion. More info:   * It seems as though nav menu items that are of the 'custom' variety (e.g. to an arbitrary url, rather than a post/page/category etc.) might be safe. I'm not 100% sure about that yet.   * At one point, new nav menu items were not being saved - I'd add several to a menu, click "Save Menu", and the menu would be saved with no menu items. Any suggestions on how to debug this particularly frustrating problem? This is on 3.4.1. I've just updated to 3.4.2, but I can't verify yet today that it's still happening (although I've no reason to believe it won't). Edit: I have confirmed that "custom" nav items (links to arbitrary url, vs. a WP page/category/etc.) do not get deleted.


title: Removing "Noindex, follow" from pages

text: I am using WordPress SEO plugin written by Yoast. This plugin, by default, shows "noindex,follow" on every page. I am sure I know the file that displays "noindex, follow" but after much "tweaking" I can't seem to remove the code. Here's the file: https://plugins.svn.wordpress.org/wordpress- seo/tags/1.2.8.3/frontend/class-frontend.php I'd really appreciate if you can let me know which line needs to be commented out, or what needs to be edited. :)


title: Entry page for a wordpress multisite

text: I am quite new too WP multisite, so forgive me for my ignorance on things. I have set up multisite ok and have setup 4 sites (i am using subdomains) >   * mysite.com // the root site >   * london.mysite.com // subsite >   * oxford.mysite.com // subsite >   * manchester.london.com // subsite > All the subsites are using the same template, well child templates of the main template so i can change the background colour of the site for each particular subdomain. on the `mysite.com` doamin, I would like to have a really simple page, could be static html for all i care, simply with links to each of the subdomains, there is to be no other content in this main domain just images or something similar so the visitor can go to the subsite they require. Whats the best way of doing this? i take i i cant just upload a static `index.php` as this will break the subsites. and as i have the default page for the site set to this i guess i have to load in the main wordpress index.php whatever i do. thanks for your time and suguestions


title: outlook calendar event from form post

text: After someone fills out a form on my site (using gravity forms) is there any known integration/widget that would allow me to have an "Add this event to my Outlook Calendar" link in the submission email/text? Thanks


title: How to query for most viewed posts and show top 5

text: Here is how I am getting the views for one post:               function getPostViews($postID){             $count_key = 'post_views_count';             $count = get_post_meta($postID, $count_key, true);             if($count==''){                 delete_post_meta($postID, $count_key);                 add_post_meta($postID, $count_key, '0');                 return "0 View";             }             return $count.' Views';         }      Let's say I want to find the most viewed posts from 5,000 posts and I want to show the top 5 most viewed posts. How can I make a query to achieve this?


title: Why doesn't WP_PLUGIN_DIR definition use DIRECTORY_SEPARATOR?

text: Whilst writing some code that backs-up a plugin, I hit a problem with 'the wrong kind of directory slash' on my windows dev environment. Tracking it through I find in default-constants.php:91               define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );      which is based on the following in default-constants.php:46               define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );      and hence to the config file definition...               define('ABSPATH', dirname(__FILE__) . '/');      So my question is: Q. Why are both ABSPATH and WP_CONTENT_DIR, which are intrinsically file system specific (ie can't be interpreted for URL's), definied using explicit forward slashes, rather than PHP's own DIRECTORY_SEPARATOR ?


title: How to prevent upload of a multiple sizes of images

text: on my theme, i found this script               add_image_size( 'slider', 464, 249, true );     add_image_size( 'fmenu', 306, 280, true );     add_image_size( 'teamthumb', 138, 207, true );     add_image_size( 'imlink', 286, 140, true );     add_image_size( 'albmlink', 274, 274, true );     add_image_size( 'fppost', 90, 90, true );      add_image_size( 'fslide', 520, 280, true );        i have disabled this, but when i upload another image, its generates 3 more images... like this:               original_file.jpg     origiinal_file-100x100.jpg     origiinal_file-109x109.jpg      i need only to upload the original file, there's a way to solve this?? I can't find where is this another 2 images sizes...


title: Permissions for installing themes and files in general?

text: www.net2ftp.com shows my permissions to be               rwxr-xr-x      for the top level directory which I aptly named wordpress ( test site ). This would be for ( user | group | other ) and ( read | write | execute ) so that I have write permissions if I am " user ". I am of course logged into wordpress with the only account that was setup at the beginning of the installation process. Because wordpress would not install unless I copy pasted the config file over manually...it seems it differentiates between manual editing of files and software copying/editing of files. Not to sure why? When I do an install I get the error:               Unable to create directory /home/domain/public_html/wordpress/wp-content/uploads/2012/03. Is its parent directory writable by the server?


title: Disabling Comment Notifications for Post Author

text: I am trying to disable comment notifications for post authors (or anyone else besides the site's admin) for a client's site. I've attempted to create a plugin that uses the pluggable function `wp_notify_postauthor`, but it does not seem to have an effect. Here's the plugin code:               <?php     /**      *      *      * @package   Disable_plugin_notifications      * @author    Me      * @link      <hidden>           *      * @wordpress-plugin      * Plugin Name:       Disable Comment Notifications      * Plugin URI:        <hidden>      * Description:       <hidden>      * Version:           1.0.0      * Author:            <hidden>      * Author URI:        <hidden>      */               // Disabling comment notifications for post authors     if ( !function_exists( 'wp_notify_postauthor' ) ) {         function wp_notify_postauthor() {             return;         }     }      I've also tried it without the 'return' in the function.


title: How to add category to: 'wp-admin/post-new.php'?

text: I want to have a link to create a new post that sets the category also. I have tried `wp-admin/post-new.php?post_category=12` and `wp-admin/post- new.php?cat=12`, but neither worked. I also tried using the name rather than the id of the category; which also had no affect. **How do I create a link to a new post with a default category?**


title: Hyperlink to create new post with predefined category

text: Complete WordPress novice here. I have created a site for my workplace. Items are sorted by category. On the dashboard (I have installed a custom dashboard plugin) I want to have a link which says "Upload Newsletter". When clicked, the user will be taken to a new post page on which the "Newsletter" category has already checked. I've read about hooking into various features to be able to do this but I have no idea what it all means. I need an idiots guide! Step by step please! :)


title: Trying to use wp_register_script/style and enqueu them from an array - getting an error

text: here is what i got so far:                 // my array     $this->headersArray = array(         array('handle' => 'buy_mobile_funcs', 'src' => 'jsFunctions', 'extention' => 'js', 'deps' => '', 'media' => ''),              array('handle' => 'css_main_style', 'src' => 'main_style', 'extention' => 'css', 'deps' => '', 'media' => 'screen')     );          // registering      foreach($this->headersArray as $singleHeader){         if($singleHeader['extention'] == 'js'){             wp_register_script(                 $singleHeader['handle'], plugins_url('scripts/'.$singleHeader['src'].'.'.$singleHeader['extention'],__FILE__),                  (!empty($singleHeader['deps']))? $singleHeader['deps']  : ''             );         }else{             wp_register_style(                 $singleHeader['handle'], plugins_url('css/'.$singleHeader['src'].'.'.$singleHeader['extention'],__FILE__),                  (!empty($singleHeader['deps']))? $singleHeader['deps']  : ''             );         }     }          // enqueuing      foreach($this->headersArray as $singleHeader){         if($singleHeader['extention'] == 'js'){             wp_enqueue_script($singleHeader['handle']);         }else{             wp_enqueue_style( $singleHeader['handle'], '', '', '', $singleHeader['media'] );         }     }      I know i could combine the 2 foreach. however i have a reason to keep it as it is now which is not relevant to the questions. Error:               Notice: wp_register_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /home1/stodeckc/public_html/orgadsite/wp-includes/functions.php on line 3012      Thanks in advanced.


I created this theme and it worked on my site without any problem. When I moved it to another server, I get `wp_register_script was called incorrectly.` error. I scanned my source code and I didn't use any wp_register_script ... however I am suspecting that it is reacting to this ...               function add_script_code() {         wp_deregister_script('jquery');          wp_enqueue_script('jquery', base_url('source/js/jquery-1.4.1-vsdoc.js'), false, '1.3.0', TRUE );         wp_enqueue_script('less', base_url('source/js/less-1.3.0.min.js'), false, '1.3.0', TRUE );         wp_enqueue_script('vars', base_url('source/js/vars.js'), false, '1.3.0', TRUE);         wp_enqueue_script('function', base_url('source/js/function.js'), false, '1.3.0', TRUE );     }          //add_action('admin_init', 'add_script_code');     add_action('wp_footer', 'add_script_code')      My code base is in github. The functions folder contains my functions for the theme. https://github.com/abarcenas29/dmp-v4 Base url is a function I created.               function base_url($url) {             return get_bloginfo('template_url').'/'.$url;         }


title: Change the background of each post according to the category

text: I am using the Hueman Theme. What I want to do is that the background of all the posts should change according to the category of the post. Please suggest something


title: Processing Forms with Paypal Framework plugin

text: Can I use the PayPal Framework Plugin to process a form and send the data to Paypal as a purchase. I am not even sure where to start If I can, but I want to know it this is what it is for.


title: Add submenus to Theme options menu

text: My theme currently has a single menu on the left hand sidebar of WP admin. I want to include submenus on that menu. How can I add, for example, a single submenu item to the "Theme Options" menu below?               add_menu_page(         "My Theme Options",          "Theme Options",          'edit_themes',          basename(__FILE__),          'my_admin',          get_bloginfo('template_directory') .'/img/favicon.png'         );


title: Wordpress Media Library - how to "uncache" images

text: When doing a recent Google search we noticed that some of our images are being cached by Google but the link that is attached to them is the actual media library link. So when you click on that link, it shows a really "ugly" page because this page is not really published and is the template. Is there any way to make images that we upload to our Media Library unsearchable or keep them out of being cached by Google?


title: When Installing a Plugin Where do I Move Template Files to?

text: I just installed a WP plugin cron-view I can't find where it is or what it's actually done. When going to the install directions though - http://wordpress.org/extend/plugins/cron- view/installation/ I get: "Upload your post template files (see the Description for details on configuring these), and choose them through the new menu." But that assumes that you know where (relative to the root directory) this is supposed to be put. Thoughts would be appreciated


title: post-new.php?post_type=product is not loading properly

text: Background: I have installed Jigoshop along with my custom theme. When I go to 'Add product' there is no featured image box showing. So I've added the code               add_theme_support( 'post-thumbnails' );      To functions.php, but the problem is still not resolved. Inspecting `post-new.php?post_type=product` brings up 3 errors:               Uncaught TypeError: Cannot call method 'appendChild' of null post-new.php:1112     Uncaught TypeError: Object [object Object] has no method 'datepicker' write-panels.js:119     Uncaught TypeError: Object [object Object] has no method 'select2' post-new.php:736      Also, the admin menus on the left of the page don't show any sub-menus, and when I click screen options it won't open. I need some help in working out what is happening to cause those errors and I think that is what is causing a knock on effect to prevent featured images displaying on my admin page. Your help/advice is much appreciated!


title: Adding a css style to the main nav menu in child pages

text: I have a WordPress site where I am adding a custom style to the main navigation based on whether the user is on that page. The articles section of my site has several articles within it that users can visit. I use this css style as seen below which has the desired effect when the viewer is on the articles page, WordPress helpfully adds the current-menu-item class to the html markup:               #navigation li a:hover, #navigation li.current-menu-item a {     text-shadow: 1px 1px 2px red;     -webkit-transition: color 0.5s, text-shadow 0.5s;     -moz-transition: color 0.5s;     -o-transition: color 0.5s;     }      However I would like to keep this style applied to that top level item if the user is in a single article page. Is there a way of achieving this?


title: How to restrict user to choose 1 category for a post

text: I wish to restrict the user posting a new article to select only 1 category for that post. It doesn't matter which category he chooses as long as he chooses just one. This way posts are maintained under a hierarchy (and I want to avoid users clicking all categories so that their posts appear everywhere). I don't want to restrict the user to a specific category, I just want to limit the number of categories the user can choose for a post to 1. Is there any way to achieve this in Wordpress?


title: Display last login time

text: I am using this script to get the last time a user logged in               function get_last_login($user_id) {         $last_login = get_user_meta($user_id, 'last_login', true);         echo human_time_diff($last_login) . " " . __('ago');         }      I am calling it in author.php with `<p>Last login: <?php get_last_login($userdata->ID); ?></p>` I am trying to output like "last login X days ago" but I can't get it working. $last_login output is `2011-05-13 18:00:06` but the final output I get is `last login 15108 days ago`


title: Website Opened at http:// but after updation website crashed

text: My website which earlier opened at http://yeshuvandana.com after my client notified me that it didn't opened at the previous address , So I went to change the WordPress address and Site address in the wordpress admin panel through general options panel , I updated it to http://www.yeshuvandana.com but as I updated it my website crashed and cant open it now . :( Now , I want to restore those settings and change my website address to ideal web addresses but in order to do so I have to recover what I did and how can I fix the above errors , Please help I dont want to create that website again and do the coding !


title: Get URL of Post You Are Editing

text: I can't seem to find this anywhere, Is there a way to retrieve the URL of the post (which is of a custom post type) you are editing. Basically I want to somehow get the same URL that shows up like this: Permalink: (link to post) on the edit screen.


title: Problem with Custom Post Types, Taxonomy, permalink, Archive

text: I set up 2 custom post types: beats and tracks. And I set up the taxonomy 'tags' and 'style' for both custom post types. the permalinks for the custom post types are set in functions.php: beats/%style%/%postname% and tracks/%style%/%postname% I have a problem, when the url is /beats/%style% and /tracks/%style% without the postname (archive). Then, all 'beats' and 'tracks' posts whiches are in the %style%, are visible. Not only the beats or only the tracks from the style tax. When I make an echo of get_post_type(), the echo always is 'beats'. Even when the url is /tracks/%style%. Here is my code:               <?php          add_action('init', 'reg_music');          function reg_music() {         register_taxonomy(         'style',         array (         0 => 'beats',         1 => 'tracks',         ),         array(             'label' => 'Styles',             'singular_label' => 'Style',             'hierarchical' => true,             'query_var' => true,             'rewrite' => array('slug' => 'beats','slug' => 'tracks'),         )     );          $labels = array(         'name' => _x('Beats', 'post type general name'),         'singular_name' => _x('Beat', 'post type singular name')     );          $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'show_in_menu' => true,         'query_var' => 'beats',         'capability_type' => 'post',         'hierarchical' => true,         'menu_position' => null,         'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),         'rewrite' => array(             'slug' => 'beats/%style%',             'with_front' => false         ),         'has_archive' => true     );           register_post_type( 'beats' , $args );           $labels = array(         'name' => _x('Tracks', 'post type general name'),         'singular_name' => _x('Track', 'post type singular name')     );          $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'show_in_menu' => true,         'query_var' => 'tracks',         'capability_type' => 'post',         'hierarchical' => true,         'menu_position' => null,         'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),         'rewrite' => array(             'slug' => 'tracks/%style%',             'with_front' => false         ),         'has_archive' => true     );             register_post_type( 'tracks' , $args );       // flush_rewrite_rules();     }          add_filter('post_type_link', 'music_permalink_structure', 10, 4);     function music_permalink_structure($post_link, $post, $leavename, $sample)     {     if ( false !== strpos( $post_link, '%style%' ) ) {         $event_type_term = get_the_terms( $post->ID, 'style' );         $post_link = str_replace( '%style%', array_pop( $event_type_term )->slug,         $post_link );     }     return $post_link;     }          register_taxonomy('tags',array (     0 => 'beats',     1 => 'tracks',     ),array( 'hierarchical' => false, 'label' => 'Tags','show_ui' => true,'query_var' =>     true,'rewrite' => array('slug' => 'tag'),'singular_label' => 'Tag') );          ?>


title: link to single most recent post, regardless of category

text:
I have a landing page that, among other things, features an excerpt from the most recent post with a "Continue Reading" link that should take the reader to the most recent post. In my search, I've found a lot of guides on how to link to the most recent post within a specified category, but not much on the most recent post regardless of category(because it will vary). ETA:

Growing Edge Blog
                         <?php                         // Get the most recent post                         $the_query = new WP_Query( 'posts_per_page=1' );                              // Pull the excerpt                         while ( $the_query->have_posts() ) : $the_query->the_post();                             the_excerpt();                         endwhile;                              // Reset Post Data                         wp_reset_postdata();                          ?>
                              <?php                         $latest = new WP_Query( array( 'posts_per_page' => 1 ) );                         while( $latest->have_posts() ) :                             $latest->the_post();                             echo '' . get_the_title() . '';                         endwhile;                         ?>

      Any ideas? Thanks.


title: Create a WP page - does it automatically create at a forwarded domain?

text: If I have a WP site at mydomain.com with domain forwarding from `mydomain.co.uk` to `mydomain.com` and if I create a page at `mydomain.com/page-name` will `mydomain.co.uk/page-name` automatically be created? If not, is there a way to make it so pages are automatically created in this way?


title: Trying to pull tag on image attachment for a containers class

text: So here is my query:                       <?php                 $page = (!empty($_GET['myp'])) ? $_GET['myp'] : 1;                 $per_page = 20;                 $base = get_queried_object();                 // var_dump($base);                 if (null === $base) {                   $base = site_url();                 } else {                   $base = get_permalink($base->ID);                 }                 $all_work = new WP_Query(array(                     'post_type' => 'work',                     'tax_query' => array(                         array(                             'taxonomy' => 'type',                             'field' => 'slug',                             'terms' => array('case-study', 'portfolio')                         ),                     ),                     'posts_per_page' => '20',                     'orderby' => 'title',                     'order' => 'ASC',                     'update_post_term_cache' => false,                     'nopaging' => false,                     'paged' => $page                     )                 );                      $total = $all_work->found_posts;                 //var_dump($total);                      while ( $all_work->have_posts() ) : $all_work->the_post();                      $terms = get_the_terms($post->ID, 'post_tag');                  ?>      and here is my container:               <ul class="<?php echo $terms[0]->slug; ?>">      What I am trying to achieve it having the tag that has been assigned to the displayed attachment show up for my ul class, but I am not sure how to query the attachments post_type and not pull from the "work" post_type that is in my query. I also found wp_get_object_terms in the codex but they both render out the tag of the post and not the tag of the image being pulled in.


title: update_user_meta duplicates entry

text: I have a very simple code in my themes footer               if (is_user_logged_in()) {      $user = wp_get_current_user();      $aka2 = get_user_meta($user->ID, 'last_visited_blogs', true);      $aka2[] = 'blog4';      update_user_meta($user->ID, 'last_visited_blogs', $aka2);     } ?>      What it does is, gets meta value, inserts new entry and updates meta with new a array. like if it contain something: [0] => 'blog1', [1] => 'blog2', [2] => 'blog3' and after function it should look like [0] => 'blog1', [1] => 'blog2', [2] => 'blog3', [3] => 'blog4' but, what it does is, it inserts two values on execution even when it's empty [0] => 'blog4', [1] => 'blog4' and on every next execution it inserts two values


title: Show a custom field instead of username in the backend author area

text: I'm building a new WP site with about 1200 authors(which are actually companies, pulled from my client's existing site), each attached to at least one custom post type. My problem is the admin(our client) is used to seeing the company name as the 'Author' instead of the username (which is an email address). Is there a way in the backend to make the normal 'Author' field (ie: in post columns, and in the post editor author metabox) into a custom field (which currently exists in our system) that is the company name(lets call the field 'wp_organization')?? And all this without editing core WP files that could be overwritten during an upgrade(ie: use the functions.php instead?)... I'd assume its a simple function to call the custom field instead of author, but haven't been able to find it yet...


title: Getting WordPress Flexslider Item Number

text:
I add flexslider to my theme home page via this code.how can I get number of per item? **as 1 2 3 4 ......**                   <?php             $args = array( 'post_type' => 'try', 'posts_per_page' => 3 );             $query = new WP_Query( $args );             while ($query->have_posts()) : $query->the_post();              ?>
             <?php the_post_thumbnail('featured'); ?>
                 <?php the_title();?>                 <?php the_excerpt(); ?>                 Play Now

              <?php             endwhile;         ?>


title: Invalid Taxonomy in template

text:
I have looked through the posts here that involve this same error, without any luck. I have a Custom Post Type (Staff) and a custom taxonomy for it. Making Staff posts and assigning terms is working fine, but I'd like to list all of the Staff in groups based on the taxonomy terms. But **the terms do not come through**. The Template File is here: http://pastie.org/4372363 The (relevant parts of the) functions.php file is here: http://pastie.org/4372367 Any reason why I wouldn't be able to do this? The result looks like this:

Array

...

...

...

...

...

...

Array

...

...

...

...

...

...

      With the content of the array being another Array with one item in it, being the "Invalid Taxonomy" error (a string). Thanks!


title: Using post type archive page for taxonomy archive

text: I have separate post type archive and taxonomy archive page. eg. `archive- product.php` and `taxonomy-price.php`. So when i goto `example.com/product/?price=100` it redirect to `example.com/price/100` and using the `taxonomy-price.php` to display the posts. It seem the wp take the priority of taxonomy to display to posts. So what I want is using the `archive-product.php` to display the posts,how can I do this?


title: Submitting posts from the front end - sanitizing data

text: I have a form that allows any registered user to submit a post (it's a custom post type - forum related), and I'm using `wp_insert_post()` to insert it into the db. From what I've seen in this function a sanitize_post() function is run automatically, but I think this only handles db escaping and such. So how do I sanitize the input data the same way as the wp-admin editor does? I mean apply the kses filter and all the other stuff...


title: How to create an edit media button for slideshow plugin?

text: I want to create an edit media button for my plugin, right now you can easily upload images using the WordPress 3.5 media uploader but I want the user to be able to edit the uploaded images, something like this: ![example of uploader](http://i.stack.imgur.com/LY4fZ.png) Any ideas on how that can be achieved? Here is the code that I am using to open the media uploader right now:                   var file_frame;     jQuery('#asp_slides_upload').live('click', function(event){              event.preventDefault();              if (file_frame) {             file_frame.open();             return;         }              file_frame = wp.media.frames.file_frame = wp.media({             title: jQuery(this).data('uploader_title'),             button: {                 text: jQuery( this ).data('uploader_button_text'),             },             multiple: true         });              file_frame.on('select', function() {             var selection = file_frame.state().get('selection');             var postID = jQuery('#asp_gallery_id').attr('value');             attachments = selection.toJSON();             printableAttachment = JSON.stringify(attachments, null, 2);             jQuery.ajax({                 type: "POST",                 dataType: "JSON",                 url: aspAdminUrls.ajaxurl,                 data: {                     action: 'asp_save_slides',                     content: attachments,                     postID: postID                 },                 success: function(data) {                     jQuery('#asp_slides_holder').append(data);                 }             });              });              file_frame.open();     });


title: Is it possible to add a superscript trademark symbol to a menu?

text: Is it possible to add a superscript trademark symbol to a WordPress menu?


title: How to set a Maximum Image size to a Field in WordPress

text: I have a customized frontend form in WordPress that allows to set a featured image to a post before publishing it. I want to set a maximum-allowed "width" as well as a "height" to the "upload image" field so that image resolutions that are lesser than the required resolution get uploaded and resolutions more than the set value get rejected with an error. Currently I have the following code on the field, but it ain't working :               $tmpName = $_FILES[$file]['tmp_name'];                     list($width, $height, $type, $attr) = getimagesize($tmpName);                      if($width!=100 || $height!=100)                 {                     $error .= "Image is to small<br />";                     unlink($_FILES[$file]['tmp_name']);                  }      As you see above the width and height are specified. What change I should go ahead with so that the above values become the maximum allowed resolution.


title: How can I disable sorting/dragging of a menu item in the custom menu admin?

text: I think my problem is partially a javascript problem, but if someone knows of a better way to do this I'd love to hear it. Basically the goal is to "save the client from themselves" by not allowing them to move around certain menu items in the custom menu. For SEO reasons. Whether that makes sense or not is beside the question :) I'm trying to disable the item from being sortable by adding a script doing this: `jQuery("#menu-item-10 dt").sortable("destroy");` The dt is the "handle" for the sortable method called in nav-menu.js from WP core. I'll be making some changes to dynamically get the correct menu item ID but basically this is what I'm trying. I've also tried .sortable({disable: true}) without luck. I always get an error: `Uncaught Error: cannot call methods on sortable prior to initialization; attempted to call method 'destroy' I've tried a bunch of different things. My script is in a document.ready wrap and I've got it running in the bottom of the admin footer using the admin_footer-hook_suffix hook (hook_suffix is nav-menus.php in this case). I have put it in a setTimeout to make sure it runs after everything else is already loaded. Any ideas on what I'm doing wrong or how I can do this better? Or what other info I can provide to help make this clearer? Thanks!


title: Custom post type meta box empty after save

text: I'm trying to make a meta box to include a date picker but my initial attempt to have the textbox data seems to fail as each time its either posted or saved again the text disapears                   <?     /*     Plugin Name: Mobilisation     Plugin URI: http://www.seriadesign.com     Description: Plugin servant a gerer la mobilisation     Version: 0.01     Author: Christophe Rudyj     Author URI: http://www.seriadesign.com     License: Seria-CSN     */      // Create out post type         add_action( 'init', 'csn_mob_register' );         function csn_mob_register() {         $labels = array(         'name' => _x( 'Mobilisations', 'mob' ),         'singular_name' => _x( 'Mobilisation', 'mob' ),         'add_new' => _x( 'Ajouter', 'mob' ),         'add_new_item' => _x( 'Ajouter une Mobilisation', 'mob' ),         'edit_item' => _x( 'Editer une Mobilisation', 'mob' ),         'new_item' => _x( 'Ajouter une Mobilisation', 'mob' ),         'view_item' => _x( 'Voir une Mobilisation', 'mob' ),         'search_items' => _x( 'Rechercher une Mobilisations', 'mob' ),         'not_found' => _x( 'Aucune mobilisations trouvée', 'mob' ),         'not_found_in_trash' => _x( 'Aucune mobilisations trouvée dans la Corbeille', 'mob' ),         'parent_item_colon' => _x( 'Parent Mobilisation:', 'mob' ),         'menu_name' => _x( 'Mobilisations', 'mob' ),         );         $args = array(         'labels' => $labels,         'hierarchical' => false,         'supports' => array( 'title', 'editor' ),         'taxonomies' => array( 'category' ),         'public' => true,         'show_ui' => true,         'show_in_menu' => true,         'menu_position' => 5,         'show_in_nav_menus' => true,         'publicly_queryable' => true,         'exclude_from_search' => false,         'has_archive' => true,         'query_var' => true,         'can_export' => true,         'rewrite' => true,         'capability_type' => 'post'         );                 register_post_type( 'mob', $args );         register_taxonomy_for_object_type( 'category', 'mob' );         }           function important_category( $id, $post ) {     if ( 'mob' === get_post_type( $id ) ) {      $category   = get_term_by( 'slug', 'important', 'category' );      $categories = wp_get_object_terms( $id, 'category', array( 'fields' => 'ids' ) );      if ( !in_array( $category->term_id, $categories ) ) {       wp_set_object_terms( $id, ( int ) $category->term_id, 'category', true );      }     }     } add_action( 'wp_insert_post', 'important_category' );          /* meta box */     add_action( 'add_meta_boxes', 'mob_date_add');     function mob_date_add() {              add_meta_box( 'mob_datebox','Date de Fin', 'mob_dateshow', 'mob','side', 'default' );     }          function mob_dateshow() {     global $post;           $values = get_post_custom( $post->ID );           $text = isset( $values['mob_datetext'] ) ? $values['mob_datetext'] : '';          wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );         ?>           <label for="mob_datetext">Date de fin</label>           <input type="text" name="mob_datetext" id="mob_datetext"  value="<?php echo $text; ?>" />            <?     }          add_action( 'save_post', 'mob_datebox_save', 1, 2);       function mob_datebox_save( $post, $post_id )       {           // Bail if we're doing an auto save           if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;               // if our nonce isn't there, or we can't verify it, bail          if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;               // if our current user can't edit this post, bail           if( !current_user_can( 'edit_post', $post_id ) ) return;       }                 // now we can actually save the data           $allowed = array(                'a' => array( // on allow a tags                   'href' => array() // and those anchors can only have href attribute               )           );                // Make sure your data is set before trying to save it           if( isset( $_POST['mob_datetext'] ) )               update_post_meta( $post_id, 'mob_datetext', wp_kses( $_POST['mob_datetext'], $allowed ) );                           ?>


title: Do I need to use a new WordPress.com account for each Jetpack installation

text: I manage lots of WordPress.org installations for different clients. Typically they do not manage the posts or pages themselves, preferring to stay out of things and let me do it. JetPack functionality is great, but obviously you need to sign into a WordPress.com account within the installation to access it. My question is - is it recommended to create new WordPress.com accounts for each client, or shall I just sign in to mine on each installation? What are the pros / cons e.g. are the WP-stats merged (this would obviously be bad)? Many thanks


title: Looking for a simple checkout plugin

text: I want to sell tickets to an event on my wordpress site. I don't want to use a huge shop or partner up with ticketmaster etc. What I want is let the customer decide how many tickets of a certain category they want and make a reservation, no payment involved. It should be able to display the total amount due and a nice message on submit. Is there a simple plugin without much overhead? What should I use?


title: How to style current page menu item when using a walker

text:
I have designed a custom menu and would like to be able to style the individual li dependent whether it is the current page or not? I believe this is normally pretty straightforward using a class such as current-menu-item. I however am also using a walker in my nav to show an extra description field - this appears to disable it, can anyone please help??
              <?php          $walker = new My_Walker;          wp_nav_menu(array( 'menu' => 'nav','walker' => $walker ) );          ?>
      UPDATE:               class My_Walker extends Walker_Nav_Menu     {         function start_el(&$output, $item, $depth, $args) {             global $wp_query;             $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';                  $class_names = $value = '';                  $classes = empty( $item->classes ) ? array() : (array) $item->classes;                  $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );             $class_names = '';                  $output .= $indent . '
ID . '"' . $value . $class_names .'>';                  $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';             $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';             $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';             $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';                  $item_output = $args->before;             $item_output .= '';             $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;             $item_output .= '' . $item->description . '';             $item_output .= '';             $item_output .= $args->after;                  $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );         }     }


title: Plugin screenshots not showing in the repository

text: I'm having major trouble getting the screenshots to show in my plugin. I have validated the readme file and placed the screenshots in both the `/trunk` and `/tags/1.0` directories (1.0 is stable). I have looked at many search results and quite a few existing plugins to see what I'm doing different but I'm failing to see what, if anything, I am doing wrong. The output of running pngcheck is               $ pngcheck trunk/*.png     OK: trunk/screenshot-1.png (1418x761, 24-bit RGB, non-interlaced, 98.4%).     OK: trunk/screenshot-2.png (699x373, 24-bit RGB, non-interlaced, 77.6%).     OK: trunk/screenshot-3.png (370x701, 24-bit RGB, non-interlaced, 70.1%).     OK: trunk/screenshot-4.png (935x331, 24-bit RGB, non-interlaced, 93.8%).          No errors were detected in 4 of the 4 files tested.      The plugin repo is at http://plugins.svn.wordpress.org/tel-link-obfuscate/   The screenshots section of the WP plugin page just displays the description of the plugin      Obviously any help is appreciated and until then I'll just have to live without screenshots on my plugin page.


title: Pagination 404 on Index with custom query

text: On my wordpress index, I use a custom query:               $paged = (get_query_var('page')) ? get_query_var('page') : 1;          $project_query = new WP_query(array(       'post_type' => 'project',       'paged' => $paged,       'posts_per_page' => 5     ));      I am using wp-paginate to setup page numbering, but regardless, as soon as I try to go to the next page, eg: `http://domain/page/2` I get a 404 error. I really cannot for the life of me figure out what is happening. I've set the wordpress reading option to the same number, and my permalink structure is set to `Post name`. Any tips greatly appreciated, I know pagination 404's are a common issue with a lot of people but I haven't been able to find someone who had the same issue with the index.


title: Lead/contact form export to XML

text: I have a lead form that I want to send leads to an external CRM in XML format when someone fills it out. Ive looked at most of the popular solutions documentation (Contact form 7, gravity, Wufoo) and cannot seem to find a solution to this issue. They seem to only offer email notifications.. Anyone know of an easy way to do this?


title: SQL / wp_update_post: change post custom field to CPT post taxonomy

text: the setup is as follow: I have posts with a custom field: `actor = 'tom hanks'` for advanced management I created a custom post type (actors) and added "tom hanks" as a post within that actors taxonomy. Via plugin 'Advanced custom fields' I connected the custom taxonomy (actors) to the default posts so I can select 'tom hanks' on the regular post page. This can be done manually (check the custom field value and click the according actors category) but there are way more than 1500 posts and many other similar custom field values. Do you have any idea how that can be solved via SQL query or function? in one line: **get value from customfield 'actors' and move to taxonomy('actors') for that post.** the custom field value could be used as the taxonomy slug. I think it's also possible with the wp_update_post function but I have no idea how to call all posts, the custom fields and taxonomy. If somebody can please help me out with the query for a mysql or similar you would definitely make my day :) EDIT: I think `wp_update_post` is a good way to accomplish this task.               // get all post IDs     $post_ids = get_posts(array(         'post_type' => 'post',         'post_status' => 'publish',         'numberposts'   => -1, // get all posts.         'fields'     => 'ids', // Only get post IDs     ));          // info: custom field 'actor' = 'Tom Hanks'          // Update all posts     foreach ($post_ids as $id) {            $excerpt =  get_post_meta($id, 'excerpt', true);  // for testing purpose I added a customfield 'excerpt'         // info: custom field 'actor' = 'Tom Hanks'       $customfield_value = get_post_meta($id, 'actor', true);       // change the custom field values to slug format:  'Tom Hanks' > 'tom-hanks'       $customfield_value = sanitize_title_with_dashes($customfield_value);                 $post = array(         'ID' => $id,      // select all posts         'post_excerpt' => $excerpt, // update the excerpt field with the customfield 'excerpt'         'tax_input'      => array(           'actor' => array(             $customfield_value           )         )       );            wp_update_post( $post );            // delete the old post meta after we moved it to the taxononmy       //delete_post_meta($id, 'actor');          }


title: Custom field within shortcode

text: I'm currently using the 'WP Simple Paypal Shopping Cart' plugin to get up a simple paypal e-commerce site, it's super easy to use, but to save the client having to write shortcode, I've set up custom fields in the back-end to input the product name and price.   The `Add to Cart` button is generated using a simple piece of shortcode like so:                 <?php echo print_wp_cart_button_for_product('Product Name', Product Price); ?>      Obviously replacing `Product Name` and `Product Price` with the name and price you're adding to the site. I have 2 custom fields set up like so:                 <?php the_field('product_name' ); ?>     <?php the_field('product_price' ); ?>      I'm trying to figure out if there's anyway to put those custom fields inside the shortcode, replacing `Product Name` and `Product Price` and thus allowing people to add products to the site without having to write any shortcode. Any suggestions would be greatly appreciated!


title: Better WP Security : dashboard doesn't work any more

text: Just installed Better WP Security (with File Change Detection feature activated), then logged out. Now wp-login.php is blank with the message : Notice: unserialize() [function.unserialize]: Error at offset 0 of 93 bytes in /home4/mysite/public_html/wp-content/plugins/better-wp-security/inc/secure.php on line 20 What can I do do access the dashboard again?


title: An action hook where a comment meta is updated

text: By analogy to the hook on post meta update, I use the following code for hooking when comment meta value is updated. My comment meta key is "consider" and can have 2 values: 0 and 1. My Goal is to count number of comments with `consider=1`, and when this count reaches 10, perform some operations.                           add_action( 'update_comment_meta', 'ten_considered_comments_badge');                      function ten_considered_comments_badge($meta_id, $comment_id, $key, $value)                     {                         if ( 'consider' != $key or 1!= $value)  return;                              $com=get_comment($comment_id);                         if ( !$com  )  return;                         $args = array(       'type' => '',       'user_id' => $com->user_id,       'meta_key' => 'consider',       'meta_value' => '1',     );     $com2= get_comments($args);                  $count = count($com2);                               if( $count%10==0) {               $number_of_bronze_badges= get_user_meta($com->user_id,'user_number_of_bronze_badges',true);             $number_of_bronze_badges= $number_of_bronze_badges + 1;                  update_user_meta($com->user_id, 'user_number_of_bronze_badges', $number_of_bronze_badges);             }             }      What I am missing in this code . Your help is highly appreciated.


title: Hyphens vs. periods in the script slug in wp_register_script?

text: I have seen script and style handles written in two different ways in `wp_register_script` and `wp_enqueue_script` (the same applies to `wp_register_style` and `wp_enqueue_style`):   1. `wp_register_script( 'jquery-someplugin', $location );`   2. `wp_register_script( 'jquery.someplugin', $location );` #1 uses a hyphen, #2 uses a period. What is the best practice here? Which should I be using?


title: Showing the custom taxonomy parent term and child term of a post

text: Is there any way that you can show a custom taxonomy's parent term and child of a post? I'm currently using `get_the_term_list()` to display the custom tax terms of the post. The only problem is the order or arrangement of the terms, is alphabetical. What I want is to display the parent term first before the child terms. Is it possible to manipulate/customize the HTML tags of the output? What I want to display is something like this:   * Parent Term      * Child Term 1     * Child Term 2


title: WP Customizer - what types of fields is it capable of supporting?

text: I just found this reference of WP Customizer types of data input: https://gist.github.com/Abban/2968549 But I wonder if there's an option to have for instance a range slider? Something that would allow users to pick a value between `50px` and `200px` or between `1em` and `2em`? Ideally it should also allow switching units - like from `px` to `%` and vice versa. Is this possible at all or does it require some custom extension? I also noticed that textarea isn't there.


title: Article Template

text:
have a little problem. I'm currently creating a theme, where the article page is not on the home page. The trouble now is that on the home page below are three content boxes and they should not appear on the article page. I created a blog page template (blog.php) and created a new page and inserted the blog page template there. The blog page template references in the source to a loop (loop-blog.php) where the content to be displayed is. Neither the blog.php or the loop-blog.php have anything from the code that is responsible for the content boxes but still I see the content boxes on the article page. Content of blog.php:                   <?php /* Template Name: Blog */ ?>     <?php get_header(); ?>

                  <?php if ( ! have_posts() ) : ?>
Nicht gefunden!

Sorry, leider konnte der gewünschte Artikel nicht gefunden werden. Vielleicht hilft dir die suche ja weiter!
                  <?php endif; ?>                  <?php while ( have_posts() ) : the_post(); ?>                  <?php get_template_part( 'blog', 'loop-blog' ); ?>                       <?php endwhile; ?>                  <?php if(function_exists('wp_paginate')) {             wp_paginate();             } ?>

          <?php get_footer(); ?>      Content of the loop-blog.php

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

<?php the_time('j. F Y'); ?> | <?php the_author_posts_link(); ?> | Veröffentlicht unter: <?php the_category(', ') ?> | <?php comments_popup_link('keine Kommentare', '1 Kommentar', '% Kommentare', 'comments-link', 'Kommentarfunktion deaktiviert'); ?>

                 <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>                     <?php the_excerpt(); ?>                 <?php else : ?>                     <?php the_content('Weiterlesen'); ?>                 <?php endif; ?>

      The categories was made in the same way, and here it works as it should. The content boxes are not displayed. I'm a bit stumped here, where is the mistake?


title: Change taxonomy to metabox?

text: I created a custom taxonomy, but I need the taxonomy values in a metabox within the same post. How can I archive this? I tried several plugins for taxonomy management, but none of them could do what I wanted.


title: TwentyThirteen theme Posts page shows posts instead of page content

text: Under: > Settings -> Reading -> Front page displays -> A static page -> Posts page I can choose the name of a WordPress page from the drop-down menu. How come WordPress takes the page title, displays the page title in the menu on the front page, and then, when I click on the page title I am shown the blog posts, instead of that page's content? This makes me think pages are not suitable for use in this area as once I designate a page as the posts page, its content becomes hidden and is no longer visible. Could someone please explain why WordPress works in this way? The way the > Settings -> Reading -> Front page displays -> A static page -> Front page works on the other hand is clear. When the user goes to the URL corresponding to the WordPress document root or clicks on the text in the header, WordPress displays this page.


title: Prevent users from going to wordpress profile after login

text: I've got a custom role for my site and users can only access their profile page, this appears to be the minimum for wordpress. However, the accounts are managed by us and this is a private site, we do not want users to be able to change their username, email or password using wordpress. The only issue we have right now is logging in. The inner pages all require you to be logged in. We have a landing page with a link to the login page, for this link we apply `redirect_to=/blog/` and after logging in you go to the blog. This works well enough for us. However, if a user links to an inner page (or recieves the link in an email automatically, from subscription setting) then the link will require them to login, taking them to the login screen **without the redirect_to parameter**. This means they will go right to the profile page. Why it goes to the profile page instead of the page they requested is beyond me, but we need to redirect them back to the blog. Here is a function I set up with the intention that after logging in, you will get taken to the blog. At this point we don't care if a permalink doesn't work on first visit (of course they will once you log in). But this function does not work. wp_signon is not triggered _after a user logs in_ , but instead is used to log a user in. What should I do?               function login_redirect() {         wp_redirect( get_bloginfo( 'url' ) . '/blog/' );     }     add_action('wp_signon', 'login_redirect');`


title: WP_Query Date Filtering Inclusive Being Ignored

text: I'm currently working on a plugin that contains a shortcode which allows users to filter a custom post type by date. They could choose "Date From", "Date To", and "Date From with Date To". When using the inclusive flag, it ignores the inclusive flag and does not select the date that is entered in the shortcode. For instance if I had selected `datefrom=1/10/2013` and `dateto=05/16/2014` it selects only the posts between 1/10/2013 and 5/15/2014. If I want to select 5/16/2014 I have to make `dateto=5/17/2014`. What is the proper usage? Here is what I currently have:                 //both datefrom and dateto         if (($datefrom != "") && ($dateto != "")){             $args['date_query'] = array(                 array('after' => $datefrom,                 'before' => $dateto),                 'inclusive' => true);         }      Thanks for your time!


title: wp_head rel=next and rel=prev on certain pages only

text: I'm trying to hook the wp_head() to add the rel=prev and rel=next only in certain pages, but I'm not sure this can be done. I was expecting the do_action to be able to help me on this, but apparently I was wrong. I would like to avoid as much as possible customised code inserted with functions that are not part of the core. Any help? Thanks Andrea


title: Multiple SERPs using WordPress Multisite with additional Multilanguage support

text: I am wondering about proper choice for multiple WordPress installation making it easy to maintain and achieve best SEO, more precisely best SERPs with also Multilanguage support. By SERPs I mean this layout: ![enter image description here](http://i.stack.imgur.com/XNJ2z.png) My scenario is like below:   * main site about overall company group description   * sub site about company department (branch) specialized in services A   * sub site about company department (branch) specialized in services B   * sub site about company department (branch) specialized in services C **Each subside has its own menu structure, content and only link to company group description.** I would like to use Multisite Mode in WordPress to achieve this. However additional requirement for me is to make it multilingual. It is possible by combining:   1. **WordPress MultiSite**   2. WPML **or** qTranslate **or** Polylang   3. All in One SEO Pack **or** WordPress SEO plugin by Yoast To achieve SERPs like these? I. For **main site** SERPs ( **default language** used):               domain.net         domain.net/about        domain.net/clients         domain.net/news         domain.net/contact      I.a) For **main site** SERPs ( **custom language** used):               en.domain.net         en.domain.net/about     en.domain.net/clients         en.domain.net/news      en.domain.net/contact      II. For **sub site** SERPs ( **default language** used):               domain.net         domain.net/services-A/about     domain.net/services-A/clients         domain.net/services-A/news      domain.net/services-A/contact      II.a) For **sub site** SERPs ( **custom language** used):               en.domain.net         en.domain.net/services-A/about      en.domain.net/services-A/clients         en.domain.net/services-A/news       en.domain.net/services-A/contact      As asked before is it possible to:   1. Have different SERPs based on multiple WordPress installation each SERP separate by each installation (different services) inside WordPress Multisite? If so, is it possible using subfolder like in my example or it must be subdomain for Multisite?   2. Have different SERPs based on multiple WordPress language plugins each separate by each translated page?    3. Have possibility to optimize SEO separately to each translated page inside WordPress Multisite?   4. If overall is possible, what plugins from mentioned at the beginning use to achieve this combo (which one are compatible with others)? **UPDATE:** If I drop idea of Google sitelinks overall, is it still possible to achieve different SERPs for Multisite WordPress with Multilingual support, like:   * domain.net   * en.domain.net (only translation)   * domain.net/services-A/ (sub site in WordPress Mutlisite)   * en.domain.net/services-A/ (sub site in WordPress Mutlisite + translation) ... so overall achieving 4 different SERPs ?


title: Bootstrap Scrollspy Incorrect Highlighting

text: I have a WordPress site that integrates bootstrap scrollspy. Scrollspy is activated when you scroll but it highlights the first two items incorrectly in the navbar. It seems there is an offset problem due to the first content box being bigger than the other ones, but I have added an offset in the body tag and through `jQuery('.navbar').scrollspy()`. I also added `padding-top: 100px` to the first content box on the page. None of these solutions work. What am I missing here? The working page


title: How to use custom taxonomy checkboxes to filter a taxonomy archive?

text: So my site features two custom taxonomies:   * Topics (Economics, politics, literature, etc. )   * Post Type (Reviews, Analysis, Essays, etc. ) On the homepage I display a menu with topics, and once on the taxonomy archive page (e.g. site.com/topics/economics), I want the user to be able to filter the post snippets through checkboxes (one for each Post Type). I already created the checkboxes using `get_terms('types')`. I thought of using a GET parameter and then using `pre_get_posts` hook to do the filtering but I was wondering if there is a Wordpress out-of-the-box solution?


title: wordpress pagination problem with page templates

text: just now i found that pagination depends on permalink structure.I am using wp 3.8 version. For pagination in page template I used               <?php     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     query_posts('posts_per_page=1& post_type=product &paged=' . $paged);      ?>      For paginating                 <?php       global $wp_query;            $big = 999999999; // need an unlikely integer            echo paginate_links( array(     'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),     'format' => '?paged=%#%',     'current' => max( 1, get_query_var('paged') ),     'total' => $wp_query->max_num_pages,     'prev_next'    => False,              ) );         ?>      I have noticed that for default permalink structure pagination works fine but if i change permalink structure it no longer works.It shows first page result but on next pagination it moves to index.php Why?


title: WP Template Hierarchy - Need help choosing the correct templates

text: Please see this image to get a better understanding of what I would like to achieve. ![enter image description here](http://i.stack.imgur.com/DQRho.jpg) Please pay attention to point #3 and #4 (notice the permalink structure).   * The "Homepage" is static (front-page.php).   * The "Resort" page provides an overview Aspen (page-aspen.php).   * The "Property Type" page should list all properties in Aspen.   * The "Property Name" page is a landing page for the property. What template do you recommend I use for point #3 and #4? Thanking in advance!