title: Use code from bundled themes in my theme and resell it

text: Since a while I have started comparing frameworks for wordpress in order to understand the way wordpress works. Now that I understand the code more clearly, I have compared it to the twentythirteen and twentyfourteen themes bundled with wordpress. I came to understand that quite alot of the code seems to be the same, apart from the functions they all seem to use and call for. Can I do the same thing, using code from those themes? _I'm sorry if this question has already been asked before, just didnt see it anywhere on this site..._ Any suggestions to this issue?


title: Rewriting post slug before post save

text: I need to retrieve an ACF field within the post, and change the slug(permalink) of the post before saving it to database. What is the approach to achieve that? I need the slug to be changed every create/edit post operations.


title: How to determine if I'm on the first page of pagination?

text: How do I determine if I'm on the very first page of pagination? I'm using WP_Pagenavi. I want to run a function only on the first page of the pagination. I checked the query_var 'paged', it's set to 0 on this page, and then 2, 3 and so on in the later pages (1 is missing!)... Anyone knows a clean solution? Thanks.


title: Custom Loop, Match Category with Page

text:
I want to set up my template so that Pages show a list of posts where the category slug matches the page slug. So on the Page "About Us" ('about'), posts tagged with the category-slug 'about'. The sidebar should show a list of these posts (I need to hardcode this. NO PLUGINS). Index.php should show all posts, EXcluding the posts that show up on a page. This is the custom loop generates a list of recent posts that I will be adding to sidebar.php. This needs to be modified so that it only shows posts in a category that matches the page.
     <?php     query_posts( 'posts_per_page=5' );     if ( have_posts() ) :           while ( have_posts() ) : the_post();         ?>
<a href="<?php the_permalink() ?>"><?php the_title() ?>
<?php     endwhile;     endif;     wp_reset_query();     ?>
      I tried to explain as clearly as possible, but it's a little confusing, so please me know what I need to make more clear.


title: My search form finds page 1 results but shows "error 404 page not found" on pages 2 on or clicking next

text:
search-form.php
         <form method="get" class="searchform" action="<?php echo home_url( '/' ); ?>" >             <input type="text" class="field s" name="s" value="<?php _e( 'Search…', 'woothemes' ); ?>" onfocus="if (this.value == '<?php _e( 'Search…', 'woothemes' ); ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'Search…', 'woothemes' ); ?>';}" />             <input type="image" src="<?php echo get_template_directory_uri(); ?>/images/ico-search.png" alt="<?php _e( 'Search', 'woothemes' ); ?>" class="submit" name="submit" />         </form>


title: Add categories and posts to page hierarchy

text: So, I find myself in this situation now and again, trying to solve a particular workflow. I have a page hierarchy something like this:               Page 1         Sub-page 1 (category term listing)             Post 1             Post 2         Sub-page 3 (standard page)     Page 2 (category term listing)         Post 5         Post 6      Now the particular problem is that I want to maintain this hierarchical structure, particularly in the breadcrumbs and url (friendly rewrites). Basically I want category and post pages to appear in the page hierarchy, for example `/Page 1/Sub-page 1/Post 1/`, rather than the wordpress default: `/category/{category-name}` and `/blog/{post-name}`. Is this just something WordPress won't do, or does anyone have any clever workarounds?


title: Backup another database with BackUpWordPress plugin

text: Is there any possibilities to add another database which is connected to other wordpress plugin? My site is using two database: main wordpress db and additional db for plugin data. The Backup includes only the main one. But i want to include the other one too.


title: Problems in migration of WordPress site from local server to the online server

text: I am finding some problems uploading a WP site from my local webserver to the official online webserver. The situation is the following one, on my local web server:   1. I have install WP website on my computer   2. I have configure it   3. I have custom a template  After, I have upload this site in a folder on my official online webserverm I have took the local database on the online database using PhpMyAdmin (to export the local databse on a file and then to import it on the online database) Finnally I have changed the file **wp-config.php** changing the MySql connection settings and putting here the settings related to the official online database. When I try to open the website it appears to me, here you can say how: http://www.scorejava.com/wordpress/ Ok...seems good but there is two problems:   1. **If you try to open an article it is not open the article on the online server but in the localhost server, infact open this URL:`http://localhost/wordpress/?p=81`**   2. **If I try to open the administration pannel opening this URL:`http://www.scorejava.com/wordpress/wp-admin/` I obtain a white page** I don't know if these two problems are related togheter but I think that all may depend due to a problem of location path... I think that somewhere there is some settings that specify the URL (that can't be localhost...), but (if it is so...) where is this setting? in some file or in the database? Some one have an idea? Can you help me?


title: Custom row action on custom posts list page causes a wp_die?

text: The scenario is this: I have a CPT called Job. I've set custom row actions for this CPT, and most of them are linked to external or custom settings pages. They work fine. Now I've set a new row action, called as 'mark-special', and I've set the href for the link as the same posts list page with my own params as: `edit.php?post_type=job&action=mark-special&job_id=123&_wpnonce=<custom nonce>` I'm handling the action in a function hooked with `init`. The problem is, when I click this link, it `wp_die`s with a message: `Are you sure you want to do this?`. But the function works as I want it to, and the CPT is set as special. Any way I can solve this?


title: Export / import Wordpress database

text: Is there a proper way of exporting and importing a big WordPress MySQL database to a new database? When I tried to do that in the standard way I run into 2 issues:   1. All widgets disappeared and I had to create them from scratch   2. I had issues with special characters such as `'` and I had to search and replace the gibberish letters This is quite important as I need to move to a managed server from shared hosting. All apache, php, MySQL versions will be the same. Ps: this will have to be SSH commands as phpadmin times out due to the database size.


title: Updating post content and custom fields in edit post screen

text: I'm trying to find the best approach to customising the edit post screen for a custom post type. I want to add a button which, when clicked will trigger code which looks up an external (not WP) database, gets some data, and then updates various fields - both core WP fields and custom meta fields. Ideally, the updates should update fields in the editor, but not commit anything to the WP database until the user then saves the edits (with the normal 'update' button). So far, I have tried adding a submit button in the metabox, and then hooking into 'wp_insert_post_data'. That works, but I get a browser "The changes you made will be lost if you navigate away from this page" message if any fields have been edited which I don't want. As for updating the data, I am updating $post by hooking into 'dbx_post_advanced', and adding my own filters to hook into my custom meta fields, which updates what goes into the fields without updating the DB. Again, that works, but 'dbx_post_advanced' feels a bit hackish as it is buried deep in edit-form-advanced.php and there's no documentation I could find as to what it is meant to be used for. Is there a better way to achieve this, or at least some way to avoid the browser complaining that I'm moving away from a page where I have made edits?


title: Set default avatar network-wide

text: I've seen plugins and snippets on how to set a new default avatar for a site. I'm wondering if this can be done network-wide, such that every new site on the network will have the network's avatar as its primary default. from there the plugin's that allow the user to upload a new avatar will be sufficient to let each site define it's own. But until they do I'd prefer they have my avatar than the mystery man or some of the others which are downright ugly.


title: Contact Form 7 not sending emails- no confirmation, no error

text: Live site. I've noticed that Contact Form 7 recently stopped working, despite my not having touched any of the settings. What's odd is that I receive neither a confirmation nor an error message; I click "send" and nothing happens. This problem persists across FF, Safari, and Chrome. I read in other, older threads that it could be something to do with SMTP settings, but as the threads were 2 years old, most of the work-around plugins they suggested are no longer an option. I also found a patch that was intended to address a problem similar to what I'm experiencing, but the patch has made no difference in my situation. Any ideas? Once the problem is fixed.. is there any way for me to obtain the lost email? I use the form for my business site and have undoubtedly lost leads because of this.. WP 3.4.2 CF7 3.3.1 ETA: More info here.


title: Strange Behaviour with is_home()

text: I'm having an odd issue, although I can understand why it works like this I do need to find a way around it. I have used the the request filter to modify the query for the home/index page to select for a post type other than 'post' The result of this is that is_home() is returning false in the index.php template. If I disable the filter then is_home() goes back to returning true. Anyway to force the is_home() to return true? or another way to approach this? Thanks, Stewart.


title: How to Remove Subscribers from the Post Author Drop Down

text: I have a WP Multisite installation. On the main blog all subscribers are appearing in the post author dropdown on the post edit screen. I think this happened after an upgrade to 3.0.1. The new user role is set to Subscriber, so it's not like all the new signups are being made contributors or authors. Does anyone know if the problem I'm experiencing is a bug? Or am I missing something really obvious? We have hundreds of subscribers so it's really a pain to try to find the right one to assign a post author. Any help / hacks would be much appreciated. Thank you. ALSO.... when I look at edit-form-advanced.php , I see this:               if ( post_type_supports($post_type, 'author') ) {         $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM         if ( $post->post_author && !in_array($post->post_author, $authors) )             $authors[] = $post->post_author;         if ( ( $authors && count( $authors ) > 1 ) || is_super_admin() )             add_meta_box('authordiv', __('Author'), 'post_author_meta_box', $post_type, 'normal', 'core');     }      Is there anything I can change in there to fix this?


title: wordpress theme option in other templates

text: I am using word press theme option panel and using those in my header.php without any issues, code as follows...               <?php         // loading theme options.  used in header.php         global $options;         foreach ($options as $value) {             if (get_settings( $value['id'] ) === FALSE) {                  $$value['id'] = $value['std'];              } else {                  $$value['id'] = get_settings( $value['id'] );              }         }     ?>          <?php echo $aagt_fb_url; ?> //loads fb url      But if i use `<?php echo $aagt_fb_url; ?>` in index.php it doesn't work, can you please help me to resolve this issue. thanks.


title: single-type.php not working, delivering 404

text:
I've created a custom post type, and have successfully added a few entries. I can call these entries out with `query_posts()` to show on the front page, but `the_permalink()` on each of them just sends me to a "Page not found" 404. Am I missing something? I'm currently running on `http://localhost`, so the results of `the_permalink()` from the front page custom post type loop sends the user to `http://localhost/PU/PU2010/website/cartoons/einstein-on- california`. ### functions.php               function createCartoonPostType() {         register_post_type( 'cartoon', array(             'label' => 'Cartoon',             'public' => true,             'hierarchical' => true,             'supports' => array( 'title', 'editor', 'thumbnail', 'comments' ),             'rewrite' => array( 'slug' => 'cartoons' )         ) );     }     add_action( 'init', 'createCartoonPostType' );      According to this, I should be able to just create `single-cartoon.php`, correct? ### single-cartoon.php               <?php get_header(); ?>

                     <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>                              <?php the_title(); ?>                          <?php endwhile; ?>

                 <?php get_template_part( 'social', 'box' ); ?>                 <?php get_sidebar(); ?>

          <?php get_footer(); ?>      ### loops-cartoons.php (frontpage loop)               <?php query_posts( 'post_type=cartoon&posts_per_page=1' ); ?>

         <?php if ( ! have_posts() ) : ?>             Sorry, no posts.         <?php else : while ( have_posts() ) : the_post(); ?>
                  <a href="<?php the_permalink(); ?>" class="preview-image">                        <?php the_post_thumbnail( 'featured' ); ?>
         <?php endwhile; endif; ?>

     <?php wp_reset_query(); ?>


title: Removing blog page images

text:
I have my blog page here on a website I created, however I'm not understanding quite where to find the code to get rid of the images on my child theme. I'm using code from Twenty Ten and have set my own BLOG template page up but it's not working so I'm obviously editing the wrong file. So isn't loop.php the file I'd want to edit to take out these images on the main blog page?               <?php /* How to display all other posts. */ ?>              <?php else : ?>             <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>
                        <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
                     <?php the_excerpt(); ?>
         <?php else : ?>
                     <?php the_content( __( 'Continue reading →', 'twentyten' ) ); ?>                     <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:', 'twentyten' ), 'after' => '
' ) ); ?>
         <?php endif; ?>
       But I don't know where it is that shows the images. These are just images I've added to the blog entries throughout the content. Help is appreciated!


title: Category Templates for Post Types not Working

text: I came up with this in the codex in order to set my template for a specific category post. I have a category name called "Work". The slug for this category is "work". I created a "category-work.php" file, and yet, the post still defaults to the index.php. I am trying to access the post itself. What am I missing?


title: Custom Post Type and Custom Taxonomy Permalinks

text: I'm currently working with a client's Wordpress blog that has a permalink structure set in the admin settings as "/speaks/%postname%/". This is so that all actual blog posts (post_type=>posts) have the word "speaks" before them. However, I have created a new custom post type and a new custom taxonomy for a new section on the site. I currently have a page at /advantages/professional- development that I would like to list the new custom taxonomy on as well as the new custom post types. I have code in place on this page that is listing out the custom taxonomy "categories" for my custom post type, but the permalink for each of these taxonomy terms include the word "speak" before the rest of the permalink. How do I go about removing the word "speaks" only from this custom post type and taxonomy? Here is the code creating my custom post type:               function register_custom_posts() {     register_post_type( 'profdev', /* (http://codex.wordpress.org/Function_Reference/register_post_type) */             // let's now add all the options for this post type             array('labels' => array(                 'name' => __('Professional Dev Posts'), /* This is the Title of the Group */                 'singular_name' => __('Professional Dev Post'), /* This is the individual type */                 'all_items' => __('All Professional Dev Posts'), /* the all items menu item */                 'add_new' => __('Add New'), /* The add new menu item */                 'add_new_item' => __('Add New Professional Dev Post'), /* Add New Display Title */                 'edit' => __( 'Edit' ), /* Edit Dialog */                 'edit_item' => __('Edit Professional Dev Posts'), /* Edit Display Title */                 'new_item' => __('New Professional Dev Post'), /* New Display Title */                 'view_item' => __('View Professional Dev Post'), /* View Display Title */                 'search_items' => __('Search Professional Dev Posts'), /* Search Custom Type Title */                  'not_found' =>  __('No Professional Dev Posts Found.'), /* This displays if there are no entries yet */                  'not_found_in_trash' => __('Nothing found in Trash'), /* This displays if there is nothing in the trash */                 'parent_item_colon' => ''                 ), /* end of arrays */                 'description' => __( 'Professional Dev Custom Post Type' ), /* Custom Type Description */                 'public' => true,                 'publicly_queryable' => true,                 'exclude_from_search' => true,                 'show_ui' => true,                 'query_var' => true,                 'menu_position' => '', /* this is what order you want it to appear in on the left hand side menu */                  'menu_icon' => 'dashicons-businessman', /* 16px x 16px */                 'rewrite'   => array( 'slug' => 'advantages/professional-development', 'with_front' => false ), /* you can specify its url slug */                 'has_archive' => false, /* you can rename the slug here */                 'capability_type' => 'post',                 'hierarchical' => false,                 /* the next one is important, it tells what's enabled in the post editor */                 'supports' => array('title','editor','excerpt','page-attributes') // all of the post capabilities             ) /* end of options */     ); /* end of register post type */     } add_action( 'init', 'register_custom_posts');      And here is the code that creates my custom taxonomy for this post type:               function create_profdev_taxonomies() {     // Add new taxonomy, NOT hierarchical (like tags)     $labels = array(         'name'                       => _x( 'Categories', 'taxonomy general name' ),         'singular_name'              => _x( 'Category', 'taxonomy singular name' ),         'search_items'               => __( 'Search Categories' ),         'popular_items'              => __( 'Popular Categories' ),         'all_items'                  => __( 'All Categories' ),         'parent_item'                => null,         'parent_item_colon'          => null,         'edit_item'                  => __( 'Edit Category' ),         'update_item'                => __( 'Update Category' ),         'add_new_item'               => __( 'Add New Category' ),         'new_item_name'              => __( 'New Category Name' ),         'separate_items_with_commas' => __( 'Separate categories with commas' ),         'add_or_remove_items'        => __( 'Add or remove categories' ),         'choose_from_most_used'      => __( 'Choose from the most used categories' ),         'not_found'                  => __( 'No categories found.' ),         'menu_name'                  => __( 'Categories' ),     );          $args = array(         'hierarchical'          => false,         'labels'                => $labels,         'show_ui'               => true,         'show_admin_column'     => true,         'update_count_callback' => '_update_post_term_count',         'query_var'             => true,         'rewrite'               => array( 'slug' => 'advantages/professional-development/' ),     );          register_taxonomy( 'prof_dev_category', 'profdev', $args );     }      Ideally, I'd like to have the following permalink format: /advantages/professional-development/taxonomy-term/post-name How can I go about achieving this? Any help would be greatly appreciated! * * * **UPDATE** - Can't believe I missed it, but somehow I forgot to include               , 'with_front' => false      at the end of my taxonomy rewrite slug rule. The corrected code is:               'rewrite' => array( 'slug' => 'advantages/professional-development', 'with_front' => false )      This results in ignoring the default permalink settings in WP Admin.


title: HTTPS connection with wampserver for "Facebook for WordPress" plugin

text: I have installed Wordpress 3.9.1 on wampserver2.2e-php5.3.13-httpd2.2.22-mysql5.5.24-x64. Then I installed the Facebook Plugin (1.5.5). I created a Facebook app and than I wanted to enter the credentials in the Facebook plugin. I get the following error message: > Your server does not support communication with Facebook servers over HTTPS. > > Facebook application functionality such as posting to your Facebook Timeline > requires a HTTPS connection to Facebook servers What can I do to allow the HTTPS connection? Is this a configuration problem with wampserver? PS: I don't know where to put this topic. Is it serverfault, superuser or wordpress? I put it on wordpress because it is the main topic here. **Edit:**   The error message is thrown through this piece of code:               // notify of lack of HTTPS     if ( ! wp_http_supports( array( 'ssl' => true ) ) )         add_action( 'admin_notices', array( 'Facebook_Application_Settings', 'admin_notice' ) );


title: User submitted post

text: I'm sure there are plugins to do this but I wanted to try and do it myself. I have a form that contains a title and a content/message area. I would like to add this form as a post when fill it in. How do I go about adding the user completed form as a post. Any tutorials or pointers would be greatly appreciated.


title: SWF in wordpress post

text: My question is somewhat a two part question. First I embedded a SWF file into my blog post using Easy Flash Embed plugin. It shows up on my desktop computer but when I view the post on my mobile device, I can not see the SWF content. Does the plugin Easy FancyBox solve this problem? My follow-up question is, I'm wondering if embedded SWF files is safe for my blog/website. Should I not use SWFs?


title: get_page_children arguments - page objects?

text: From the Codex, I'm using this function to return all children from a page ID without using SQL queries. Usage:               <?php get_page_children( $page_id, $pages ) ?>      $page is defined as a "List of pages' objects". What are examples of page objects I would use in this case?


title: Transfer from English page to Arabic page

text:
I have a button at the top of the website in **header.php**. That button should transfer me to the Arabic version of the page if I am on an English page. For example, on **contact.html** the button should transfer me to **contact- ar.html** and on **info.html** the button should transfer me to **info- ar.html**.
arabic
      I want to know if there is any way to edit part of the **header.php** from outside?


title: Custom taxonomy position in admin panel

text: I can't figure out how to change position of custom taxonomy menu item in the admin panel. Right now I have custom post type-- `custom_1`-- and another custom post type-- `custom_2`. For custom_2, I've set `'show_in_menu' => 'edit.php?post_type=custom_1'` and it works fine. The problem is, I've added a custom taxonomy for custom_2 and it's not showing under the same parent menu item. Is there any way to alter the position of custom taxonomy menu item?


title: Make WordPress size and name images for Retina.js

text: I'm a huge fan of the way retina.js works for high pixel density displays. Essentially, when it's loading image assets (via `<img>` or css image) it will check if there's a `@2x` suffix version of the image (eg. if there's a `logo.jpg` it will automatically show the `logo@2x.jpg` in its place if it exists. The WordPress function `the_post_thumbnail` lets me define various image sizes, but I want to know if there's a way to have it also create versions of the images that are twice the size with the `@2x` suffix as well! It's easy to do this for theme files, but would be pretty awesome to allow this for content images as well.


title: Jetpack infinite scroll not working on Twenty Twelve

text: I just updated **Jetpack** and the theme, and the **infinite scroll** doesn't work anymore. I have tracked the console, and the **XHR** does receive the content of the posts to add but somehow it isn't displaying them. My blog is: http://jorjon.com/blog/ I have **no custom modification** whatsoever. **Update:** Thanks to Jared, I have found this Javascript console error:               Uncaught SyntaxError: Unexpected token < jquery.js:2     v.extend.parseJSON jquery.js:2     (anonymous function) infinity.js:208     l jquery.js:2     c.fireWith jquery.js:2     T jquery.js:2     r      **Update 2:** This is what is being returned by the **XHR** , supposedly there is an unexpected token there, but I can't find anything. The JSON at the last line, as Jared mentioned, is Valid. http://pastebin.com/ZUD2xqun


title: Retrieve image from content, assign it as a featured, and then remove it from the content

text: I am trying to grab the first image from the content and use as featured image, then remove the that image from the content. I found the plugin get the image, but it doesn't save image on the post, at least on 3.5.1 wp


title: Why is it bad to use the GUID?

text: I recently upgraded my WP version from 3.2.x to 3.5.x. In the process, the WP functions that retrieve images (wp_get_attachment_image_src, get_the_post_thumbnail, etc) are now broken. I had to change calls to those functions and use `<img src='.$my_post->guid.'>` in order to get it to work. However, people have told me that using guid is not good. I'm not changing the value though, just using it because I can't find any other way to get my images to load properly. The `wp_get_attachment_image_src` method doesn't return anything. What's so bad about using the guid if it doesn't change? Is it okay in this situation?


title: Can a WordPress administrator see other users' passwords?

text: Of course, an administrator in WordPress can reset other users' passwords (including that of other administrators). However, can a WordPress administrator **see** other users' passwords? Phrased differently, does the WordPress software protect registered users from an unscrupulous administrator observing their passwords? Of course, since WordPress is open source, I realize a malicious administrator could hack the software to divulge users' passwords. But I'm asking about the standard WordPress build.


title: Deleting users do not deletes coments

text: Hello I have bee trying to figure this one out without any luck. I am deleting users from my site, and selecting either `delete comments` or `attribute comments to:` options do nothing. The user does not show in dashboard->users but all their comments are there and/or not attributed to someone i chose. Any ideas why this is?


title: When is it OK to create a custom table for a plugin?

text: A while ago I wrote a question asking about storing easily queryable data associated with a given attachment. The recommendation that I received at the time was that I should avoid using the WP attachment metadata because it cannot be quickly queried for. Instead, what was recommended (and what I opted to implement) was to store all of the values in an array within an option. This works, but the design of the thing makes me want to cry. It goes agains every fiber of my being which says, "that should be its own table!" See what I mean: http://pastebin.com/hBfrxaiH So my question is, under what circumstances should a WP developer consider creating a custom table to support their plugin? I know that custom tables are generally frowned upon, but I feel like what I'm currently doing is an abomination and really would like to achieve my plugin's needs in a cleaner way. My thinking with a custom table is that not only would it clean up this design disaster, but I would also have a higher degree of control over how and when values are loaded from the DB rather than just pulling EVERYTHING out before being able to do anything intelligent with the data. Additionally, unlike the current solution, a custom table would scale -- the current solution most definitely does NOT scale.


title: How do i reference the theme path in pages for images?

text: How do i reference images in a page/post without installing the php plugin or typing it out manually like this:               domain.com/wp-content/themes/mytheme/image.jpg


title: Format HTTP links

text: I have a custom page template creating an xml feed found on a WP page at http://example.com/xml/ I am trying to access this xml document via Google Maps but it appears I need the actual file name like example.com/xml/example.xml How can I add a .xml file extension at the end of the link http://example.com/xml/ ? **EDIT:** I am using a page template in my theme to display the output of XML. The XML part is probably irrelevant. What it comes down to I guess is how do I assign a specific file extension off of a page template such as /example.xml


title: Possible to replicate economist.com's debate section in wordpress?

text: We're building an online magazine with a debate section similar to economist.com/debate. Is it possible to do it in wordpress with existing plugins? Thanks so much.


title: Making WP Admin Folder accessable JUST under a different link

text: I read all your post regarding renaming and moving the admin folder a few times but I still didn't find the real answers to my question! I got a page, lets say available under mysite.com ,the real wordpress is found under mysite.com/wordpress (of course not directly available over that link) and therefore my wp admin under mysite.com/wordpress/wp-admin/ I made the needed adaptions in the index.php and used the following commands in my .htaccess to make my wordpress available under mysite.com                   <IfModule mod_rewrite.c>         RewriteEngine On         RewriteBase /         RewriteRule ^index\.php$ - [L]         RewriteCond %{REQUEST_FILENAME} !-f         RewriteCond %{REQUEST_FILENAME} !-d         RewriteRule . /index.php [L]         </IfModule>      Everything is working perfect now BUT want to realise the follwing. I want to reach my admin section JUST over lets say mysite.com/secret-area and mysite.com/secretarea/ and NOT ANYMORE over mysite.com/blog/wp-admin/ or mysite.com/blog/admin If I would be able to realise a server based password protection for that path too, it would be extremly great :) How can I realise that over .htaccess ? I did a lot of research and tried a lot of things but couldn't get it done in the end :/ Thx a lot for your help guys! Nice Regards, Stephan


title: Add Submenu Link in add_submenu_page That Opens in a New Window

text: How can I add a sub menu link using add_submenu_page that will open a new window (`target="_blank"`) instead of opening in the current one (default behavior)?


title: Show WordPress Custom Taxonomy Items Based On a Selected Item From Another Custom Taxonomy

text: Let me explain the problem I am dealing with: I have 2 custom taxonomies. One is named "thestate" and the other one is named "thetown". In " **thestate** " I have listed all the states in the U.S.   In " **thetown** " I have listed the main towns in the U.S. For each taxonomy I have their items displayed in a drop-down Do you understand where I am going with this? :D I need to be able to display the items in "thetown" based on what state is selected in the taxonomy "thestate" **For example** , if the user selects "Michigan" (in the taxonomy called "thestate), the page automatically refreshes, and in the next drop-down, in the taxonomy called "thetown", I have only the cities "Detroit", "Grand Rapids", "Warren". If the user then changes his mind and selects "Texas", the page automatically refreshes and in the next drop-down, in the taxonomy called "thetown" I have only the cities "Houston", "San Antonio", "Dallas". Hope my explanation makes sense! Can you think of a logic by which I can accomplish this? Best regards, Gabriela


title: jquery document ready function not being called

text: For some reason I can't get the jquery document ready to fire for my plugin my javascript               jquery(document).ready(function($) {         alert("hello world");         $("#testdiv").text("hi");     });      the source from my website               <link rel='stylesheet' id='admin-bar-css'  href='http://example.com/wp-includes/css/admin-bar.css?ver=20111209' type='text/css' media='all' />     <script type='text/javascript' src='http://example.com/wp-includes/js/jquery/jquery.js?ver=1.7.1'></script>     <script type='text/javascript'>     /* <![CDATA[ */     var fantasy_golf = {"ajaxurl":"http:\/\/example.com\/wp-admin\/admin-ajax.php"};     /* ]]> */     </script>     <script type='text/javascript' src='http://example.com/wp-content/plugins/fantasy-golf/js/fantasy-golf.js?ver=1.2'></script>     <script type='text/javascript' src='http://example.com/wp-includes/js/comment-reply.js?ver=20090102'></script>      when I follow the source of my fantasy-golf.js (in firefox's source) it has the correct version of my js. (it shouldn't be due to it caching an older version)


title: Group WP_Query by meta_key date

text:
I have a wp_query which lists posts from a custom post type, sorted by a custom field 'time'. I'd like to group this list by another custom field 'date', so that every post that has the same custom field 'date' is listed beneath that date. I do not know these dates in advance. The output would be like: Date x   - post 3   - post 6   - post 8   Date y   - post 1   - post 4   Date z   - post 2   - post 5   - post 7   - post 9   Below is my current WP_Query:               <?php             // WP_Query arguments             $args = array (                 'post_type'              => 'movie',                 'posts_per_page'         => '50',                 'orderby'                => 'meta_value_num',                 'order'                  => 'ASC',                 'meta_key'               => 'time',             );                  // The Query             $query = new WP_Query( $args );                  // The Loop             if ( $query->have_posts() ) {                 while ( $query->have_posts() ) {                     $query->the_post();                     echo "
";                     echo "
".get_the_title()."
";                     echo "
";                          $vbrand = get_post_meta( get_the_id(), 'brand', true );                      $vyear = get_post_meta( get_the_id(), 'year', true );                      $vtime = get_post_meta( get_the_id(), 'time', true );                                   echo "
".$vbrand;                     echo "
".$vyear;                     echo "
".$vtime;                 }                  } else {                 // no posts found             }             /* Restore original Post Data */             wp_reset_postdata();     ?>


title: Code only works every other time its run

text: This code below works fine as long as I leave the $wpdb query commented out. However, I'm trying to clear the current settings before I write the new ones into the db. That's the purpose of the $wpdb delete command. However, something curious is happening. It only writes the values to the database every other time its run. Despite the fact that I can trace echo the correct values each time. Either the delete is running after the update_options loop (clearing the values) or the values never get written.               function doSettings()     {     /* FIRST CLEAR ALL SETTINGS */          //  global $wpdb;     //  $wpdb->query( "Delete FROM wp_options where option_name like 'mx2|_%' escape '|'");              $file = WP_PLUGIN_DIR.'/mx-settings/settings.ini';         if (file_exists($file) && is_readable($file))         {                    $ini_array = parse_ini_file($file);             foreach ($ini_array as $key=>$value) {                 if($key != "template" && $key != "stylesheet")                     update_option($key, stripslashes($value));             }          }         return;     }


title: Custom Post Type Nav to Subpage

text: I've registered a post type for an audio plugin, the post type is "Custom Players" in the admin and has its own tab on the admin sidebar. I'm just curious if there's a simple way to move this out of the menu and make it another sub-item under "Settings", for example, as cleverly illustrated in this screenshot: ![enter image description here](http://i.stack.imgur.com/cGGdA.png) I know about the `show_in_menu` key for `register_post_type()` but don't want to make the post type inaccessible from the admin; I'm just curious about making it less prominent, it's a post type that won't be used frequently. Thanks for even looking at this! Peace


title: How to add a data attribute to a WordPress menu item

text:
I'm Twitter Bootstrap and need to add data-toggle="modal" attribute to the a tag of menu link. Upon searching most all results reference doing a walking for Twitter Bootstrap dropdown menus however this menu has no dropdowns and I only need to add the particular attribute. Next I found this: Add custom attributes to menu items without plugin which is very helpful as it appears in WordPress 3.6+ we no longer have to do long complex walkers and instead can use this: http://codex.wordpress.org/Plugin_API/Filter_Reference/nav_menu_link_attributes However as of this running that API reference is quite bare and offers no examples and since it's so new there are very few references to it on Google. I tried this first:               add_filter( 'nav_menu_link_attributes', 'mywp_contact_menu_atts', 10, 3 );          function pb_contact_menu_atts( $atts, $item, $args )     {         // inspect $item, then …         $atts['data-toggle'] = 'modal';         return $atts;     }      and that does work however it as expected adds the attribute to all the a tags in the menu. So I'm trying to figure out how to target one menu item with #menu-item-7857 a or such. Does anyone know where to find an example of targeting a menu item or able to determine how to basd on the information that's in the above linked API reference? To note, I did find the following one example but it only targets items that have children which does not help but may be in the right direction:               add_filter('nav_menu_link_attributes', function($atts, $item, $args) {         if ( $args->has_children )         {             $atts['data-toggle'] = 'dropdown';             $atts['class'] = 'dropdown-toggle';         }              return $atts;     }, 10, 3);      UPDATE - The only answer below sounds like it's on to something but from it wasn't able to determine how to actually find the number to target my specific link and where/how to add that conditional in a working example. Added a comment but didn't hear back. Since been about 18 days thought I'd see if a bounty would help. When I look at the code for the link I want to target:
Chat
      I see the number 7858 so thinking maybe that is the number I should be targeting. But when I try for instance: ` add_filter( 'nav_menu_link_attributes', 'my_chat_menu_atts', 10, 3 ); function my_chat_menu_atts( $atts, $item, $args ) { if ( 7857 == $item['ID'] ) { // inspect $item, then … $atts['onclick'] = 'SnapEngage.startLink();'; return $atts;               }      } ` However adding that if statement the one commenter suggested I get the following error: Fatal error: Cannot use object of type WP_Post as array I'm assuming more code is required but at a lost. As a reminder without the if statement it works however it targets all links rather than the one link I want to target.


title: I want to add a tax-ID field in registration form and upon submission, perform a lookup by tax-ID

text: I want to allow visitors to register to my site. I want to add tax ID field in the form. Upon submission, I want to check if the user belongs to a list (which has been imported in a custom table)and if yes, assign him a role. How do you propose I should handle all that? Thanks.


title: Ajax for non-logged-in users

text: I'm working on a plugin that captures some data from a non-logged-in user (such as a Like Button) and enters it into the database based on post_id. My plugin works fine for logged-in users but non-logged-in users produces a "-1" response in AJAX. I'm guessing this has to do with an authentication barrier for writing to the database but I'm looking for a way to work around that. Any ideas? EDIT: Here is the code: http://pastebin.com/ghtvJNiW I'm basing this off the Love-It AJAX plugin by Pippin. He says in the tutorial that this only works for logged-in users but I need to get this to work for non-logged-in users as well.


title: Is there an URL listing latest posts

text: Currently my homepage is showing my lastest posts but I want to replace it with a page. I wish that all the posts could still be seen in a widget and by clicking on "news" in the menu. I already do that for custom types with `http://website.com/customtypename/` which shows all my lastest items. Just by adding this URL to my main menu Is there the same URL already existing for posts?


title: add_filter with specific thumb names

text: How would I run `add_filter` only on some specific registered thumbnail sizes '$size' ? like 'large' , 'medium', etc?


title: Making my plugin create a page?

text: I have created a plugin that creates a table in the database and allows users to add an Item to the table. I would like each item to also create a page for its self so that when the items are listed I can have each one link to there individual pages. Anyone know the proper way of doing this?


title: Getting Duplicate Posts on Home Page with Widget Added Between Posts

text:
I'm trying to add a widget area in between posts on the home page. I got them to show right where I want them, after the first post. The problem is that the first two posts are duplicated. The same post that shows above the new widget area is also shown after the widget area. If I take out the call for widget code and just place regular ad code then the posts don't duplicate. This only happens when I call for the widget. I'm not sure how else I could fix this. Here's what my code looks like in index.php               <?php $postnum = 1; $showads = 1; $counter = 1; ?>         <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" rel="bookmark"><?php the_title(); ?>
             <?php if($options['mts_headline_meta'] == '1') { ?>

<?php _e('By ', 'mythemeshop'); the_author_posts_link(); ?>

<?php the_time('F j, Y'); ?><?php the_category(' ') ?><a href="<?php comments_link(); ?>" rel="nofollow"><?php comments_number('No comments','1 Comment','% Comments'); ?>

             <?php } ?>
                                  <?php if($options['mts_thumbnails'] == '1') { ?>                 <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" rel="nofollow"><?php if ( has_post_thumbnail() ) { echo '
'; the_post_thumbnail('thumbnail', array('title' => '')); echo '
'; } ?>                 <?php } ?>
                     <?php the_excerpt(); ?>
<a href="<?php the_permalink() ?>" class="readmore" rel="nofollow">Read More...

                  <?php if ($postnum == $showads) { ?>     <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Hot-Widget") ) : ?><?php endif; ?>     <?php } $postnum++; ?>              <?php endwhile; else: ?>      If I add a normal ad code in between the two lines below, then the posts aren't duplicated but whenever I call for the widget then the posts are duplicated.               <?php if ($postnum == $showads) { ?>     <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Hot-Widget") ) : ?>         <?php endif; ?>     <?php } $postnum++; ?>      Here's what my page looks like now http://carrenomedia.com/rp Here's the link to code for the Recent/Popular posts widget http://pastebin.com/YbMhKAMV


title: Live coding in WordPress

text: Is there a plugin or an easy way to integrate code writing and compilation windows in WordPress, for example to duplicate the Learn Python functionality (see at bottom).


title: wp-admin post.php JavaScript Links Not Working

text: I just recently noticed in my backend admin panel none of the dynamic JavaScript links will open or work at all. This includes the 'Edit' links next to Status, Visibility, and Scheduled. Also the slug permalink edit button will not do any Ajax/JavaScript. Clicking any of the links will just append the hashtag value (ex. **#edit_timestamp** ) into my URL. But it appears as though there is no way to update the publishing timestamp or post URL without going through JavaScript. Is this a common issue that others have run into? I already tried disabling all my plugins which I'm only using 2 - Akismet and Google XML Sitemaps. I also tried switching off my default theme to use Twenty Eleven and TWenty Ten, but still these links will not work. It's very stressful because I can't even write new posts or schedule them to publish in the future without directly editing the database. Would appreciate any feedback if somebody has seen this problem before! Also let me know if I can clarify anything because I realize this may be confusing.


title: User access sharing between two wordpress installation

text: I'm successfully make a two wordpress installation with sharing same users and usersmeta table , on primary site i have allowed registration but on 2nd site i have disabled registration... But when someone register new account on my primary site he can access also with same login and 2nd site, problem is with user role here. because on primary site user role is normaly Subscriber, but on 2nd site role is None , any chance to fix this problem and on both site i need to have same user role... All what im do is edit config.php at 2nd site by adding this line               $table_prefix  = 'wpsupport_';     define('CUSTOM_USER_TABLE', 'wp_users');     define('CUSTOM_USER_META_TABLE', 'wp_usermeta');


title: Can the Next/Prev Post links be ordered by menu order or by a meta key?

text: I have a series of posts that are ordered by a meta_key value. They could also be arranged by menu order, if necessary. The next/prev post links (generated by `next_post_link`, `previous_post_link`, or `posts_nav_link` all navigate by chronology. While I understand this default behaviour, I don't understand how to change it. I found that it maps through to adjacent_post_link in link-template.php, but then it starts to seem fairly hard-coded. Is it recommended to re-write this from scratch to replace it, or is there a better solution.


title: NextGen - Display Image Count Per Gallery

text: I am using the NextGen gallery WordPress plugin for a site. In my gallery.php template I want to retrieve the number of images for each gallery displayed in the loop. I cannot figure out a way to get the data and print it under the thumbnail of each gallery that's called in gallery.php Here is where I want to insert the gallery image count and print it:               <?php      global $wpdb;      $images = intval( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures") ); ?>      <a rel="prettyPhoto" href="<?php echo $image->imageURL ?>" <?php $image->thumbcode ?>>         view          <?php echo $images; ?> pictures


title: When Author add new post change default status to pending

text: Same as above when Author add new post change default status to pending instead of published


title: How do I exclude plugins from getting automatically updated?

text: There is an opt-in filter that allows all plugins on my site to receive automatic updates: `add_filter( 'auto_update_plugin', '__return_true' );` I like this feature, but I don't want all my plugins to be updated automatically. How can I allow some plugins to be updated automatically, while excluding those I want to do manually?


title: Custom table naming/access convention for multisite: $table_prefix vs base_prefix or other?

text: After WP3.8.1 upgraded, two plugins I made for my networks both stopped working. Each runs on a separate multisite install. I posted the error report on the Wordpress form: http://wordpress.org/support/topic/table_prefix-error- since-wp-381-upgrade?replies=1 For Multisite, is there a better way of accessing my custom table than using   `$my_custom_table = $wpdb->$table_prefix.'my_custom_table';`?   I see here the use of base_prefix: http://wordpress.org/support/topic/multisite-table-prefix-wpdb-prefix- incorrect?replies=6 Would it be better to rename my custom table as   `wp_my_custom_table`, instead of   `my_custom_table`, and use   `$my_custom_table = $wpdb->base_prefix('my_custom_table');`. This outputs `wp_my_custom_table`. Or are there advantages to leaving the table name as is, using `$table_prefix`, and waiting for the error report to be resolved?


title: How should I include a contact form in a premium theme?

text: So I am researching into creating a premium wordpress theme however am wondering on the best way on going about creating a contact template, in terms of using a plugin for the contact form or create my own. I would rather use a plugin such as contact form 7 however am wondering how i'd include it in my contact template as the user could create a contact form with a random name which wouldn't correlate to the name set in the contact template. Also I want a contact form which would be compatible with akimet . So my question is should I use a plugin or try to code one my self?


title: get_template_directory_uri() gives me wrong path when I try to use wp_enqueue_style

text: In my functions.php I use wp_enqueue_style and wp_enqueue_script as I read this is the correct way to add stylesheets and scripts to pages. But as my host has this sub folder where the install goes into get_template_directory_uri() gives me the wrong path. It gives me http://www.example.com/wp- content/themes/mytheme/css/style.css?ver=1.0" I need it to be http://www.example.com/subfolder/wp- content/themes/mytheme/css/style.css?ver=1.0" I have no clue at the moment.


title: E-Commerce Products Page Sidebar Formatting

text: I inherited a wordpress e-commerce website from a developer that only half finished the project. I do not know alot about css or php, but I have been able to play around with the coding enough to almost finish the products page. I am having trouble formatting the products page however, the products listing is too wide and is showing below my sidebar instead of next to it. Here is a link to my site and the page that shows the error I am talking about http://www.pru-dent.com.previewdns.com/?wpsc_product_category=mirrors I have played around with the wpsc-default.css file to resolve this simple issue, but the changes I make do not seem to be having any effect with the product list row taking up the whole content area. I tried to change the product display container, from 100% width to 60%, but when I updated the file the website still looked the exact same. Any ideas on where I might want to look in the code to resolve this issue?


title: Hide "Add media", html editor from tinymce

text: I have a custom post type which supports editor. (WordPress ver. 3.5) I want to customize the editor for it.   1. Make it readonly   2. Hide "Add Media" button   3. Hide HTML editor   4. Remove status bar showing word count I am using the following code:               add_filter( 'tiny_mce_before_init', function( $args ) {          $args['readonly'] = 1;          $args['media_buttons'] = 0;          $args['theme_advanced_disable'] = "code";          return $args;     });      Only readonly is working. Is it not possible to do other customization using `tiny_mce_before_init`?


title: How to get the ID of the currently logged in user?

text: I want to get the ID of the currently logged in user. I've found the function: `get_current_user_id` which seems to be working, however I'm not sure what 'current' means in this context. Meaning if the user views the profile of another user, then will the current user change to become the other user? In short I'm looking for a reliable way to always get only the id of the logged in user.


title: How to set "Unattached" option as default in Media Library?

text: When inserting an image into a post, I want the "Unattached" filter to be the default upon opening the media library. Screenshot Any way to do this?


title: WP Import changes JSON string

text: I have this JSON string in my exported XML file               {"0":{"row_columns":{"0":{"column_items":{"0":{"item_type":"blog","item_icon":"http://vicente.moutheme.com/wp-content/themes/icente/layout-builder/assets/images/items_icons/wordpress_logo.png","items_data":"{\"item_width\":\"3\",\"items_number\":\"\",\"excerpt_length\":\"20\",\"more_text\":\"Read More\",\"gallery_option\":\"\"}"}},"column_width":12}},"row_opts":{"display_row_heading":"yes","row_heading":"          Our Most **Recent** Posts          ","heading_type":"h1","show_divider":"yes","divider_icon":"20","row_description":"","heading_margin":"60"},"row_layout":11}}      but after importing XML file by default wordpress import, in custom field is this string               {"0":{"row_columns":{"0":{"column_items":{"0":{"item_type":"blog","item_icon":"http://vicente.moutheme.com/wp-content/themes/icente/layout-builder/assets/images/items_icons/wordpress_logo.png","items_data":"{\"item_width\":\"3\",\"items_number\":\"\",\"excerpt_length\":\"20\",\"more_text\":\"Read More\",\"gallery_option\":\"\"}"}},"column_width":12}},"row_opts":{"display_row_heading":"yes","row_heading":"          Our Most **Recent** Posts          ","heading_type":"h1","show_divider":"yes","divider_icon":"20","row_description":"","heading_margin":"60"},"row_layout":11}}      It's almost the same, except that the SLASHES dissapeared. Does anyone know, how to avoid this? Because without these slashes it's not valid JSON string. Thank you very much for any help.


title: Forward and mask a WordPress website

text: I have a WordPress website hosted on GoDaddy on this domain: `theaccountantmalta.com`, we've set up a Parked Domain so that the domain used is `theaccountant.org.mt`. I've asked GoDaddy if it's possible to have users always on `theaccountant.org.mt` when navigating the website rather than be linked back to the other domain. The reply I got was that WordPress is domain specific so links will remain pointing to `theaccountantmalta.com`. But I can set up forwarding with masking to solve this. What I've done so far is change the WordPress's settings `WordPress Address (URL)` and `Site Address (URL)` to `http://theaccountant.org.mt`. This does solve the issue but I'm not sure if it's the best way or if there are other solutions. I know there are a number of plugins (WPMU) that handle this stuff but from what I've seen you have to have a WordPress Network or MultiSite enabled to use them, I'm not sure if I need this in my case really.


title: How can I see what template parts are being called for rendering the viewable page?

text: I have a theme where the developer used get_tempalate_part() a lot, and these parts are scattered across theme subdirectories as well as in directories in a plugin that was created to assist with the theme. Here is the code I'm using to understand the primary template being called (the parent template, for lack of better words):               add_action('wp_head', 'show_template');     function show_template() {         global $template;         print_r($template);     }          show_template();      This works fine, but it shows only the location of the parent template file. What code can I use to find out what and where from the template parts are being called?


title: Change Site Logo or Menu Logo Per Page

text: **Background:** Conference company with multiple events, on each event page would like to switch out the brand's logo with the event logo along with custom menu for event. Using standard WP install for brand's 3 events. Then a page per each year's event details. **Issue:** How can I create a custom menu that changes the logo per specified page? Recommended plugin? Logo-less site with custom code in the menu?


title: Connections plugin pagination

text:
I am currently using the Connections plugin for WP. It supports no pagination for the directory results though. I've tried putting efforts on the code to make pagination work but I found no success yet. I'm trying to paginate the foreach loop to return 20 results per page. Here's a portion of the **inc.shortcodes.php** file which contains the returning of results:               $newSQL = "SELECT * FROM ".CN_ENTRY_TABLE." WHERE"             . "  (YEAR(DATE_ADD('$wpCurrentDate', INTERVAL ".$atts['days']." DAY))"             . " - YEAR(DATE_ADD(FROM_UNIXTIME(`".$atts['list_type']."`), INTERVAL ".$connections->options->sqlTimeOffset." SECOND)) )"             . " - ( MID(DATE_ADD('$wpCurrentDate', INTERVAL ".$atts['days']." DAY),5,6)"             . " < MID(DATE_ADD(FROM_UNIXTIME(`".$atts['list_type']."`), INTERVAL ".$connections->options->sqlTimeOffset." SECOND),5,6) )"             . " > ( YEAR('$wpCurrentDate')"             . " - YEAR(DATE_ADD(FROM_UNIXTIME(`".$atts['list_type']."`), INTERVAL ".$connections->options->sqlTimeOffset." SECOND)) )"             . " - ( MID('$wpCurrentDate',5,6)"             . " ".$includeToday." MID(DATE_ADD(FROM_UNIXTIME(`".$atts['list_type']."`), INTERVAL ".$connections->options->sqlTimeOffset." SECOND),5,6) )"             . $visibilityfilter;          $results = $wpdb->get_results( $newSQL );            ...          foreach ( $results as $row ) {                      $entry = new cnvCard($row);                 $vCard =& $entry;                      $entry->name = '';                      $alternate == '' ? $alternate = '-alternate' : $alternate = '';                      /*                  * Whether or not to show the last name.                  * Setting $entry->name is for compatibility to versions prior to 0.7.1.6                  */                 ( ! $atts['show_lastname'] ) ? $entry->name = $entry->getFirstName() : $entry->name = $entry->getFullFirstLastName();                 if ( ! $atts['show_lastname'] ) $entry->setLastName('');                      $out .= '
' . "\n";                     ob_start();                                 do_action( 'cn_action_card-' . $template->getSlug(), $entry, $template, $atts );                              $out .= ob_get_contents();                              ob_end_clean();                 $out .= '
' . "\n";                  }      Is it possible to paginate this? Thanks!


title: Batch approve comments

text: Akismet went crazy and sent several hundred comments to spam. Right now, I have to manually mark each comment as "Not Spam" and then manually move all of them from Pending to Approved. Any way to do this in a more efficient way?


title: How would I get 1 latest post from a query for 5 posts?

text: So I have a `wp_query` which is getting the 5 most recent posts from my Wordpress site. What I want to do is from within this query, grab the most recent post and show this as a sort of 'hero' post, and then take the other 4 posts (could be more than 4 if I change the query at a later date) and show in a list or grid below this hero post. Here is my query code so far (obviously simplified):               <?php           $query_args = array(         "posts_per_page" => "5"     );          $listedPosts = new WP_Query($query_args);          // the loop          if ( $listedPosts->have_posts() ) {         while ( $listedPosts->have_posts() ) {             $listedPosts->the_post();             // loop content for hero post goes here (I need to get the most recent post).         }      }          // how would I show the other remaining posts in the query?          ?>


title: Disable WordPress' blogging functionality and disable 'posts'

text: I'm currently using WordPress for a website and it will simply be acting as a CMS rather than a blogging platform. This means that WordPress' 'posts' are not needed. Is there anyway of disabling them by adding some code to `functions.php`? It would be acceptable to just remove the 'posts' option from `wp-admin`.


title: After installing a free theme, my wordpress turns into text mode when accessing remotely

text: I just finished installing newest Wordpress on my local machine and then installed free theme `Hassiumize` from http://www.paddsolutions.com/. The problem is that the whole page is shown nicely when I access the page on that local machine. When I access from another machine, however, the page is displayed only in text mode. Do you have any suggestions for this?


title: Show preview posts and pages to clients

text: My clients wants to see the changes i have made in his wordpress site before publishing. Is it a good method, paste the page preview link to show to him? Of course this method only works if we are both logged in the Panel Administration. Otherwise what how do you recommend to do? I can not physically meet up my client so that's why i need a solution. Many thanks


title: Display posts with author in the url with custom post types

text: I'm having a really difficult time with this. I have a multi-user gallery site. Each author has his own page that lists the author's posts (this is a custom post type). I have made it so that the author url(author.php) is www.example.com/firstname-lastname/. But when a visitor clicks on one of the author's posts, the url changes to www.example.com/custom-post-type- name/postname/ while I want it to be www.example.com/firstname- lastname/postname/. How do I achieve this? With .htaccess? Or changing the rewrite rule when registering the post type? How? I use this to register my post type in functions.php file:               // Make custom post type Add media          function galleryRegister()     {     $labels = array(     'name' => _x('Add gallery', 'post type general name'),     'singular_name' => _x('Add gallery', 'post type singular name'),     );          $args = array(     'labels' => $labels,     'public' => true,     'publicly_queryable' => true,     'show_ui' => true,     'query_var' => true,     'capability_type' => 'post',     'hierarchical' => false,     'menu_position' => null,     'supports' => array('title', 'editor', 'thumbnail'),     'rewrite' => false,     'show_in_nav_menus' => true,     );          register_post_type('gallery' , $args);     }          add_action('init', 'galleryRegister');      Thanks for help. Edit: I found out that I can manually type www.example.com/firstname- lastname/postname/ and it shows the correct post, but the permalink is still same old www.example.com/custom-post-type-name/postname/ everywhere **Solution:** Thank you Stephen for the great answer! This is the code that I used and it worked:               // ****************************************************     // Make a custom post type "Add gallery"     // ****************************************************     function galleryRegister()     {     $labels = array(     'name' => _x('Add gallery', 'post type general name'),     'singular_name' => _x('Add gallery', 'post type singular name'),     'add_new' => _x('Add gallery ', 'portfolio item'),     'all_items' => __( 'Manage your galleries' ),     'add_new_item' => __('Add gallery'),     'edit_item' => __('Edit your galleries'),     'new_item' => __('New gallery'),     'view_item' => __('View gallery on site'),     'search_items' => __('Search galleries'),     '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,     'capability_type' => 'post',     'hierarchical' => false,     'menu_position' => null,     'supports' => array('title', 'editor', 'thumbnail'),     'rewrite' =>  array( 'slug' => _x( '%author%', 'URL slug') ),     'show_in_nav_menus' => true,     );          register_post_type('gallery' , $args);     }          add_action('init', 'galleryRegister');          // ****************************************************     // Flush rewrite rules. Delete this      // ****************************************************     function my_rewrite_flush() {         my_cpt_init();              // ATTENTION: This is *only* done during plugin activation hook in this example!         // You should *NEVER EVER* do this on every page load!!         flush_rewrite_rules();     }     register_activation_hook( __FILE__, 'my_rewrite_flush' );          // ****************************************************     // Make author as slug for posts     // ****************************************************     add_filter('post_type_link', 'wpse73228_author_tag',10,4);     function wpse73228_author_tag($post_link, $post, $leavename, $sample){              if( 'gallery' != get_post_type($post) )             return $post_link;              $authordata = get_userdata($post->post_author);     $author = $authordata->user_nicename;          $post_link = str_replace('%author%', $author, $post_link);          return $post_link;     }


title: Can I change the slug of my archive page on a Custom post type?

text: I have a CPT with a slug that is the same of a page. This has been done on purpose as I hope I was able to control the slug of my archive page to be something like               http://www.test.me/page     http://www.test.me/page/archive.php       So page is the name of my personal page template, but also the cpt slug. Looking around for a solution I found somebody that was suggesting to add the with_front option. I didn't find that many bits so I am still confused on what it does.               'rewrite' => array( 'slug' => 'page', 'with_front' => true )      I then also find this answer here - http://wordpress.stackexchange.com/a/45152/26216 - with a couple of custom function which is even more confusing. Can somebody give me an hint? Thanks


title: Only show top level posts of specific category

text:
I've been trying to create a loop that will only show the top level posts no children/sub category posts. Basically what my categories look like are -- > -All > > --one   >  --- A   >  --- B > > -- two   >  --- A   >  --- B > > -- three   >  --- A --- B So I need one, two, and three to show on 'All' category page - but none of a & b. I've checked other questions on here, and search google but none of the methods seem to work. The only one I found to get close was this loop --               <?php      // Get the post ID             $id = get_the_ID();                                //get all the categories ( this function will return all categories for a post in an array)             $category= get_the_category( $id );                  if ($category->category_parent == 0) {                  //extract the first category from the array             $catID = $category[0]->cat_ID;                  //Assign the category ID into the query            $verticalNavigationSwitcher = "category__in=$catID&order=ASC&showposts=5";          }                                     $result = new WP_Query($verticalNavigationSwitcher);             ?>          <?php if ( $result->have_posts() ) : ?>                               <?php while ( $result->have_posts() ) : $result->the_post(); ?>          // some divs           <?php endwhile; ?>                               <?php wp_reset_postdata(); ?>          <?php else:  ?>
<?php _e( 'Sorry, no posts matched your criteria.' ); ?>
     <?php endif; ?>       The only problem with that is it's only showing one post instead of showing all the top level posts. So how can i fix this to show all the current category immediate/top level posts?


title: Disable Media Uploads to non Admin Users

text: I am working on a clients site, one of the features they want is for his **Editors** or **Authors** to only be able to select existing images to insert into Posts from the Media Library. So looking at the media manager/upload screen below, is it possible to make the `Upload Files` tab to only be visible to `Admin Users` and also to make the `Media Library` shown by Default when this Dialog is shown? ![enter image description here](http://i.stack.imgur.com/LksGz.png)


title: delete_option() and update_option() returning false

text: I know that when `delete_option()` or `update_option()` fail to perform their respective database interactions, they return false. Does anyone know why they wouldn't be able to perform these actions? It's only for specific options. Most options will work, however, a few options just seem to "die". They'll work fine for a while, then just stop working. Any ideas?


title: get the categories of current post (in loop) that are child of a specific category

text: I have a small issue Need to get the categories names of my current post within the loop. But i need only those that are child of a specific category that is not assigned to my post. I have tried using wp_list_categories() with 'child_of'. works fine but it lists all categories for all posts in each post. Basically i want to use categories instead of tags. Like a paralel tag system. I have set a parent category and its child categories are associated to different posts. Need to list these category names for each post within the loop.


title: Using WP just to edit pages of an existing site

text: I was asked to let the user to edit an existing site articles using Worpress. But because the site has a lot of php code (not used for the articles) that would take quite a lot to convert in WP plugins, and replicating the actual templates would take some time too, so I was thinking to keep the actual site, and use WP just as a powerful editor, and from within the pages just call some WP function to print the articles text. I would skip all the WP templating system, all I need is print the article text in the existing pages. The site tree is not going to change. Is this possible? Any hints on what to look for? Thanks.


title: Guidelines / restrictions about advertising /donate begging unside wordpress plugins or themes

text: I remember to have read about this, but I can't find it anymore. Basically we are not allowed to advertise without the users consent inside plugin, its a good rule I think. I just want to see the official text to quote it.


title: dbDelta only creates the last table

text: I'm using following install function with dbDelta as referring to the codex, articles on SO I watched out for the typical problems with e.g. one space instead of two spaced at the PRIMARY KEY ...               function myplugin_install(){         global $wpdb;         $table_name = $wpdb->prefix . "vehicles";                     $sql = "CREATE TABLE IF NOT EXISTS $table_name          (             id                  INT UNSIGNED NOT NULL AUTO_INCREMENT,             description         VARCHAR(25) NOT NULL,             PRIMARY KEY  (id)         );           ";              $sql .= "CREATE TABLE IF NOT EXISTS $table_name1          (             ...         )";              $sql .= "CREATE TABLE IF NOT EXISTS $table_nameX          (             id                  INT UNSIGNED NOT NULL AUTO_INCREMENT ,             art_alarmierung     VARCHAR(25) NOT NULL ,             PRIMARY KEY  (id)         );";          require_once(ABSPATH . 'wp-admin/includes/upgrade.php');     dbDelta($sql);     echo $wpdb->last_error;          }      dbDelata only stores the last `$sql` variable. And echo `$wpdb->last_error;` don't show any errors? Where is my failure? BR; mybecks


title: Admin (All posts) stop responding problem

text: I have situation like this: I have site with 500+ posts, 10+ custom taxonomies, one of taxonomy have 20000+ terms. When in admin panel I go to Posts-> All posts wordpress opens the page but stops responding (on Chrome “Version 27.0.1453.94 m” and on IE9) and slows down on Firefox 21.0. I have tried disabling all plugins but it didn’t help. So I tried to delete part of code from functions.php in my theme where I create hierarchical custom taxonomy (20000+ terms) and it worked like charm. peace of functions.php where I create custom taxonomy:                           $labels = array(                     'name'                       => _x( 'Apskritys', 'Taxonomy General Name', 'text_domain' ),                     'singular_name'              => _x( 'Apskritis', 'Taxonomy Singular Name', 'text_domain' ),                 );                      $args = array(                     'labels'                     => $labels,                     'hierarchical'               => true,                     'public'                     => true,                     'show_ui'                    => true,                     'show_admin_column'          => false,                     'show_in_nav_menus'          => true,                     'show_tagcloud'              => true,                 );                      register_taxonomy( 'county', 'post', $args );      I would be very grateful for your advice in this situation!


title: Knowledgebase / Docs: Custom Post Type, Pages or as a Post Category?

text: I'm trying to decide on how to organize a new site/theme. It has the standard sections: Home, About, Contact, Blog but also an (admin- only editable) Knowledgebase/Documentation area. My first thought was to create a custom post type to separate out the documentation area but it could more easily be done as parent/child pages or even separated out by tag/category in the blog. Just wondering if anyone has built something like this in the past. Thanks!


title: Exclude member-only content on HTML Sitemap

text:
I've used the basic HTML sitemap code from Yoast. Wondering if it's possible to exclude member-only pages and posts.
Pages

     <?php     // Add pages you'd like to exclude in the exclude here     wp_list_pages( array( 'exclude' => '', 'title_li' => '') );     ?>

Blog Posts

     <?php     // Add categories you'd like to exclude in the exclude here     $cats = get_categories('exclude=');     foreach ($cats as $cat) {       echo "

".$cat->cat_name."
";       echo "
";       query_posts('posts_per_page=-1&cat='.$cat->cat_ID);       while(have_posts()) {         the_post();         $category = get_the_category();         // Only display a post link once, even if it's in multiple categories         if ($category[0]->cat_ID == $cat->cat_ID) {           echo '
'.get_the_title().'
';         }       }       echo "
";       echo "
";     } ?>


title: Display results from two Custom Post Types in page template

text: What I have is   1. Created a new page with slug `monuments`   2. Created a template file at my theme's folder that will show all records with post_type `monument`. [UPDATE] 3.I forgot to mention that each custom post type "monument" has a "city" parent [/UPDATE] What I want to do is, in that same file, to add a list of cities links, and when clicking on any of the cities, it will display only the monuments of that city. I already have a custom post type `city`. The URL I want it to display, when clicking on a city's link, is               http://example.com/monuments/city-slug      Is that possible with `add_rewrite_rule`?


title: Change the order of sidebars in admin

text: Say I use a child theme and my parent theme already registered four dynamic sidebars. Now I am registering a fifth dynamic sidebar in the functions.php of my child theme. In the backend that last sidebar will be the first sidebar that is displayed in Design > Widgets. Is there any way to make it the last?


title: Track usernames with piwik

text: I'm wondering if there is a way to send current logged username to Piwik and display it beside the ip address in the stats. I need to see which users viewed a specific page and which users downloaded a specific file. Is it possible to accomplish with custom variables?


title: Why do filters/actions require an argument count?

text: I was just looking at plugin.php trying to answer the above question and I couldn't work it out. The actual code that calls filters is this:               do {         foreach( (array) current($wp_filter[$tag]) as $the_ )             if ( !is_null($the_['function']) ){                 $args[1] = $value;                 $value = call_user_func_array($the_['function'], array_slice($args, 1, (int) $the_['accepted_args']));             }          } while ( next($wp_filter[$tag]) !== false );      If `(int) $the_['accepted_args']` wasn't there then it would simply pass everything available to the target function without any adverse affects for functions with less formal params.


title: preventing the duplicate wp_insert_post

text: Right of the bat, let me say that this is not the same question as I posted the other day ( that is duplicate posts when trying to update a post using the wp_insert_post. ) Cause, in that question, the duplicate post I was referring to was being created as a revision. And turning the revision setting appropriately in the wp_config.php took care of it. With this question however, two ( sometimes three or four ) identical posts ( where one is not the revision of the other ) are created. And no matter what I have done to avoid this, it just fails. Sometimes, I get 100 dups, sometimes 500.. This is all part of a migration routine I wrote where a while loop goes thru 15,000 records from an ms-sql table and converts each record into a post_data array to be fed into the wp_insert_post API. Technically, since I'm dealing with 15000 recs in ms-sql, I should end up with 15000 posts in a fresh installed wp_posts table. Right? In my case, I sometimes get 16000, sometimes 290000. It's never the same. Everytime is different. I'm almost to the point to re-write the code. But if the culprit itself the wp_insert_post and some internal wp process or wordpress cache that I do not know of or mysql server config and or and or and or... , even the new approach won't work. After some research, I've come to learm I'm not alone on this. But from what I read, I could not get a wrapper around it. As I said above, I create the posts going thru a while loop. Since the process takes a long time, I had to build a custom time-out module. As the code goes thru the iterations of the while loop, it marks its process into a time_out table, and siince I got a watch dog page that's running in an iframe to keep an eye on the time_out table's progress, even if the bottom frame ( the one that handles the ms-sql to wp_posts process ) times out, I know from what record to kick start the process. This way I do not have to sit in front of the computer to keep clicking on 'continue'. link. Well, this trick works on all of my implementations that are severed by timeouts . I eventually end up getting the whole table is processed and the watch dog iframe stops refreshing when the number of records to be processed is equal to the number of records that have been processed in the last instance. So the time-out module works perfectly except.... Only and only when the destination table is wp_posts and when the the wp_insert_post API is involved, I get a problem. After the first time-out, things start getting hay-wired. From time to time, wp_insert_post ends up firing twice/thrice causing the same record to be inserted multiple times. To remedy the situation, I've tried 3 different techniques including the use of custom fields, but no luck. I also tried inserting a unique key into the post itself to minimize the database activity. I found this is better cause it avoids the involvement of custom fields, and yet achieves the same goal. I put the source_key ( which is something like --{$db_name}.{$table_name}.{$recid_value}-- ) in the post and at_insert_time , I just check the existence of that key ( using `like` operator ) to see if that post was added previously. but even that fails... Wp_insert_post surprisingly creates double records. and up until now, I simply cannot pin- down the occurrence of the problem. I read this, Prevent duplicate posts in wp_insert_post using custom fields But my techniques were simply alternatives to it. Here is a cut-down code of how I do it...               while ($row = mysql_fetch_assoc($RS)) :                  $source_recid = $row['source_recid'];             //source_recid is something like db.table.tablerecid                 //example services.media.1223                  $post_data['post_content'] = $row['some_field_thats_got_page_content'];                  //append the source_recid to the post data in forms of an html comment for uniqueness purposes                   $post_data['post_content'] = $post_data['post_content'] . "<!--{$source_recid}-->";                  //do the other stuff... ( shortened here for the clarify purposes... )                  ....                  $post_data['post_status'] = 'publish';                  Insert_or_UpdatePost($dbh,$post_data,$source_recid,$post_id);                       if ($post_id==0):                      //log the error and move on                       continue;                  endif;               endwhile;          function Insert_or_UpdatePost($dbh,$post_data,$source_recid,&$post_id){                  // this function first looks up the --db.table.tablerecid-- sequence              // across all wp_posts post_content field              // in determining if this record has been already INSERTed!                   // and depending on the outcome, it does an insert or update              // and return the $post_id accordingly                  // if the function determines there are no such records,              // then and only then, it runs the wp_insert_post!                   // if the function determines that there is a post like that,              // it retrieves the post_id              // and then switches to operation              // to use the wp_update_post instead!                   // with this approach, technically speaking,              // it should impossible to run wp_insert_post on an existing post!                   // and yet, I still get duplicate posts...                  // here we go;                  $post_id_probed = blp_sql_getdbvals($dbh,"select id from wp_posts where post_content LIKE '%--{$source_recid}--%'");                  if (blp_isnumber($post_id_probed)):                 $post_id = $post_id_probed;                      $post_data['ID'] = $post_id;                 $post_id = wp_update_post( $post_data );                      if ($post_id == 0):                           //add error                               return FALSE;                           else:                          update_post_meta($post_id, "wpcf-blp-migration-date", blp_now('mysql'));                           return TRUE;                      endif;                        endif;                   // if we make it this part, it means only one thing!              // there is no post for the db.table.tablerecid yet,               // so do the insert!                  $post_id = wp_insert_post( $post_data );                            if ($post_id == 0):                       //add error                       return FALSE;                       else:                      //add_post_meta($post_id, "wpcf-blp-migration-source", $source_recid,TRUE);                 //no need for that anymore                      return TRUE;                       endif;                         }      say


title: Filter link to existing content suggestion

text: How can i filter the link given in "link to existing content". Eg:![enter image description here](http://i.stack.imgur.com/BwLoF.jpg) As in the above image. I just want WSP BANNER TO BE SHOWN. where WSP BANNER & CALENDAR are custom POST types Any help will be appreciable.


title: add_menu_page() with different name for first submenu item

text: The `add_menu_page` documentation says to pass the menu title as the second parameter:               add_menu_page('Page Title', 'Menu Title', ...);      When adding more pages later via `add_submenu_page`, the main page becomes the first entry in the submenu: ![enter image description here](http://i.stack.imgur.com/RgF7R.png) * * * However, I want the first item in the list to have a different name (but still point to the same page), the way Wordpress itself does it: ![enter image description here](http://i.stack.imgur.com/8nLAz.png) * * * How could I accomplish that in my plugin?


title: XML Sitemap Generator and 404 problem

text: I am using yahoo hosting, wordpress 3.0.1 and Google XML Sitemaps (Wordpress Plugin) 3.2.4. This plugin generates sitemap.xml and notify all webmasters successfully. I am able to see sitemap.xml through FTP but the problem is whenever i open the link http://blog.example.com/sitemap.xml, it's showing 404 error.


title: Custom attachments uploader code. Almost there!

text: The code below resides in my theme's functions.php and creates a custom upload icon on top of the WordPress content editor, alongside the default upload icon. Images uploaded via this icon get a special flag in wp_postmeta called _imageTop to differentiate them from standard attached images (to allow me to do special things to them as a separate collection of "attached" images). I've got 3 problems occuring that I'm sure are simple fixes. 1) The attachment_fields_to_save filter does not get applied, even though I can see the echo'd text inside the media-upload.php window. I know this because the _imageTop meta only gets written to the database when I comment out the if(isset) check 2) After the images have been uploaded, I have to click on "Save all changes" to get the _imageTop meta to save to the database. Ideally, I'd like the data saved immediately after the upload, without having to click "Save all changes". This is probably due to the fact that the attachment_fields_to_save handler only fires on the "Save all changes" hook. Nevertheless, I'd like to figure out how to get it to fire when the images have been uploaded. 3) I want to remove the "insert into post" link from the screen.               //Upload custom images     function my_customImages($initcontext)     {         global $post;         ?>              <?php         return $initcontext. '<input type="hidden" id="post_ID" value="'. $post->ID .'" />   Product Images:';     }     add_filter('media_buttons_context', 'my_customImages');          function my_image_attachment_fields_to_save($post, $attachment) {         update_post_meta($post['ID'], '_imageTop', true);         return $post;     }          if(isset($_GET['my_idCustomAttachment'])){         echo "This is true";         add_filter("attachment_fields_to_save", "my_image_attachment_fields_to_save", null , 2);     }


title: How to checkout the wordpress.org plugin repository?

text: I have problems to checkout the wordpress.org plugin repository via SVN on `https://plugins.svn.wordpress.org/`. First it starts all looking well:               >svn --force checkout https://plugins.svn.wordpress.org/     A    plugins.svn.wordpress.org\lumberjack     ...      But while it progresses, it gets stuck:               ...     A    plugins.svn.wordpress.org\gbs-ad-shopping\readme.txt     A    plugins.svn.wordpress.org\gbs-ad-shopping\SaveButton.png     svn: In directory 'plugins.svn.wordpress.org\gbs-ad-shopping'     svn: Can't open file 'plugins.svn.wordpress.org\gbs-ad-shopping\.svn\tmp\text-base\readme.txt.svn-base': Das System kann die angegebene Datei nicht finden.      ( _Das System kann die angegebene Datei nicht finden._ is German for a file not found error) So now the working copy is broken. First thing to do I thought is to run a cleanup, but see what happens:               >svn cleanup plugins.svn.wordpress.org     svn: In directory 'plugins.svn.wordpress.org\gbs-ad-shopping'     svn: Error processing command 'modify-wcprop' in 'plugins.svn.wordpress.org\gbs-ad-    shopping'     svn: 'plugins.svn.wordpress.org\gbs-ad-shopping\format' is not under version control      It looks a bit to me that this plugin is has some weird settings that prevent to checkout it. So any hints on this? Better ask that question over at SE?


title: Searching for one letter returns extra empty post

text: On my blog WordPress returns an empty post with today's date if I do a search for one letter, e.g. ?s=a or ?s=q Is this a known bug, and how do I fix it?


title: How much server power does Worldpress take?

text: I have multiple Wordpress websites on my server(And a game server and Tomcat) and I'm a little paranoid about my servers health. How much does a newly installed Wordpress take typically?


title: How to Use the Function is_user_logged_in To Display Different Menus?

text: So, I want to create different menus for people who are logged in or not. I got a reply that i should use a function               if (is_user_logged_in()) {           wp_name_menu(array('theme_location' => 'logged_user' ));     } else {           wp_nav_menu(array('theme_location' => 'new_user' ));     }      So, if I get this right, I put this into `functions.php` which is located in my child theme (anywhere inside the file?), then I create another menu and where it is "logged_user" and "new_user" I enter the names of the menus?


title: How can I hide the TOP Navigation menu if users are not logged in

text: > **Possible Duplicate:**   >  different menus with is_user_logged_in in more detail how can i hide my top navigation menu to users who are not logged in? here is the url to the site, its on a password protected dev server so you can use the user & pass below to access the site. http://chicagodietetic.demotheweb.com username: chicagodietetic password: demo Thanks Aron


title: Why in this WordPress theme I can't see the Main Menu?

text: I am pretty new in WP (I came from Joomla) and I have the following problem. I have installed WordPress on my server and if I use one of the included theme (such as the **Twenty Thirteen** theme) when I open the website I see it and under the header I can see the classic horizontal **Main Menu** containing the voice **Sample Page** , ok...this is the right behavior. Then I have installed the following theme **http://bootstrapwp.rachelbaker.me/** that is a WP theme that use BootStrap (I think that it could be a good start point to develop a personal theme using BootStrap CSS framework). I install it but when I activate the theme I obtain this result: http://onofri.org/WP_BootStrap/ As you can see the website is shown but seems that **there is not the Main Menu** as in the others preinstalled theme. Why? What could be the problem? I opened the **header.php** file of this theme and here I find the following lines of code:                               <?php bloginfo('name'); ?></a>                 <?php wp_nav_menu(                         array(                             'menu' => 'main-menu',                             'container_class' => 'nav-collapse collapse',                             'menu_class' => 'nav',                             'fallback_cb' => '',                             'menu_id' => 'main-menu',                             'walker' => new Bootstrapwp_Walker_Nav_Menu()                         )                     ); ?>      So it seems to me that the main menu navigation bar is present in this theme. Do you have some ideas to solve my problem? Tnx Andrea


title: WordPress /page/2 not working

text:
When clicking the next_posts_link it just shows the same posts as on page 1. It appears to work fine on the category pages and it is only affecting the homepage (home.php) Thanks!                   <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>     <?php query_posts('cat=-683,-3598' . $paged); ?>      * * * FULL CODE                   <?php get_header(); ?>

                     <?php query_posts('cat=3598&showposts=1'); ?>     <?php while(have_posts()) : the_post(); ?>          <?php the_post_thumbnail('fbox12'); ?>          <?php endwhile; ?>

                     <?php query_posts('cat=3598&showposts=1&offset=1'); ?>     <?php while(have_posts()) : the_post(); ?>          <?php the_post_thumbnail('fbox12'); ?>          <?php endwhile; ?>

                     <?php query_posts('cat=3598&showposts=1&offset=2'); ?>     <?php while(have_posts()) : the_post(); ?>          <?php the_post_thumbnail('fbox3'); ?>          <?php endwhile; ?>

                     <?php query_posts('cat=3598&showposts=1&offset=3'); ?>     <?php while(have_posts()) : the_post(); ?>          <?php the_post_thumbnail('fbox67'); ?>          <?php endwhile; ?>

                     <?php query_posts('cat=3598&showposts=1&offset=4'); ?>     <?php while(have_posts()) : the_post(); ?>          <?php the_post_thumbnail('fbox67'); ?>          <?php endwhile; ?>

                     <?php query_posts('cat=3598&showposts=1&offset=5'); ?>     <?php while(have_posts()) : the_post(); ?>          <?php the_post_thumbnail('fbox45'); ?>          <?php endwhile; ?>

             <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>        <?php query_posts('cat=-683,-3598&paged=' . $paged); ?>          <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
             <?php     if ( has_post_thumbnail() ) {     ?>     <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_post_thumbnail('homepage-thumb'); ?>     <?php }     else { ?>     <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/no_thumb.png"/>     <?php }     ?>
<?php the_category(', '); ?> | <?php the_time('F j, Y'); ?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
             <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_excerpt(); ?>
                     <?php endwhile; ?>                         <?php endif; ?>

<?php next_posts_link('Next Entries','') ?>

              <?php get_sidebar(); ?>
          <?php get_footer(); ?>


title: Don't display html if function returns nothing

text:
This question is very similar to the one below however it requires a different solution. Don't display html if custom field is empty I'm using the plugin Related Posts Thumbnails but i'm using the template tag in my template file to display related products.               <?php get_related_posts_thumbnails(); ?>      Plugin Source I've got this contained inside of a div with a title so the output looks a bit better. However if there isn't any related products i need it to hide the div otherwise it just displays an empty area. This is the code i'm using.

Related Products
         <?php get_related_posts_thumbnails(); ?>
      Is it possible to not show this div if the function returns no related products? Thanks


title: How to add a filter to the get_body_class function?

text: I see it is possible to use add_filter with the `body_class` function, but I'm needing to add one to the `get_body_class` function. How can I add a filter to a function that is not included in the list of already available filter hooks? Thanks.


title: Prevent Selected Terms Rising to the Top

text: When you're editing a post and select a child category or term, and update, the selected terms appear at the top ( leading to potentially confusing situations where 'foo' 'foo' and 'foo' are selected each with different parents and no way to tell them apart ). How do I prevent this behaviour? Either by showing the parent terms to give context, or stopping them being moved to the top


title: ACF plugin -have_rows the_row get only DISTINCT values

text: I have a question related to taxonomy terms and acf repeatable post object. I have a terms from multiple taxonomies who has linked repetable field with post objects. There can be situations, when user can link similar post objects to different terms and that's normal. If you imagine the situations, when user links wine to all Italian foods from taxonomy foodtype and also links wine to ingredients term pasta. The problem is, I need to show on the single post (reciepe) only distinct values. Avoid the situation, when one reciepe gets similar related products from different taxonomies. This is the code to show the related products on a single.php . I can not figure out of how to manipulate the have_row() or the_row() to show only distinct values. Do you have any clue?               global $post;     $taxes = array('ingredients','foodtype', 'eventtype');     $terms = get_the_terms($post->ID, $taxes);          if( !empty($terms) ){          foreach($terms as $term) {              if(get_field('relatedproducts', $term->taxonomy.'_'.$term->term_id )){                while( have_rows('relatedproducts',$term->taxonomy.'_'.$term->term_id) ) : the_row();                    $post_object = get_sub_field('product');                      if( $post_object ){                  // override $post                 $post = $post_object;                 setup_postdata( $post );              if ( has_post_thumbnail() ) {      the_post_thumbnail('thumbnail',array('class'=>"img-responsive center-block"));             }               the_title('<h4>','</h4>');              the_content();                                            }                    }             wp_reset_postdata();              endwhile;               }     }