Woocommerce pagination problem

I'm working on project that needs to have WooCommerce implemented, and there is a list of products on main page, using a original theme loop. I managed to display all posts and it's data, and now I'm encountering problems with themes pagination. It's working kinda fine - it recognises the number of items (products), calculates number of pages, and works fine for first 3 pages. Then I found out that I have enough posts (normal blog posts, not Woo products) so the pagination is working fine for first 3 pages - which is number where normal blog post pagination would stop. How can I fix this, so pagination goes for example to page 5, and not show me 404 error page? Here's the loop:               <?php                      $args = array(                         'posts_per_page' => '4',                         'post_type' => 'product',                         'paged' => get_query_var('paged')                     );                     $homepage_query = new WP_Query($args);                 ?>                 <?php //query_posts('posts_per_page=4&paged='.get_query_var('paged')); ?>                 <?php if ( have_posts() ) : ?>                       <?php while ( $homepage_query->have_posts() ) : $homepage_query->the_post(); ?>                         <?php if($style == 'blog_style') { ?>
                                  <?php get_template_part('content', 'blog'); ?>
                         <?php } else { ?>                         <div class="post-box proizvod-box grid_4 <?php aero_post_box_class(); ?>">                                  <?php woocommerce_get_template_part( 'content', 'product' ); ?>                                  <?php //get_template_part('content', ''); ?>
                         <?php } ?>                     <?php endwhile; wp_reset_query(); ?>      And here's the pagenavi function file: http://jsbin.com/umumeq/1/edit


Create front end link to save post (or unpublish post) as draft

I have created a front-end posting and dashboard system for my users to add and edit their own posts. In the dashboard area, I have a list of their posts and the following options for each post: View | Edit | Publish/Un-Publish | Delete I have all of these links working except for the "un-publish" part. I can get a post to publish if it's currently in draft, but once it publishes I can't figure out how to "unpublish" it from the front end, which is a function I'd like my users to have. For reference, I am using code from this thread to do the Publish part: Front- End Post Submission I've tried adapting it, but have not succeeded. I also need similar functionality on the New Post form where I'd like to display a "Save Post" button along side the "Publish" button so a user can save the post a draft so as to not risk losing their work while creating the post. Thanks for reading, and hopefully someone can help!


Page source contains an http item that makes page insecure; but in php files it's written as https!

I can't seem to figure this out! I set up my site (https://goinspire.com/secure-payment/) to be https, but instead of the lock symbol I see a warning symbol. According to http://www.whynopadlock.com/ the issue is a certain url in the header ( http://malsup.github.io/jquery.cycle2.js). I changed header.php to have that url as https ( https://malsup.github.io/jquery.cycle2.js), but for some reason it's not updating the page source. here's the applicable line of header.php:                   <script src="https://malsup.github.com/jquery.cycle2.js"></script>      Thanks in advance! UPDATE: This seems to be an issue in Firefox - in Chrome the lock symbol shows, but in Firefox there is a warning symbol instead. UPDATE 2: I commented out the above php line, and the issue is gone. Now I just have to hope that it wasn't important (I think it wasn't) Thanks for the help!


How to mix subdomains and subdirectories in the same WordPress MultiSite network?

I have a huge WordPress MultiSite network with dozens of different sites on many domains and subdomains, as shown in the example below: site1.com   * subsite1.site1.com   * subsite2.site1.com   * subsite3.site1.com site2.com   * subsite1.site2.com   * subsite2.site2.com   * subsite3.site2.com ...and so forth... I'm using the plugin Networks for WordPress to make this work. **Now what to do if "subsite3.site2.com" requires its own subdirectory subsites?** For example: subsite3.site2.com   * subsite3.site2.com/subsubsite1   * subsite3.site2.com/subsubsite2   * subsite3.site2.com/subsubsite2 As far as I can tell, Networks for WordPress only works with subdomains, and not subdirectories. **Any ideas on how to mix subdomains and subdirectories in the same WordPress MultiSite network?**


Function to change a label (Username) in a core WordPress File (wp-includes/general-template.php)

Would like to change 'label_username' => __( 'Username' ) on line 258 of wp-includes/general- template.php to 'label_username' => __( 'Username or Email' ) Changing core files is a not recommended --- never never So any help to code a function to achieve this would really be appreciated.


Is 'preload="none"' a valid parameter in the [audio] shortcode in WordPress 3.6?

I know that MediaElement.js is part of the WordPress core in WordPress 3.6. I currently use the MediaElement.js plugin on my WordPress 3.5.1 sites. On some pages, we have several players on one page, and we need to specify _preload="none"_ as a parameter in the MediaElement.js shortcode, because if we don't, some browsers (mainly iOS devices) will try to download all the MP3 files at once. Here is the shortcode that we currently use: [audio mp3=" _filename.mp3_ " preload="none"] In WordPress 3.6, with MediaElement.js built-in, will the _preload="none"_ parameter have any effect in the [audio] shortcode?


Copy a file from a plugin into my theme directory

I coded a wordpress plugin using php's 'copy()' to copy a file from my plugin directory to my theme directory, but it's not working:               <?     function file_replace() {              $plugin_dir = plugin_dir_path( __FILE__ ) . '/library/front-page.php';         $theme_dir = get_stylesheet_directory() . 'front-page.php';         copy($plugin_dir, $theme_dir);              if (!copy($plugin_dir, $theme_dir)) {         echo "failed to copy $plugin_dir to $theme_dir...\n";         }     }          add_action( 'wp_head', 'file_replace' );      I thought maybe I should use `! $wp_filesystem->put_contents()` but I'm not exactly sure how to do that or if that would even be the right way to go. Any ideas on the best way to copy a file from a plugin to a theme directory? Thanks


Slideshow missing when page loads?

I have a simple example to illustrate my problem here. http://www.ttmt.org.uk/forum/wordpress-forum/ It's just one page, home.php. The home page has a list of images that are made into a slideshow. From Settings > Reading > Front page display, I have selected the home page as the Front page. The home page loads but without the slideshow. If I click 'Home' to reload the home page the slideshow appears. Why does the slideshow not appear when the page opens.


Taxonomy archive link from term id

I'm using advanced custom fields taxonomy field to select a particular term of a custom taxonomy. I can generate the term ID based on the field but I can't display the link or the name of the term. Below is the code that I have that is generating a blank page                <?php         $term_id = get_sub_field('expertise_category');        $term_link = get_term_link( $term_id , 'expertise' );        echo $term_link      ?>


How can I insert a disclaimer in a Wordpress site?

I am trying to look for a way to enable me to insert a disclaimer into the footer of my website. I am using wordpress to power my website. Is there anyway I can make a page link at the bottom?               Disclaimer


Create a post from every image in my media gallery

I'm looking for a good way to create posts from every image in my media image gallery. I've uploaded about 200 pictures and want to create a post for each picture, where I set the picture as a thumbnail. I'm using the Photogram Theme and just want to show some pictures (title and other stuff not required). Thanks a lot!!


How-to Change Content with location change?

I have to develop a site using wordpress having thousands of pages. Pages will have the same content but there will be change in the location of the content. For example location will be Sydney, Melbourne etc. Is there any way that I can manage the virtual pages? The pages has to be indexed in the search engine as well. Can anyone suggest me to do it in effective way? Thanks in advance


custom post type parsed as attachment

I have few custom post type, on the single post of which i am getting 404 error page. I think i've tried almost every solutions posted on web but still it is not working for me and i've started to have a feeling that i have made some other mistake.As i try to debug i have found that each of my custom post have been parsed as 'attachments'. Please figure it out for me what mistake have i done.               function jnj_register_board_members_posttype ()     {              $labels = array (              'name' => _x ( 'Board Members' , 'jnj' ) ,              'singular_name' => _x ( 'Board Member' , 'jnj' ) ,              'add_new' => _x ( 'New Member' , 'jnj' ) ,              'add_new_item' => __ ( 'New Board Member' , 'jnj' ) ,              'edit_item' => __ ( 'Edit' , 'jnj' ) ,              'new_item' => __ ( 'New Board Member ' ) ,              'all_items' => __ ( 'All Board Members' ) ,              'view_item' => __ ( 'View Board Member' ) ,              'search_items' => __ ( 'Search Board Members' ) ,              'not_found' => __ ( 'No Board Members found' ) ,              'not_found_in_trash' => __ ( 'Board Member not found in Trash' ) ,              'parent_item_colon' => '' ,              'menu_name' => 'Board Member' )              ;         $args = array (              'labels' => $labels ,              'public' => true ,              'publicly_queryable' => true ,              'show_ui' => true ,              'show_in_menu' => true ,              'query_var' => true ,              'rewrite' => array( 'slug' => 'board-members', 'with_front' => false),             'capability_type' => 'post' ,              'hierarchical' => false ,              'menu_position' => 5 ,              'menu_icon' => get_stylesheet_directory_uri ( ) . '/images/board-members.png' ,               'register_meta_box_cb'=>'register_board_members_metabox',             'taxonomies' => array ( 'jnj_title' ) ,              'supports' => array ( 'title' , 'editor' , 'thumbnail' , 'custom-fields' , 'excerpt' ) )         ;              register_post_type ( 'board_members' , $args );          }     add_action('init', 'jnj_register_board_members_posttype');


Videos in posts are not rendered

I have a wordpress website, but the blog/post side of things wont display videos even when using the insert media/video link. It just shows the code up. What page/file do I need to edit and where to get this to work?


Display default WordPress login/registration form into a modal window

hope someone can help me with this. I need to display the default WordPress login/registration into a modal window. I followed this tutorial in order to create the modal box and it is just exactly what I need, but I do not know how to display the default WordPress login/registration form in this modal window. Please, can anybody give me an advice? Thank you very much!


What is the best way to store custom variables

I need to store the id and secret key of my FB application. I don't want to write them directly in my template. What do you recommend ?


Corrupted .GIF thumbnails from featured image

I have been very perplexed with WordPress and why it doesn’t create .gif thumbnails from featured images.      **The Problem**   When setting a jpg or png image as featured, everything is fine and WordPress creates the thumbnail dimensions instructed by the theme functions.   The problems start if I set a gif as featured image. WordPress creates corrupted gif thumbnails.   I don't mean that the thumbnails lose their animation, but they don't open at all. So when the theme needs to use gif thumbnails, because they are corrupted, it uses the whole gif image making the site very slow.      **What I tried**   I have tried both premium and free themes (like Codium Grid, Hiero, Expound), so the problem is not the themes.   Also, I have tried both front end and back end posting with featured image and the result is the same. All gif thumbnails are broken except the 292xYYY (for every image is different ex. AA-292x199.gif, AB-292x240.gif). The only working gif thumbnail is in the actual post (ex. tofa.ga/good-dog). The home page thumbnails are all broken and use the original image.   I have tried in other WordPress sites with the same results.      **Some more info**   This is the site http://tofa.ga/ and here is the folder with the thumbnails http://tofa.ga/wp-content/uploads/2014/04/ Also I am using a share hosting and the memory limit is 256M ( in root). The site has only Gravity Forms plugin (I tried without it).


Thumbnail is corrupt but image is good

I am using wordpress 3.5 to manage my website with a template (not sure which). Lately, each picture I add to a gallery creates a corrupted thumbnail, but the picture itself shows up ok. I tried uploading pictures that used to create a proper thumbnail and now their new thumbnail is broken. The broken thumbnail link - though it opens up correctly... ![broken thumbnail](http://i.stack.imgur.com/wYnPK.png) How can set to fix this?


How can I paginate a list of related posts?

My client's home page displays a paginated list of posts with thumbnails. Each list item, when clicked, navigates to a single post or page, and then uses a separate query to generate the same list of posts at the page footer. Pagination works just fine on the home page, however, he wants the list underneath single posts to be paginated the same as the home page. That is, we would be at `website.com/post-12345` and it would show a list of posts 1-12 underneath. There would be "newer posts" and "older posts" buttons which should swap the list of posts 1-12 for a list of posts 13-24, for example, while displaying the same post, ie remaining at `website.com/post-12345`. I thought of simply calling all the posts via `get_posts()` and switching between them using JavaScript, but there will eventually be hundreds of posts and thumbnails and the page would take forever to load. Is there a way to achieve this type of pagination that isn't so clumsy? I'm open to solutions in PHP, JavaScript, even Ajax.


Creating /blog subsite on WP multisite network

I've had a site for a few years that till yesterday consisted of two WP 3.2.1 installations- one for the main site and one for the blog, which had a different theme and was located at _[site.com]/blog_. We need a few more blogs now, and I wanted to unify the user database, so I decided to convert the main site into a network and then migrate the blog over as a new site within the network. Initial issues were:   1. **WP doesn't allow existing sites to use the subfolder system when converting to a multisite network (only subdomain)**     * Got around this by first going with subdomain, then switching to subfolder with appropriate changes in wp-config.php and .htaccess, as documented here   2. **WP doesn't allow you to create a network site called "blog"**     * I got around this by creating a site with some really random name, then just searching through the DB and replacing that name with "blog", resulting in a site called "blog" (WP only enforces the "blog" name ban upon site creation)   3. **The main site gets a hardcoded "blog" slug for all permalinks**     * I used this workaround to remove the slug (basically go to network admin panel, edit settings for main site, manually remove "blog" from the permalink, then go to main site dashboard, open permalink settings (but don't edit or save)) So now I have a site (in the network admin settings) called "blog," the posts on the main site are now back to the old permalinks (e.g. _[site.com]/2012/01/20/hello-world_ ), and even categories and such are working fine on the main site. Problem is I'm unable to actually access the new "blog" subsite. Going to _[site.com]/blog/wp-admin_ shows me the main site's dashboard, instead of the new "blog" subsite's. More strangely, going to _[site.com]/blog_ redirects to _[site.com]/2011/05/04/blog/_ and gives a 404 (no idea where that date, etc. are coming from). Main reason I need the subsite to be _[site.com]/blog_ is I want to avoid breaking all the links we have out on FB/Twitter/etc. Any ideas?


Can WordPress store comment cookies on two different computers?

It's usual that WordPress stores comment author name and email in the user's browser cookies, so next time the visitor has to comment, they have their name and email already filled in automatically. My question is: **Is it possible for WordPress to store a visitor's comment cookies on two computers at different locations, but probably using the same ISP?** I'm asking this because I've seen someone else's name and email address stored in the comment form of a WordPress powered blog I was reading. My computer is password protected and nobody used it except me. And this happened not once, not twice but many times (every time a random unknown name and email). Even I've seen a "Your comment is waiting moderation" message. And since I believed every browser maintains it's cookies for its own, this behavior is strange to me. __ EDIT:               Property    Value     Name        comment_author_b4f88879dbf70af24980db38c9197684     Value       Emma     Host        example.tld     Path        /     Expires     Fri, 20 Dec 2013 12:56:16 GMT     Secure      No     HttpOnly    No          Name        comment_author_email_b4f88879dbf70af24980db38c9197684     Value       email%40server.co.uk     Host        example.tld     Path        /     Expires     Fri, 20 Dec 2013 12:56:16 GMT     Secure      No     HttpOnly    No


Direct some posts to only appear on a specific page

I have a blog at JonCrowell.org. When I add a new post, it appears on the home page. I have created a new page called "Technical Notes". I would like to be able to choose whether a new post that I create appears on my home page (which it does right now by default), or appears under the _Technical Notes_ page. Basically, some of my blog posts are general interest stuff that I want on my home page, and some are technical and esoteric and I don't want to clutter my main page with these posts. You could think of it as running a secondary blog, with all the posts appearing on a particular page. Is this possible? Thanks.


Custom permalink structure only for default posts

Does anybody know how to modify the url struct only for the single post page? When I go to a post page, the url should look like: example.com/xxx/my-post. All other urls (with the exception of the single post pages) should not contain "xxx" in the url. Customizing the permalink settings would add xxx in front of taxonomies and categories as well, so that wouldn't work for what I need. Essentially, I want that all "post" and "events" urls co contain an extra "xxx" segment in the structure.


Dictionary-style definition list plugin

I've discovered the types plugin, and I'm loving how simple it makes it to add custom post types and their associated field sets. One need that I've come across that it doesn't fill, however, is creating fields that are supposed to contain a list of items, such as the definitions in a dictionary entry. Is there another plugin that will allow these kinds of fields to be created, or is it better to just use a multi-line text box and then edit the single- type.php file for the corresponding type to parse a delimited list stored in that box?


Taxonomy order exception for specific term

I want to make an exception for my custom taxonomy order. Sometimes you need to put "Other" option as last option but when calling taxonomies with "orderby=name", sadly "Other" term is not listing as last option. Is there any proper way for this exception?


Is there a way to see how a theme will look before buying it?

I am shopping around for themes and would like to see how my website would look and work with its content before commiting to buy it. Is it possible to view a sample of my pages on another theme?


Read more content not displayed loops back to blog page

When I post a blog it automatically splits with read more. I want to know how to show the rest of the content. I am using nexus template .


Javascript alert appears before <!DOCTYPE> tag

I have wordpress 3.5.1 on Debian Squeeze. Every time before the page loads javascript alert appears with message `2819371938193817109948281937271937` and have to click OK to see the page. I get this with every refresh or clicking on some post. I did nothing since the last time when website was working fine. Screenshot: ![alert](http://i.stack.imgur.com/yaqIN.jpg) The source code:               <script>alert("2819371938193817109948281937271937");</script>     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">      The header.php doesn't have this script and nothing is loading before header.php. What is happening? How can I trace where is the script? EDIT: I found the script in `wordpress/index.php`, but don't know what put it there. I suspect XML Sitemap plugin.


Wordpress Login Box horizontal at the top.

Okay so I learned how to add the wordpress login box to the site. I don't want the box style in sidebar but more of horizontal box in the top of the page under the menu in horizontal way. Are there any pointers for going with this route?


Animated Gif image not uploading correctly

Started today, I tried many times to upload a gif image and inserted it. Wordpress gives this![enter image description here](http://i.stack.imgur.com/AOXSj.jpg) But when I checked media library, I found it there attached with a post. These are error logs:               [Mon Sep 16 01:47:19 2013] [error] Script timed out before returning headers: php53.cgi     [Mon Sep 16 01:55:28 2013] [error] ModSecurity: Error reading request body: End of file found [hostname "xxxxx.com"] [uri "/wp-admin/admin-ajax.php"] [unique_id "UjbHgNBhnx0AACVfm-sAAAAH"]     [Mon Sep 16 01:55:28 2013] [error] (70014)End of file found: Error reading request entity data      Please tell how to resolve this?


Category ID is appearing

On the homepage, Category id (mydomain.com/?cat=12) is appearing instead of category name(mydomain.com/mycategory). How do i remove category id..? Permalink structure is well defined and on the top menu, category links are working fine. E.g. On the homepage haircareresources.com -> Please see this link (just below the featured image) Hair Advice - http://www.haircareresources.com/?cat=2


wp enqueue style and style sheet depth

How could I add a style sheet at the bottom of the `<head>` tag, so if there´s a need to override some other styles added before, it will override. I heard something about wp_enqueue_style, and it seems there´s a depth parameter. Is that what I need? To make my style sheet be the last one at the `<head>` tag? If yes, what should I put in the parameter `depth`? Thanks.


Change featured thumbnail based on screen size

My theme has the option( like any other theme I guess) to chose a predefined featured image size( thumbnail, medium ...etc). I chose the image to be thumbnail, made it 150x150 in media settings but my problem is with 480px screens. Here I want the thumbnail to be full width instead of 150px. If I add width: 100%; rule in CSS I get 150px images stretched to 480px and they look awfull. The code that outputs my featured images is this:               function omega_entry() {              if ( is_home() || is_archive() || is_search() ) {             if(omega_get_setting( 'content_archive_thumbnail' )) {                 get_the_image( array( 'meta_key' => 'Thumbnail', 'default_size' => omega_get_setting( 'image_size' ) ) );              }             ...etc}     ...etc}      and I want to have another featured image size for max. 480px, nothing fancy, just as that:               <?php the_post_thumbnail('thumbnail', array('class' => 'myclass')); ?>        I know that resolution may be obsolete but I want my website to look decent on most devices, event the lowend ones. I guess CSS media queries can't help me here and beside those my knowledge is limited. Thank you so much for any help.


get_children - wp_get_attachment_image

I explain my problem:   1. I create a post with an image   2. get_children - wp_get_attachment_image functions returns that image   3. I delete post image and add a different one   4. get_children - wp_get_attachment_image functions returns the two images (although the image that has been removed and is no longer in the post) The code:               $args = array('post_parent'    => get_the_ID(),                   'post_type'      => 'attachment',                   'post_mime_type' => 'image'              );          $images = get_children( $args );     if ($images)      {         foreach ($images as $image)          {                 echo wp_get_attachment_image($image->ID, 'full');         }     }


Creating Theme Options Page

I was creating a theme options page based on a tutorial by Tom McFarlin at TutsPlus and I'm a little stuck. I can't understand where the code goes bad here, because it doesn't allow me to access the site at all when its executed. Is there an easier way to accomplish text input and theme options?               /* =VOTE THEME OPTIONS     ---------------------------------------------------- */          /**      * This function introduces the theme options into the 'Appearance' menu and into a top-level       * 'Vote Theme' menu.      */     function vote_example_theme_menu() {              add_theme_page(             'Vote Theme',                   // The title to be displayed in the browser window for this page.             'Vote Theme',                   // The text to be displayed for this menu item             'administrator',                    // Which type of users can see this menu item             'vote_theme_options',           // The unique ID - that is, the slug - for this menu item             'vote_theme_display'                // The name of the function to call when rendering this menu's page         );              add_menu_page(             'Vote Theme',                   // The value used to populate the browser's title bar when the menu page is active             'Vote Theme',                   // The text of the menu in the administrator's sidebar             'administrator',                    // What roles are able to access the menu             'vote_theme_menu',              // The ID used to bind submenu items to this menu              'vote_theme_display'                // The callback function used to render this menu         );              add_submenu_page(             'vote_theme_menu',             __( 'Header Options', 'vote' ),             __( 'Header Options', 'vote' ),             'administrator',             'vote_theme_header_options',             create_function( null, 'vote_theme_display( "header_options" );' )         );               } // end vote_example_theme_menu     add_action( 'admin_menu', 'vote_example_theme_menu' );          /**      * Renders a simple page to display for the theme menu defined above.      */     function vote_theme_display( $active_tab = '' ) {     ?>

<?php _e( 'Vote Theme Options', 'vote' ); ?>
             <?php settings_errors(); ?>                  <?php if( isset( $_GET[ 'tab' ] ) ) {                 $active_tab = $_GET[ 'tab' ];             } else {                 $active_tab = 'header_options';             } // end if/else ?>
                 <a href="?page=vote_theme_options&tab=header_options" class="nav-tab <?php echo $active_tab == 'header_options' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Header Options', 'vote' ); ?>
                  <form method="post" action="options.php">                 <?php                          if ( $active_tab == 'header_options' ) {                              settings_fields( 'vote_theme_header_options' );                         do_settings_sections( 'vote_theme_header_options' );                          } else {                              settings_fields( 'vote_theme_header_options' );                         do_settings_sections( 'vote_theme_header_options' );                          }// end if/else                          submit_button();                      ?>             </form>
     <?php     } // end vote_theme_display          /* ------------------------------------------------------------------------ *      * Setting Registration      * ------------------------------------------------------------------------ */           /**      * Provides default values for the Header Options.      */     function vote_theme_default_header_options() {              $defaults = array(             'elect_city'        =>  '',             'elect_name'        =>  'City Council',             'elect_year'        =>  '',             'elect_type'        =>  'Election',             'elect_date_month'  =>  '',             'elect_date_day'    =>  '',         );              return apply_filters( 'vote_theme_default_header_options', $defaults );          } // end vote_theme_default_header_options          /**      * Initializes the theme's input example by registering the Sections,      * Fields, and Settings. This particular group of options is used to demonstration      * validation and sanitization.      *      * This function is registered with the 'admin_init' hook.      */      function vote_theme_initialize_header_options() {              if( false == get_option( 'vote_theme_header_options' ) ) {               add_option( 'vote_theme_header_options', apply_filters( 'vote_theme_default_header_options', vote_theme_default_header_options() ) );         } // end if              add_settings_section(             'header_options_section',             __( 'Header Options', 'vote' ),             'vote_header_options_callback',             'vote_theme_header_options'         );              add_settings_field(              'Election City',                                     __( 'Election City', 'vote' ),                                       'vote_elect_city_callback',              'vote_theme_header_options',                 'header_options_section'                     );              add_settings_field(              'Election Name',                                     __( 'Election Name', 'vote' ),                                       'vote_elect_name_callback',              'vote_theme_header_options',                 'header_options_section'                     );              add_settings_field(             'Election Year',                                     __( 'Election Year', 'vote' ),                                       'vote_elect_year_callback',              'vote_theme_header_options',             'header_options_section'             );              add_settings_field(             'Election Type',                                     __( 'Election Type', 'vote' ),                                       'vote_elect_type_callback',              'vote_theme_header_options',             'header_options_section'             );              add_settings_field(             'Election Date: Month',                                  __( 'Election Date: Month', 'vote' ),                                        'vote_elect_date_month_callback',                'vote_theme_header_options',             'header_options_section'             );              add_settings_field(             'Election Date: Day',                                    __( 'Election Date: Day', 'vote' ),                                      'vote_elect_date_day_callback',              'vote_theme_header_options',             'header_options_section'             );              register_setting(             'vote_theme_header_options',             'vote_theme_header_options',             'vote_theme_validate_header_options'         );          } // end vote_theme_initialize_header_options     add_action( 'admin_init', 'vote_theme_initialize_header_options' );          /* ------------------------------------------------------------------------ *      * Section Callbacks      * ------------------------------------------------------------------------ */           /**      * This function provides a simple description for the Input Examples page.      *      * It's called from the 'vote_theme_intialize_header_options_options' function by being passed as a parameter      * in the add_settings_section function.      */     function vote_header_options_callback() {         echo '
' . __( 'Provide input for the page header section.', 'vote' ) . '
';     } // end vote_header_options_callback          /* ------------------------------------------------------------------------ *      * Field Callbacks      * ------------------------------------------------------------------------ */           /**      * This function renders the interface elements for toggling the visibility of the header element.      *       * It accepts an array or arguments and expects the first element in the array to be the description      * to be displayed next to the checkbox.      */          function vote_header_options_callback() {              $options = get_option( 'vote_theme_header_options' );              // Render the output         echo '<input type="text" id="elect_city" name="vote_theme_header_options[elect_city]" value="' . $options['elect_city'] . '" />';          } // end vote_elect_city_callback          function vote_elect_name_callback() {              $options = get_option( 'vote_theme_header_options' );              // Render the output         echo '<input type="text" id="elect_name" name="vote_theme_header_options[elect_name]" value="' . $options['elect_name'] . '" />';          } // end vote_elect_name_callback          function vote_elect_year_callback($year_limit = 0) {              $options = get_option( 'vote_theme_header_options' );              $html = '<select id="elect_year" name="vote_theme_header_options[elect_year]">';             for ($year = 2014; $year <= (date("Y") - $year_limit); $year++) {                 $html .= '<option value="' . $year . '"' . selected( $options['elect_year'], $year, false) . '>' . __( $year, 'vote' ) . '</option>'."\n";             }              echo $html;          } // end vote_elect_year_callback          function vote_elect_type_callback() {              $options = get_option( 'vote_theme_header_options' );              // Render the output         echo '<input type="text" id="elect_type" name="vote_theme_header_options[elect_type]" value="' . $options['elect_type'] . '" />';          } // end vote_elect_type_callback          function vote_elect_date_month_callback() {              $options = get_option( 'vote_theme_header_options' );              $html = '<select id="elect_date_month" name="vote_theme_header_options[elect_date_month]">';             $months = array("", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");             for ($month = 1; $month <= 12; $month++) {                 $html .= '<option value="' . $month . '"' . selected( $options['elect_date_month'], $month, false) . '>' . __( $months[$month], 'vote' ) . '</option>'."\n";             }              echo $html;          } // end vote_elect_date_month_callback          function vote_elect_date_day_callback() {              $options = get_option( 'vote_theme_header_options' );              $html = '<select id="elect_date_day" name="vote_theme_header_options[elect_date_day]">';             for ($day = 1; $day <= 31; $day++) {                 $html .= '<option value="' . $day . '"' . selected( $options['elect_date_day'], $day, false) . '>' . __( $day, 'vote' ) . '</option>'."\n";             }              echo $html;          } // end vote_elect_date_month_callback          /* ------------------------------------------------------------------------ *      * Setting Callbacks      * ------------------------------------------------------------------------ */           /**      * Sanitization callback for the social options. Since each of the social options are text inputs,      * this function loops through the incoming option and strips all tags and slashes from the value      * before serializing it.      *        * @params  $input  The unsanitized collection of options.      *      * @returns         The collection of sanitized values.      */          function vote_theme_validate_header_options( $input ) {              // Create our array for storing the validated options         $output = array();              // Loop through each of the incoming options         foreach( $input as $key => $value ) {                  // Check to see if the current option has a value. If so, process it.             if( isset( $input[$key] ) ) {                      // Strip all HTML and PHP tags and properly handle quoted strings                 $output[$key] = strip_tags( stripslashes( $input[ $key ] ) );                  } // end if              } // end foreach              // Return the array processing any additional functions filtered by this action         return apply_filters( 'vote_theme_validate_header_options', $output, $input );          } // end vote_theme_validate_header_options          ?>


How to show specific tagged posts and ordered by future date on the homepage

I'm creating a site that has upcoming shows on the homepage. I would like the future shows that are up next to show on the home page. I have created a custom field on the posts called "show_date" with values like "10/21/2013" but not sure how to implement them. Here's what I have so far:               <?php     $args = array(         "tag" => "upcoming",             "orderby" => "meta_value_num", // This stays as 'meta_value' or 'meta_value_num' (str sorting or numeric sorting)         "order" => "ASC"         );          query_posts($args);          if (have_posts()) :         while (have_posts()) : the_post();             echo '<a href="<?php the_permalink(); ?>">'; echo "
"; the_title(); echo "
";                 the_post_thumbnail();         endwhile;     endif;          ?>


Slider with pop-up

I'm looking for a slider plugin that can do the same thing like the slider in this website http://www.rorymcilroy.com/ I want a slider that when you click the image, a pop-up window appear. Any idea of wich plugin could do this? Thanks !


How to link to the current User/Author Profile page?

Is there a way to link to the authors profile page? At the moment i can access the authors profile by visiting the url like this: http://mysite.com/?author=1 Is there a function that i could use to show this link regardless if the permalinks are changed? Thanks in advanced.


Display multiple "save draft button" on a post edit

I am aware of the `submit_button()` and `get_submit_button()` function, but can I call a "save draft" button on the same way? I have a very long "edit post page" and would like to display the save draft button various time


Wordpress is converting & to & inbetween [code] brackets

I installed a syntax highlighter plugin so I could post and highlight code snippets. My problem is wordpress is converting special characters in my code (e.g. from `&` to `&`), when I really just want it to leave my code alone.


Use meta box drag and drop to order items independently

I am using one meta box for each image in a custom post type, and I would like to use the drag and drop functionality to allow the client to easily reorder them, the problem is when one custom post is reordered, the others are reordered as well... Is there any way that each post has it's own order? Where is the order of the meta boxes saved? Are there any filters I could use to modify the behavior for a particular post type? Thanks a lot in advance! Gioia


Link to file in plugin directory from wordpress template?

I know that plugins and theme files should be kept separate but for for internal use I need to do it this way. In my themes header.php file I want to include a php file which just contains html, from my plugin directory. The path is basically /wp-content/plugins/my_plugin/my-html.php I can't seem to figure out the proper code for wordpress to look in the plugins directory, and grab the my-html.php file from within the my_plugin folder. I want to include this file so the html in it is included in the header.php within my theme. What would be the best way to go about this??


Wordpress pagination URL posts not load

I set up wordpress newly and add next previous pagination in home page using following code               next_posts_link('Older Entries »', 0);     previous_posts_link('« Newer Entries', 0);      Pagination URL work correct. when click previous link it go to http:www.mydomain.com/blog/page/2/ URL but content not load. IT shows same first page blog post list. I have 70 blog posts and each page show 4 post. How do I load post in pagination URL? Do I need to make any .htaccess or WP setting change?               $args = array('numberposts' => 4);     $lastposts = get_posts( $args );     foreach($lastposts as $post) : setup_postdata($post);      $a = get_post_custom();         $blogroll_image = $a['mainImage'];         print('

');         print('');          print('

' . get_the_date() .'
');             the_title('
', '
');          print(the_excerpt('
', '
'));         print('

');        endforeach;             next_posts_link('Older Entries »', 0);             previous_posts_link('« Newer Entries', 0);


Setup proper 301 redirect for deleted tags

I recently deleted a large number of tags (~20k-25k) from one of the categories that publishes news items. These tags were contributed by our authors and added no value to the site. As a result, Google's bot is now noticing a LARGE number of 404 errors (~90k) on our site and as a results has pushed our rankings down. Though Google says that 404 errors don't affect, our observation is bit different. After experiencing the downwards traffic for over a month now, I've decided to redirect all the 404 pages originating from the deleted tags to home-page permanently. I'm not sure whether this is a right step; but that seems to be the only option that I have. My requirements: For every 404 resulted on domain.com/tag/ , I want to setup 301 redirect to home page. I'm a complete noob when it comes to redirects and can't take chances on messing up with these.


Contact Form 7 Plugin emails not being received by some accounts

I am using contact form 7 to send an email form. I receive them, but my clients' email addresses - one at the host and one at gmail, never do. They claim that none of the messages end up in their spam folders either. The client did ask the host to take a look and they also claimed that there is no blocking of the form emails and they aren't being sent to spam. Ideas on where things are going wrong and how to fix this?


Issues with set cookie

At first I had my `setcookie()` as:               $school = "Some Value";     setcookie("default_school", $school, time()+3600);     var_dump($_COOKIE);      That didn't work, so I did some searching, and found that I probably just needed to set a path, so I changed it to:               $school = "Some Value";     setcookie("default_school", $school, time()+3600, "/", ".mydomain.com");     var_dump($_COOKIE);      That still didn't work so I did some more investigating, and determined that my issue must just me setting the cookie too late. So I then started checking my if my headers were set in certain parts of my code, which needs to return `bool(false)`.               var_dump(headers_sent());      First the top of my `index.php`, then at the top of my `header.php`, but still the same result; they both return true? I feel like this should be so simple, and I'm getting nowhere. A push in the right direction would be highly appreciated. Thanks, Isaac EDIT: Just tried putting it before the init hook, and it returned false. I then put the setcookie function there, and still no luck.


Menu_order for WooCommerce set all with value 0 to 999999999999

I want to do this ( Define menu_order on Creation of New Custom Post? ) with WooCommerce but what if the products are already published and not drafts? I have 4000 affiliate products feeding in and have the xml files number populating the menu_order field however some products have no salesrank data and thus become 0 but I need to do the above trick however with most of these already published the above trick didn't quite work? Any ideas? Reason I am doing this is to rank by most popular first but all the products with 0 of course end up first. Thanks


Wordpress Website Featured Image Replacement Issue

Im working on my Wordpress website, and I'm having an issue with the page template inserting the "Featured Image" at the top of the page. I've isolated the PHP code that controls this.                   $thumb = '';         $width = (int) apply_filters('et_page_image_width',621);         if ( is_page_template( 'page-full.php' ) || $fullwidth ) $width = (int) apply_filters('et_page_image_full_width', 960);         $height = (int) apply_filters('et_page_image_height',320);         $classtext = '';         $titletext = get_the_title();         $thumbnail = get_thumbnail($width,$height,$classtext,$titletext,$titletext,false,'Pageimage');         $thumb = $thumbnail["thumb"];      Now if I delete this code it will remove the image at the top of the page, which is fine but I want to replace it with an image from the media library. Is it possible to change the code so that it pulls the image from the "Edit Page>Custom fields" section in the Wordpress page editor? Thank you for the help.


How do I filter posts by taxomony using AJAX

I found this post that describes how to filter category posts with Ajax and it works great, but I also want to filter my custom taxonomies the same way and I can't get it to work. It shows me all posts instead of just the posts from my taxonomy. I know the menu needs to be changed to `get_the_terms` instead of `get_the_categories` but I specifically need help with what to change in the jQuery function and the php function at the bottom. I tried adding a `tax_query` calling my taxonomy but it's still not showing the correct posts. Can anyone help point me in the right direction?


Where is stored the Publish date value for a post?

I have to do a massive change in the database and I need to know in what **field** of what **table** is stored the **publish date** value of a post. Using phpMyAdmin I see that each record into the **wp_posts** table have a **poste_date** field that is show as **Date** field in the **Posts --> All Posts** (into the WP administration panel). But this value is different from the **Publish date** that is automatically setted when a post is published. Where is stored this value? Tnx


Combining custom taxonomy posts with default posts on one archive page

I'm trying to get custom archive posts and default posts combined onto one archive page which I have managed... sort of but I can't get pagination to work either using the pagenavi plugin or the themes default pagination code. I have tried using paged but if anything did show I'm then not sure it would page both categories together or just one. I need to combine two categories, one a custom taxonomy, the other the default and then have them styled differently and have a set number of the combined posts on the page and to be able have them in pages of 9 posts. code I'm using:                           <?php if (is_category()) { ?>
                     <?php _e(); ?> <?php single_cat_title(); ?>
                 <?php } ?>
                         <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                         <?php get_template_part( 'partials/loop', 'archive' ); ?>                         <?php endwhile; ?>
                      <?php rewind_posts(); ?>                      <?php                 $args = array(                 'post_type' => 'events',                 'posts_per_page' => '6',                 'paged' => $paged,                 'tax_query' => array(                 array(                 'taxonomy' => 'event_cat','events',                 'field' => 'slug',                 'terms' => 'events','upcoming-events'                 )                 )                 );?>                 <?php $the_query = new WP_Query( $args ); ?>
                         <?php if ( $the_query->have_posts() ) :                         while ( $the_query->have_posts() ) : $the_query->the_post(); ?>                         <?php get_template_part( 'partials/loop', 'archive-events' ); ?>                         <?php endwhile; ?>
                      <?php wp_pagenavi(); ?>                      <?php else : ?>                 <?php get_template_part( 'partials/content', 'missing' ); ?>                 <?php endif; ?>      Changed the above to:                                       <?php if (is_category()) { ?>
                                 <?php _e(); ?> <?php single_cat_title(); ?>
                         <?php } ?>
                                      <?php $query = new WP_Query( array( 'cat' => '7' )); ?>                                           <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                                 <?php get_template_part( 'partials/loop', 'archive' ); ?>                                 <?php endwhile; ?>
                                  <?php else : ?>                             <?php get_template_part( 'partials/content', 'missing' ); ?>                             <?php endif; ?>                                  <?php rewind_posts(); ?>                           <?php                          $args = array(                     'post_type' => 'events',                     'posts_per_page' => '3',                     'paged' => get_query_var( 'paged' ),                     'tax_query' => array(                     array(                     'taxonomy' => 'event_cat',                     'field' => 'slug',                     'terms' => 'events'                     )                     )                     );?>                          <?php $the_query = new WP_Query( $args ); ?>
                                 <?php if ( $the_query->have_posts() ) :                                 while ( $the_query->have_posts() ) : $the_query->the_post(); ?>                                 <?php get_template_part( 'partials/loop', 'archive-events' ); ?>                                 <?php endwhile; ?>
                             <?php if (function_exists('joints_page_navi')) { ?>                             <?php wp_pagenavi(); ?>                             <?php } else { ?>

<?php next_posts_link(__('« Older Entries', "jointstheme")) ?>

<?php previous_posts_link(__('Newer Entries »', "jointstheme")) ?>

                                                          <?php } ?>                                  <?php endif; ?>


How to modify the "View all posts in category" title attribute

I'm tyring to change the "View all posts in category" tooltip you see when you hover over a category link in wordpress. Until now I've always done it in the Wordpress core file named category-template.php - however I'm searching for a method to do it in the functions.php so I don't have to change it after every Wordpress update. I could only find this code to remove the "View all posts in category" title attribute alltogether, but I have no idea how to modify it:               add_filter( 'the_category', 'remove_category_title' );     function remove_category_title( $category ) {     return preg_replace( '/\s* title=\s*".*?"/i', '', $category );     }      I just want to change the text "View all posts in" and "View all posts filed under"


Facebook like button not reading correct og: meta content

I am using the Facebook plugin for WordPress, however I have disabled the method in the file 'open-graph-protocol.php' `add_og_protocol` and have instead opted to create my own meta tags and content. Here is an example of my og meta content that is output               <meta property="og:title" content="Summer Offers"/>     <meta property="og:type" content="blog"/>     <meta property="og:url" content="http://derma-logica.businesshuntermarketing.com/specialoffer/summeroffers/" />     <meta property="og:image" content="http://derma-logica.businesshuntermarketing.com/wp-content/uploads/2014/07/Facial_Spa_Treatments-300x200.jpg" />     <meta property="og:image:url" content="http://derma-logica.businesshuntermarketing.com/wp-content/uploads/2014/07/Facial_Spa_Treatments-300x200.jpg" />     <meta property="og:site_name" content="Dermalogica Clinics"/>     <meta property="og:description" content="Potionshop Facial Spa Treatment The face, neck and shoulders are thoroughly cleansed, detoxified, exfoliated and hydrated using a luxurious selection of organic indulgences. The hands are cleansed and massaged; whilst a luxurious Potionshop Rose Otto..." />     <meta property="fb:app_id" content="200195043334363"/>      This is the only og meta content that is on the page - as I originally thought that the Facebook plugin was somehow still adding it's own meta content to the page and it was this that was being used to build the like summary - but after checking the sourcecode of the page I can see that this is the only meta content. I also thought that maybe the Facebook plugin created a like button which retrieved it's og meta content from another source instead of the meta tags on the page, maybe passed as parameters to the button on creation or something I don't know, however after running the page through facebooks og content debug tool, I see the same incorrect result - you can see the result yourself here: https://developers.facebook.com/tools/debug/og/object/ with the url http://derma-logica.businesshuntermarketing.com/specialoffer/summeroffers/ If anyone could assist me in diagnosing exactly where the og: content is being generated from, and the steps I need to take in order for the meta content that is present in the source code of the page to be used, that would be great thank you. _UPDATE_ If I replace my dynamically generated meta tag content with hard coded values, these appear correctly, any ideas as to why facebook would neglect to include my dynamic content even though I can see it output int he source code of the page? _update 2_ Really embarrassed to admit how silly I was with this - however the problem was caused by me having a 'coming soon' mode enabled in the theme settings, and so of course the Facebook scraper could only see this page, and so all of the default non-post-specific meta content was being output - silly me!


How to output data from meta box with cloned fields?

Just to let you know, i am at a beginner level with PHP, so please bear with me : ) Also, I looked at this post and I did not find it helpful in my case, so I am making a stab at it here. (Meta Box Plugin Cloned Fields - Multiple Foreach values) In a nutshell, I am having an issue trying to extract data from a meta box and output it a certain way. I am using the MetaBox plugin by deluxeblogtips. I can create the meta boxes just fine and for the most part am able to get the data from them as needed. I do have one meta box that is using 'cloned fields', and when the field is set to 'cloned' the values are stored in an array. To grab the value of a single meta field you use this:               $meta = rwmb_meta( $key, $args = array(), $post_id = null );      To get the value of multiple fields it's the same, but stored in an array.               $metas = rwmb_meta( $key, $args = array(), $post_id = null );      Then use a loop to output.               foreach ( $metas as $meta )     {         echo $meta;     }      Which is fine and i can do, but i have 3 fields and each are cloned. ![Meta Box Screenshot](http://i.stack.imgur.com/ltNJO.gif) And I need the values to display like so. ![Final Layout](http://i.stack.imgur.com/HKuTx.gif) I am grabbing each array:               $ff_sizes = rwmb_meta( 'ff_size', 'type=text', $post->ID );     $ff_prices = rwmb_meta( 'ff_price', 'type=text', $post->ID );     $ff_calories = rwmb_meta( 'ff_calorie', 'type=text', $post->ID );      I can use 3 foreach loops to output the values:               foreach ( $ff_sizes as $ff_size ) {     }          foreach ( $ff_calories as $ff_calorie ) {     }          foreach ( $ff_prices as $ff_price ) {     }      And I have the layout code, which works for a single iteration:               echo '
'.$ff_size_display.'';     echo ' ('.$ff_calorie_display.' cal.) ';     echo ''. $ff_price_display .' ';     echo '
';      What I was trying to do was to use the $ff_sizes array to control the iterations and nest the other for loops inside it. I could output the correct amount of sizes, but the prices and calorie counts showed up twice. Probably because they are in the $ff_sizes loop that runs twice. See snippet below.               foreach ( $ff_sizes as $ff_size ) {         $ff_size_display = $ff_size;         echo '
'.$ff_size_display.'';         //ouputs the correct amount of sizes              foreach ( $ff_calories as $ff_calorie ) {             $ff_calorie_display = $ff_calorie;             echo ' ('.$ff_calorie_display.' cal.) ';             //outputs calories twice in a row on same line         }              foreach ( $ff_prices as $ff_price ) {             $ff_price_display = $ff_price;             echo ''. $ff_price_display .' ';             //outputs price twice in a row on same line         }         echo '
';     }      I am not too familiar using these loops let alone nesting any of them, so a push in the right direction would be greatly appreciated! Thank you.


What is the most efficient way to retrieve a group of image URL's from different attachment ID's of a specific crop size?

I have a basic slider plugin that I am attemping to make more efficient. This plugin collects an array of attachment ID's from the user to represent each image of the slider. With these attachment ID's, I then need the URL for a specific crop size on each one. I'm trying to figure out what the most efficient way to grab all of these is, in terms of querying the database. Currently I'm doing something like this:               $attachments = array(1906,1905,1904); // attachment ID's from user          foreach( $attachments as $attachment_id ) {         $image_url = wp_get_attachment_image_src($attachment_id, 'my_size');         // $image_url[0] ...     }      However, am I correct in assuming that this means I'm querying the database each time I call `wp_get_attachment_image_src()`? Is there anyway to accomplish retrieving the URL's of each image with a single database query? Can I do anything moving more in this direction?               $attachments = array(1906,1905,1904); // attachment ID's from user          $query = array('post_type' => 'attachment', 'post__in' => $attachments);     $posts = get_posts($query);          foreach( $posts as $post ){         // Can I get the image URL of a specific crop size          // with out querying the DB again?              // Possibly with $post->guid somehow?     }      Note: I understand the sort of insignificance of this basic example, in terms of the first way being "fine" but I'm trying to use this as more of a learning question in moving onto more complicated things. :)


Retrieving next_post_link() and previous_post_link() in functions.php

I'm trying to create a function in functions.php that includes the next_post_link() and previous_post_link() without success. It returns empty. My guess is that these don't use the post ID... So what would be the best way to do that so I can store them values in $next_link and $previous_link in the following code?               <?php     function get_all_images($post_id=0, $size='poster', $attributes='') {         $post_id = $_POST['post_id'];         if ($post_id<1) $postid = get_the_ID();         if ($images = get_children(array(             'post_parent' => $post_id,             'post_type' => 'attachment',             'numberposts' => -1,             'orderby' => 'menu_order',             'post_mime_type' => 'image',)))             $title = get_the_title($post_id);             $next_link = next_post_link($post_id);             $previous_link = previous_post_link($post_id);             $response = '
'.$next_link.'

'.$previous_link.'

'.$title.'
';             foreach($images as $image) {                 $attachment=wp_get_attachment_image_src($image->ID, $size);                 $tranparent=get_template_directory_uri();                 $response .= '';             }         $get_post = get_post($post_id);         $get_content = $get_post -> post_content;         $content = apply_filters('the_content', $get_content);         $content = str_replace(']]>', ']]>', $content);         die(json_encode($response.$content));     }?>


Display different category template if custom field is checked

I am a big fan of Advanced Custom Field by Elliot Condon http://www.advancedcustomfields.com/ This is what I am trying to chive without success so far: I have a website with posts and **archive.php** displays my archive posts page. Now, I would like to display different template for certain categories. I don't have the name of the category which I want to display this template for, I would like to do it dynamically so whenever my user creates a post he can choose a special custom field from within that post (true, false preferably) e.g - this post belongs to "projects" category and if the checkbox is checked - **archive.php** will call different layout using include file. if this option is unchecked. **archive.php** show the regular template I was thinking about simply creating a custom field called " **is_project_category** " and assign it to a post page but when I tried to use it in archive.php it didn't work at all I used this code:               <?php      $is_projects_category = get_field('is_projects_category');      if('is_projects_category' == true){?>          // include the special category template for projects          <?php } else{ ?>          // display normal archive template          <?php } ?>      it didn't work.. any idea how to use it outside the loop of **single.php** and show it in archive.php (or anywhere in the theme)? Thanks


Most recent post from another database

I am trying to add the most recent post from another Wordpress database (on the same server in all actuality), but am getting the following error: `Fatal error: Call to undefined method wpdb::query_posts() in /var/www/site/wp-content/themes/custom/footer.php on line 68` Here is the code:                    <?php     $originaldb = new wpdb('username', 'password', 'db', 'localhost');     $originaldb->query_posts( 'posts_per_page=1' );       if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                 <?php echo ''.get_the_date('j').'
'.get_the_date('M').''; ?>

<a href="<?php the_permalink(); ?>"><?php the_title() ?>
                 <?php echo '' . the_author() . ''; ?>

             <?php the_excerpt(); ?>
          <?php endwhile; else: ?>       Testing has failed     <?php endif; ?>


Custom Wordpress Does Not Display Anything But Background in IE

I have a custom, well kinda custom wordpress in only one page of my site, the background only displays in Internet explorer, no body or content just background though in firefox it's fine as with other browsers. Reverted back to the original twenty ten and it shows in IE. I know the code is horrible but it was a shot at making a custom theme and it worked fine before. If I thought I could fix it myself I wouldn't ask the pros here. You guys have helped me a ton !! Also, if you view the source, it shows content being there. http://www.shakedownnationals.com/news/ Sincerely Mark


the_excerpt() in content.php and get_template_part() in single.php

everybody. So I'm creating a blog theme and have put `the_excerpt()` in **content.php** My **index.php** displays different post excerpts for the different kind of posts-formats. I have **content-gallery.php** , **content-audio.php** , etc and in each of them I have `the_excerpt()` instead of `the_content()`. If I put `the_content()` and there is a lot of text before the _read-more_ tag, it breaks the layout, because the design is made for little snippets for each post. Does that mean that I can't use `get_template_part( 'content', get_post_format() )` in **single.php** , because it will return an excerpt and not the whole content? In the **content.php** , I could put:               if( is_singular() ) {         the_content();     }      Or create subpages of **single.php** like **single-gallery.php**. What is the correct way of arranging the hierarchy when using `the_excerpt()` in **content-{post-type}.php**?


Pretty links for PHP pages above WP /blog directory?

I've made a new WP installation in a subfolder /blog, set up with "Post name" permalinks. I'm ready to make several other non-WP website PHP pages which would reside above the /blog directory. I was wondering - is there a way (1) to make these non-blog pages above the /blog directory have "pretty" (aka "search engine friendly") links (like the /blog pages would have), and (2) if that _is_ possible, is there also a way in WP to somehow disallow using the 'above the blog page' names for WP pages or posts, so that they won't conflict?


Add information to HTTP Header in WordPress Plugin

I am working on developing a plugin for a tool called Supportify. It is a REST API that is authenticated through a key and token added to the HTTP header of a HTTP request to their servers. Their API reference is here. I know you can add things to the header with `wp-config.php` but for a publicly released plugin this is not feasible. Is there any way to do this through a plugin?


CPT Archive with parent page

Is it possible to set a parent page to a CPT Archive? I used a plugin to add archives to the `nav_menu` section. That works. But I also want the link to be `/parent/archive`. Is there a plugin or programmatic way to achieve this?


How to Change MU/BuddyPress Group Blog New Installation Defaults

I am trying to work with a Multisite install of WordPress and modify the default "child" blogs in the network. The details are: -I have a main site built on Commons in a Box (CBOX) which is a modified version of BuddyPress which allows users to register and then create groups. -If a user creates a group, he/she has the option of creating a "group blog" (It is a BuddyPress orientated plugin) that is tied to the group and is essentially a new WordPress blog within the the main site.  * * * !!!The Problem!!! -I want the default installation to be different than the normal WordPress "hello world" post, sample page, etc.  Mainly, I would like to minimize most of the admin menu options so that users do not see them, i.e. more user friendly and less work if something goes wrong. * * * I already have the ability to set the default theme for the new installations and so I was wondering if I should use a plugin for this or a child theme or something else? I saw this plugin, Adminimize, and was wondering if I could use it some way as a default plugin for a new install, with all of the options set and the plugin menu hidden. I am also trying to use CommentPress for the new sites which has a built-in theme as well as other quirks. Any help would be appreciated. Thanks.


How to have more post in a page than in your home page

I am new to the world of WordPress. I own a new site and I'd like my home page to display the latest news and articles (which I accomplished to set in Settings > Reading), but I'd like another page to display all posts (not the whole post but a summary) without the need to press "previous page". e.x. If I have 8 posts and I set maximum posts to be 4 in the settings menu, my home will have 4 posts. But I'd like the other page to have all 8 posts in summary without the need to press previous page to read other posts. How can that be done?


How to associate more than one user to a post?

I have a website we're building with 1600 'Business Listings' which are made as custom post types. Our problem is that, while there only needs to be one 'editor' of each post/company, there are sometimes more than one user(employees) associated with the post/company. The biggest reason for this is grouping users with certain businesses, which in turn gets used for email newsletters, and just overall contact info (only seen in the backend by the admins). SO. Is there a way to associate more than one user to a post? Basically out client wants to be able to go into a company's profile (aka custom post) and see all of the employees attached to that company. Thoughts? Multiple author-to-post plugin or hack we can do?


Changing Domain Renders Site Unusable

So I've been following the guide for Moving WordPress and I've been running into problems. I changed the domain on my site, and I performed a search and replace on the database for all occurrences of the domain name, but still the site refuses to load unless I go back into `wp_options` and change `siteurl` and `home` fields back the old domain. I'm not sure what to provide for information, so please ask for anything I can give to help, but what could possibly be causing this disaster?


Installed successfully; home page still redirects to install.php

I've done WP installs in the past and haven't had issues, so I'm a little stumped here. I've correctly created wp-config.php. I ran the install script, and everything appeared to be successful. I have all the tables in MySQL and am able to log into the dashboard with the admin account I created. However, the home page is still redirected to install.php. Clicking the button to install brings up a message that WP is already installed (which is what I would expect to see), but the home page doesn't want to load the blog. I can, however, open the test post that comes with the install just fine. It's only the home page that isn't working. If it helps any, this is an installation I've set up for a project on Sourceforge.


problem in uploading attachment to custom directory

i have been trying to upload the attachments to the custom directory without affecting the old uploads. so i use this bellow code to achieve that               add_filter('wp_handle_upload_prefilter', 'cust_pre_upload');     add_filter('wp_handle_upload', 'cust_post_upload');          function cust_pre_upload($file){     add_filter('upload_dir', 'cust_dir');     return $file;     }          function cust_post_upload($fileinfo){     remove_filter('upload_dir', 'cust_dir');     return $fileinfo;     }               function cust_dir( $args ) {     $customdir ="/mars";     $args['path'] = "C:/wamp/www/web1/wp-content";     $args['url']  = "http://localhost/web1/wp-content";          $args['subdir']  = $customdir;     $args['path']   .= $customdir;      $args['url']    .= $customdir;          return $args;     }      i use the wp_handle_upload_prefilter to assign the new directory only for the attachment i upload now or in future and wp_handle_upload to prevent the old attacmments. this code perfectly uploading to the folder where it supposed to [http://localhost/web1/wp-content/mars/file.jpg but the attachment get this wrong and show an invalid url of the attachment something like this [http://localhost/web1/wp-content/uploads/C:/wamp/www/web1/wp- content/mars/file.jpg] any help or idea would be appreciated :) tried different types of codes nothing worked out.


CPT archive page - show one post from each taxonomy term

Basic loop question: I have a custom post type with a custom taxonomy and 3 terms. On the archive page (archive-custom_post_type.php), I would like to display one post from each taxonomy term. Is this possible within the standard `if (have_posts()) : while (have_posts()) : the_post();` loop, or do I have to make separate loops for each one?


How to order custom post type by multiple custom fields?

How to display posts with 'Event' custom type ordered by 'Start_Hour' and then by 'Start_Minute'? 'Start_Hour' and 'Start_Minute' are numeric custom fields. I tried this, but it doesn't work:               $args = array(       'post_type'=>'Events',       'orderby' => 'meta_value',       'meta_key' => 'Start_Hour Start_Minute',       'order' => 'ASC'     );     $loop = new WP_Query( $args );


Two exact templates, sidebar showing in one but not the other

I'm using the Roots WP Theme and for some reason when copy pasting the page- custom.php to create a home page template. The new homepage template is showing the sidebar but not the original page-custom template even though the two template files are exactly the same at this moment. Can anyone explain why this might be?


WP-E Commerce: How to let user leave a personal message/instruction with each product from the products page

This is my first question here. I've Googled and searched here but didn't find the answer or any useful instruction. I'm using `wp-e commerce plugin` for the first time. My question is: How can I let a user add a personal message/instruction from the product page in `wp-e commerce plugin` using a textarea. Like this site, I want to let the user the ability to add `Add special instruction` with every products from the home/products page. Hope someone can help me out. Thanks in advance.


how to make separate category term archives by post type

I've searched around, and many others are struggling with similar questions that don't seem to have been answered well. So please help reduce this misery! Suppose you've got an off-the-shelf WordPress blog with posts of local news, organized under the standard WordPress taxonomy "category" with terms "crime", "politics", "entertainment" etc. The category term archive URLs /category/crime/ , /category/politics/ , etc. exist automatically. You've set up a custom post type "national" for national news. It uses the same categories as the (default) post type local news. What's a simple way to set up similar category term archives for the national news custom post type? In other words, URLs something like /national/category/crime/ , /national/category/politics/ , etc. These URLs should produce only posts with post type national.


wp_query for events & posts filtered by category

I need to perform a wp_query to return events and posts. The events need to be in a specific category (stub = 'novita') and the posts in cat 15. I feel like I've tried every conceivable permutation of this code but haven't managed to return what I need. This returns nothing. Any help greatly appreciated. I've been on this for 2 days and am losing the will to live. Many thanks.                   $args = array(         'post_type' => array( 'event', 'post' ),         'orderby' => 'date',         'order' => 'DESC',         'posts_per_page' => 12,         'meta_query'             => array(             'relation' => 'OR',             array(                 'key'       => 'cat',                 'value'     => '15',                 'compare'   => '='             ),             array(                 'key'       => 'event-categories',                 'value'     => 'novita',                 'compare'   => '='             )         )     );


Get thumbnail using wpdb from external wordpress database

I'm trying to get thumbnails from posts using a wpdb query where the wordpress database I'm querying is _not_ the one from which the wpdb query is being called. That may be a little unclear, so here is a bit of my code: The query:               $gcdb = new wpdb(<user>, <password>, <database>, <host>);     if ( is_object( $gcdb ) && !isset($gcdb->error) ) {     $results = $gcdb->get_results(           "           SELECT              p.ID,             p.post_author,             p.post_title,             p.post_date,             p.post_content,             p.post_excerpt,             p.guid,             meta2.meta_value           FROM              wp_posts p           LEFT JOIN             wp_postmeta meta1             ON (               meta1.post_id = p.ID               AND meta1.meta_value IS NOT NULL               AND meta1.meta_key = '_thumbnail_id'             )           LEFT JOIN             wp_postmeta meta2             ON (               meta1.meta_value = meta2.post_id               AND meta2.meta_value IS NOT NULL                AND meta2.meta_key = '_wp_attached_file'             )           WHERE             p.post_status = 'publish'             AND p.post_type = 'article'           ORDER BY             p.post_date DESC           "         );       if ($results) {         global $post;         foreach ($results as $post) {           setup_postdata($post);         ?>

                   <a href="<?php echo $post->guid; ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">                     <?php the_title(); ?>

               <?php                 the_post_thumbnail();                 the_excerpt();                ?>

         <?php         }       }       wp_reset_postdata();     }      So, just to be clear, the database for the wpdb is not the same database that would be queried if I used `WP_QUERY`. The database is on the same server, but it is a different wordpress installation. Now, I noticed that if I call, for example `the_permalink()`, it actually gets the permalink _relative to_ the wordpress installation from which this code is being called (i.e. instead of domain2.com/post-link/, I get domain1.com/post-link/). I think it is for this same reason that `the_post_thumbnail()` doesn't work. If there is some way I can use `the_post_thumbnail()`, that would be ideal. However, if that doesn't work, I could always just pull from the 'meta_value' field from my query. However, this gives me the full thumbnail instead of the cropped one. How could I either get the URL for the cropped thumbnail, or the size of the thumbnail?


Which Meta Query Compare Method Should I use?

How do I do a 'like' comparison on a numeric value with meta_query? I have some code that does an autocomplete search for product sku's in WooCommmerce. It works fine for non numeric skus, but I can't get it working with numeric skus. I'm using compare => 'like' because my autocomplete script is setup to start searching after 2 characters have been entered (so that skus 10 characters long can be searched instead of entered exactly). Here's what I'm working with now:               $products1 = array(         'post_type' => array ('product', 'product_variation'),         'post_status' => 'publish',         'posts_per_page' => -1,         'meta_query' => array(             array(             'key' => '_sku',             'value' => $_REQUEST['term'],             'compare' => 'LIKE'             )         ),         'fields' => 'ids'     );


How to use "Add link" pop up for a WordPress widget

In the WYSIWYG editor of WordPress you get pop up if you want to add a link for a text. Is there a possibility to access this functionality? Because I want to use this pop up for a WordPress widget that I created so that you can add links to a widget if you configure it in the backend. Here is a screenshot of what I mean: ![enter image description here](http://i.stack.imgur.com/j36g1.png)


Use of check_admin_referer with theme options and options.php

If I set up a theme options page in the way suggested by the codex (http://codex.wordpress.org/Creating_Options_Pages) then my form submits to 'option.php'. `settings_fields` creates a nonce, which if I was creating my own submission page would be checked with `check_admin_referer`. My question then.... if I use options.php as my 'form processor' does this mean I cannot use `check_admin_referer`? Thanks, Nick


Better way to enforce category hierarchy in post_categories_metabox?

The objective is to ensure that when editing a post, the metabox that lists a hierarchical taxonomy doesn't reorder itself upon Update to put checked items on top. Right now, `edit-form-advanced.php` calls `add_meta_box()`, passing a callback of `post_categories_meta_box`, which is defined in `meta-boxes.php`. `post_categories_meta_box()` invokes `wp_terms_checklist()`, leaving the `checked_ontop` parameter undefined. `wp_terms_checklist()` defaults that parameter to `true`, which is the root cause of all this hooplah. Nary a filter hook to be found anywhere along the chain until we back out and discover `add_meta_boxes` and `add_meta_boxes_{$post_type}`. The only solution I was able to come up with myself was to hook onto one of these actions, globalize `$wp_meta_boxes`, and replace occurrences of the `post_categories_meta_box` callback with a callback of my own, where I completely duplicate all of `post_categories_meta_box()` and simply add the parameter `'checked_ontop' => false`. Works. But fugly. This seems ridiculous - is there no more elegant way to simply let your hierarchical taxonomies keep their order in metaboxes?


Additional class for.sub-menu UL?

This code returns my WordPress menu:                <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'header-menu') ); ?>      What's the easiest (non-JS) way of adding additional class to all .sub-menu ul dropdowns of this menu? I was thinking about add_filter() for wp_nav_menu but I'm afraid it will point all wp_nav_menus and I want to add these classes only to this particular one. Also, custom walker sounds a bit like an overkill. What would you recommend?


Static Website No Titles But Still Nav

So I have a static paged website and I want to make pages without title, but I still need the titles for the navigation to pick it up. How can I get rid of the Page.php (the_post()) from displaying the page title?


WP Calendar Shortcode not working on my theme

I'm using WP Calendar plugin on my development site. The documentation says that I can use the tag `{event_calendar}` on my template to render the calendar. This is the code am using on my template page.               <?php echo do_shortcode('[event_calendar]') ?>      When I look at the Chrome Console, There is no error. There is a Javascript file that is loaded: `fullcalendar.min.js`. jQuery 1.9 loads up in the header. Appreciate any help.


How to Link External jQuery/Javascript files with WordPress

So I'm using Starkers to base my next WP theme on and I've run into a small issue, I was including my own version of jQuery in the `header.php` file but when inspecting my site using Firebug I noticed jquery was being downloaded twice, I did a bit of digging and noticed that not only was I including the file but so was the `wp_head()` function. In trying to fix the problem I noticed a comment in the header file, of which originated came from the Twenty Ten theme:               /* Always have wp_head() just before the closing </head>      * tag of your theme, or you will break many plugins, which      * generally use this hook to add elements to <head>, such       * as styles, scripts, and meta tags      */      So here's my problem, I am under the impression that the jQuery file has to be set before any other file that wants to use it and that `wp_head()` should be the last thing in the `<head>` element, I'm slightly confused now as I'm wondering should I put `wp_head()` at the top so the WP included jQuery file will be used for all my plugins, even though it says not to do so. I did comment out the jQuery line in the `wp_head()` function but it's required for the admin page so I had to put it back. I'd also like to use (at least experiment) with using the Google CDN version of jQuery, but don't want to include it twice! I hope you understand what I'm trying to explain, any suggestions on how I can solve this problem would be most appreciated. I'd also appreciate any advice on how you handle your JavaScript files with the header file. Thanks!


WP in Subdirectory -- Multiple robots.txt and .htaccess files?

Assume you have a static HTML site with its own `robots.txt` and `sitemap.xml` at `www.mysite.com`. Now you add WordPress blog as an adjunct to the site at: `www.mysite.com/blog`   1. Do you need to have a second `robots.txt`? One for the root html site and one for WP blog?   2. Do you need to have a second `.htaccess`? One for the root html site and one for the WP blog?   3. Do you need a separate `sitemap.xml`? One for the root html site and one for the WP blog?


Taxonomy.php error appearing in the header of my site

It references line 231 of the taxonomy.php file (See image) and all it says on that line is:                * Checks that the taxonomy name exists.      *      * Formerly is_taxonomy(), introduced in 2.3.0.      *      * @package WordPress      * @subpackage Taxonomy      * @since 3.0.0      *      * @uses $wp_taxonomies      *      * @param string $taxonomy Name of taxonomy object      * @return bool Whether the taxonomy exists.      */     function taxonomy_exists( $taxonomy ) {         global $wp_taxonomies;         return isset( $wp_taxonomies[(string)$taxonomy] );     }      It's on a general page that lists Neighborhoods. I'm using the ACF plugin but haven't encountered this error before. Any ideas would be most helpful. Thanks. ![enter image description here](http://i.stack.imgur.com/8SUXD.png) UPDATED CODE ----- Here is the code i'm using in the internal header which happens to be the case for this particular header:               <!DOCTYPE html>                                          <title>                  <?php                echo wp_title();                         bloginfo( 'name' );                  ?>                </title>           <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />           <meta name="robots" content="index, nofollow" />           <?php wp_head(); ?>
                                       <a class="logo" href="<?php ( 'home' ) ?>" alt="Return Home" title="Return Home">                                          <?php                        $args = array(                     'menu' => 'main-menu'                     );                        wp_nav_menu( $args );                      ?>
<?php wp_title($echo); ?>

           Here is the code for the body portion of the page which all i'm doing is using the query to get all the permalinks from the custom post types and creating a LI's within a UL to list all the neighborhoods.               <?php          /*            Template Name: Neighborhoods Main Page          */          get_header( 'internal' );?>

          <?php            $args = array(         'post_type' => 'neighborhood'       );            $the_query = new WP_Query( $args );          ?>
            <?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php the_field( 'neighborhood_name' ); ?>
            <?php endwhile; else: ?>

There are no posts or pages here.
          <?php endif; ?>
          <?php get_footer(); ?>      UPDATED 3-22-2014 ------- Here is a snippet from my functions.php file where I enable custom menus:               //Enable custom menus     add_theme_support( 'menus' );          //Register Navigations     add_action( 'init', 'my_custom_menus' );     function my_custom_menus() {         register_nav_menus(             array(                 'primary-menu' => __( 'Primary Menu' ),                 'neighborhood-menu' => __( 'Neighborhood Menu' ),                 'place-menu' => __( 'Place Menu' )             )         );     }      ENTIRE FUNCTIONS.PHP FILE -------               <?php          // Load the Theme CSS          function theme_styles() {            wp_enqueue_style( 'normalize', get_template_directory_uri() . '/css/normalize.min.css' );       wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css' );       wp_enqueue_style( 'googlefonts', 'http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz');       wp_enqueue_style( 'googlefonts2', 'http://fonts.googleapis.com/css?family=Open+Sans');       wp_enqueue_style( 'googlefonts3', 'http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300');       wp_enqueue_style( 'main', get_template_directory_uri() . '/style.css' );       wp_enqueue_style( 'iconset', get_template_directory_uri() . '/css/mfglabs_iconset.css' );       wp_enqueue_style( 'icon_fonts', get_template_directory_uri() . '/css/font/' );            wp_register_style( 'flexslider', get_template_directory_uri() . '/css/flexslider.css' );       if( is_page( 'home' ) ) {           wp_enqueue_style( 'flexslider' );       }          }          // Load the Theme JS          function theme_js() {            wp_register_script( 'flexslider', get_template_directory_uri() . '/js/flexslider.js', array('jquery'), '', true );       if( is_page( 'home' ) ) {           wp_enqueue_script( 'flexslider' );       }       wp_enqueue_script( 'theme_js', get_template_directory_uri() . '/js/theme.js', array('jquery'), '', true );       wp_enqueue_script( 'theme_js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '', true );          }          add_action( 'wp_enqueue_scripts', 'theme_js' );          add_action( 'wp_enqueue_scripts', 'theme_styles' );          //Enable custom menus     add_theme_support( 'menus' );          //Register Navigations     add_action( 'init', 'my_custom_menus' );     function my_custom_menus() {         register_nav_menus(             array(                 'primary-menu' => __( 'Primary Menu' ),                 'neighborhood-menu' => __( 'Neighborhood Menu' ),                 'place-menu' => __( 'Place Menu' )             )         );     }          // Widget Function     function create_widget( $name, $id, $description ) {              $args = array(           'name'          => __( $name ),           'id'            => $id,           'description'   => $description,           'before_widget' => '
',           'after_widget'  => '
',           'before_title'  => '',           'after_title'   => ''         );              register_sidebar( $args );     }          create_widget( 'First Icon', 'first_icon', 'Displays as the first icon' );     create_widget( 'Second Icon', 'second_icon', 'Displays as the second icon' );     create_widget( 'Third Icon', 'third_icon', 'Displays as the third icon' );     create_widget( 'Fourth Icon', 'fourth_icon', 'Displays as the fourth icon' );          // Background Color               function color_header_bg() {         global $post;         // set this to the handle of one of your stylesheets         $handle = '/css/style.css';         // set this to the meta key you've used         $meta_key = 'background_color';         $bg_color = get_post_meta( $post->ID, $meta_key, $single = true );         $css = "header { background-color: $bg_color; }";         wp_add_inline_style( $handle, $css );     }          add_action(  'wp_enqueue_scripts', 'color_header_bg' );          // // Added Parent meta box in Places custom post type, created parent/child relationship neighborhood and places     // add_action( 'add_meta_boxes_place', 'my_add_meta_boxes' );          // function my_add_meta_boxes( $post ) {          //   add_meta_box(     //     'place-parent',     //     __( 'Parent', 'example' ),     //     'my_parent_meta_box',     //     $post->post_type,     //     'side',     //     'core'     //   );     // }          // function my_parent_meta_box( $post ) {          //   $parents = get_posts( array( 'post_type' => 'neighborhood', 'numberposts' => -1 ) );          //   if ( !empty( $parents ) ) {          //     echo '<select name="parent_id">';          //     foreach ( $parents as $parent ) {     //       printf( '<option value="%s"%s>%s</option>', esc_attr( $parent->ID ), selected( $parent->ID, $post->post_parent, false ), esc_html( $parent->post_title ) );     //     }          //     echo '</select>';     //   }     // }     function when_rewrite_rules( $wp_rewrite ) {       $newrules = array();            $new_rules['place/(.*)/(.*)$'] = 'index.php?place=$matches[2]';         $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;         //echo '
'; print_r($wp_rewrite->rules);die;     }     add_filter('generate_rewrite_rules','when_rewrite_rules');     ?>      ![enter image description here](http://i.stack.imgur.com/9o2cQ.png)


Custom page Template and Script as a Plugin

I want to Build a custom Page Template. But as far as I know we should not at all touch Core PHP files. let say our Custom Page template is custom.php, then where will this custom.php sit I mean in which folder in wordpress or it will go some where in the inner directories of theme? Because Finally while creating a new page it should be available as drop down in WordPress admin.


How do I save metadata for a specific custom post type only?

I'm trying to set up a custom post type following this tutorial. However, I'm a bit confused as how/where to implement `update_post_meta()`. The tutorial suggests this pattern:               add_action('save_post', 'save_my_metadata');          function save_my_metadata()     {         global $post;         update_post_meta($post->ID, 'my_metadata', $_POST['my_metadata']);     }      Which does work, but has the unfortunate effect of adding that metadata to each and every post, whether it belongs to this custom type or not. I've put the above in `functions.php` and am guessing that might be part of the problem. I'm guessing I need to restrict the 'save_post' action to only trigger for posts of my custom type.


get parameter from url rewrite

I have a problem : Example : `http://domain/hotel` Now I set value: `http://domain/hotel/?tour=hawaii` How i can get value of variable "tour".


Trigger a function during onload

I recently added Javascript and CSS files into the wordpress. All the files are being registered through `functions.php`. One of the files is `my_worldmap.js` as shown below               $(function() {         $('#world-map').vectorMap();     });      The issue here, the above function is called as soon as I visit the homepage. My expectation that the code is only called when I visit `www.mydomain.com/global-network`. How can I do this in WordPress ?


WP Function still having effect after being deleted

I wanted to hide the add to cart buttons in Woocommerce so I created a custom plugin and added the following code to it:               function remove_loop_button(){     remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );     remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );     }     add_action('init','remove_loop_button');      It worked, but I changed my mind so I deleted the code from the plugin file and yet the buttons are still gone. Since then I have deleted the custom plugin, deleted and reinstalled woo commerce plugin, deleted and reinstalled my theme and restarted my server. Nothing has worked. Is there some kind of Wordpress cache for functions? Any ideas?


How to give capability (publish contributors posts) to author role?

I am not a PHP programmer, just a simple WordPress user.   * How can I allow author role to allow publication of contributors posts?   * What's the technical name for this?


Confusion on WP Nonce usage in my Plugin

I created a small plugin where users can set multiple featured image by clicking `Add New` link from the meta box and remove them as well. The user can use `Set featured image` link to select featured image from media library. The `Add New` link clones (using javascript) previous meta box (with appropriate filters) to create a new meta box whereas the remove button removes the meta box. ![Metabox snapshot](http://i.stack.imgur.com/4nfHp.jpg) **Problem and Questions**   1. I am currently using only single nonce field for every meta box generated. Many previous threads suggest that new nonce field should be added for every meta box. How can i create different nonce field if the box is being cloned using javascript? Should i use AJAX? or is it even necessary to use nonce field in this case as user can only select image from media library?   2. The hidden input field in meta box is used as an array (see the html for meta box) and is saved using `update_post_meta`. If the nonce field is added for every dynamically added meta box how can i check it while saving the post? `if ( !wp_verify_nonce( noncefields..., plugin_basename(__FILE__) ) ) { return; }` The html for the meta box looks like this.               <?php wp_nonce_field( plugin_basename(__FILE__), 'dfi_fimageplug'); //this is generated only once for all meta box ?>     <?php _e('Set featured image', 'ap_dfi_dynamic-featured-image') ?>
           <img src="<?php if( !empty($featuredImgTrimmed) ) echo site_url() . $featuredImgTrimmed ?>" class='dfiImg <?php if( is_null($featuredImgTrimmed) ) echo 'dfiImgEmpty' ?>'/>
         <a href="javascript:void(0)" data-id='<?php echo $featuredId ?>' class='dfiAddNew'><?php _e('Add New', 'ap_dfi_dynamic-featured-image') ?>      <?php _e('Remove', 'ap_dfi_dynamic-featured-image') ?>

     <input type='hidden' name="dfiFeatured[]" value="<?php echo $featuredImg ?>" />      I am not very experienced in plugin development and am really confused on this matter. Please suggest.


Different logo on homepage

I have uploaded a file as my main logo within the theme settings but would like a different logo on the main page. The theme I am using has a custom css option within the theme settings, can I use custom css to only change it on the front page and not the rest of the site? Theme: http://demo.ghostpool.com/?theme=bounce-bp


Best approach to fetch data from wp options to js file or php file

I am creating my first ever plugin, as I am not a programmer, I have been following tutorials and reading the codex, etc. My plugin consist in showing a notice to users when certain conditions are met, I have written it in jQuery and placed it in a js file which is enqueued by the plugin along with styles. I have followed a tutorial that simply ads a settings page and a form with a simple text box to save data in the wp options table, I tested and it worked, the data was stored successfully. How do I now transfer the data from the wp options to my js file, the line where the notice is display is;               jQuery('.notice_container').wrap(<'div id="custom_notice">Hello World....
')      Thank you for your time.


Update to older wordpress version from admin?

I have a Wordpress 2.7.x setup that I would like to migrate to the latest version 3.2.1, however I need to make a stepped-upgrade as some plugins need an older version first (3.0.6 IIRC). However Wordpress is only offering me the latest and greatest version to upgrade to. Is there a way - prefereably within the admin - to update core to a specific version? Or am I bound to manual upgrades? Is there probably a way to tell the wordpress core upgrader which version to pick? It was downloading a zip only recently, right?