title: Sql syntax error

text: Sometimes in my error log i have this error: > >     You have an error in your SQL syntax; >     check the manual that corresponds to your MySQL server version for the > right syntax to >     use near '' at line 1   >         SELECT * >         FROM c_posts >         WHERE id = , >         do_action('wp_ajax_inline-save'), >         call_user_func_array, >         wp_ajax_inline_save, >         edit_post, >         wp_update_post, >         wp_insert_post, >         wp_transition_post_status, >         do_action('transition_post_status'), >         call_user_func_array, >         apt_check_required_transition, >         apt_publish_post, >         W3_Db->query >   How to fix this ? I think error in this plugin. It is piece of code :               /**       * Function to check whether scheduled post is being published. If so, apt_publish_post should be called.       *       * @param $new_status       * @param $old_status       * @param $post       * @return void       */      function apt_check_required_transition($new_status='', $old_status='', $post='') {     global $post_ID; // Using the post id from global reference since it is not available       in $post object. Strange!          if ('publish' == $new_status) {         apt_publish_post($post_ID);     }      }           /**      * Function to save first image in post as post thumbmail.      */      function apt_publish_post($post_id)       {     global $wpdb;          // First check whether Post Thumbnail is already set for this post.     if (get_post_meta($post_id, '_thumbnail_id', true) || get_post_meta($post_id, 'skip_post_thumb', true)) {         return;     }          $post = $wpdb->get_results("SELECT * FROM {$wpdb->posts} WHERE id = $post_id");          // Initialize variable used to store list of matched images as per provided regular expression     $matches = array();          // Get all images from post's body     preg_match_all('/<\s*img [^\>]*src\s*=\s*[\""\']?([^\""\'>]*)/i', $post[0]->post_content, $matches);          if (count($matches)) {         foreach ($matches[0] as $key => $image) {             /**              * If the image is from wordpress's own media gallery, then it appends the thumbmail id to a css class.              * Look for this id in the IMG tag.              */             preg_match('/wp-image-([\d]*)/i', $image, $thumb_id);             $thumb_id = $thumb_id[1];                  // If thumb id is not found, try to look for the image in DB. Thanks to "Erwin Vrolijk" for providing this code.             if (!$thumb_id) {                 $image = substr($image, strpos($image, '"')+1);                 $result = $wpdb->get_results("SELECT ID FROM {$wpdb->posts} WHERE guid = '".$image."'");                 $thumb_id = $result[0]->ID;             }                  // Ok. Still no id found. Some other way used to insert the image in post. Now we must fetch the image from URL and do the needful.             if (!$thumb_id) {                 $thumb_id = apt_generate_post_thumb($matches, $key, $post[0]->post_content, $post_id);             }                  // If we succeed in generating thumg, let's update post meta             if ($thumb_id) {                 update_post_meta( $post_id, '_thumbnail_id', $thumb_id );                 break;             }         }     }      }// end apt_publish_post()


title: Replace shortcode with output in database?

text:
For example, say I created a shortcode called `[sourcecode]` using the Shortcode API function, which is used to share code in posts like so:               [sourcecode]     #button {         font-weight: bold;         border: 2px solid #fff;     }     [/sourcecode]      (And it wraps the code in `<pre><code>` tags, takes care of escaping special characters, etc.) Then say, after a while I decide to use Markdown (and no longer want to use the `[sourcecode]` shortcode or have its function in my functions.php) or switch to a new blogging platform. Given the case, I'd like to have all instances of `[sourcecode] .... [/sourcecode]` in all posts replaced with their respective output. For example, if one of the posts has this:               [sourcecode]     #button {         font-weight: bold;         border: 2px solid #fff;     }     [/sourcecode]      It'd be replaced with and saved to database as:
#button {         font-weight: bold;         border: 2px solid #fff;     }
      Similarly, this should happen in all posts that have the `[sourcecode]` shortcode. Does wordpress have any such regenerate function built-in, or is there a plugin that does what I am after?


title: Using AJAX in WordPress Widget

text: The past few days I've been Googling and searching for answers to no avail. I'm building out a "Featured Content" widget where the user can easily (via ajax/jquery) search for posts. Is it possible to use AJAX/jQuery strictly in the Widget area, or would this type of application have to be plugin-based?


title: How to add an extra field in a post and show it on the template

text: I'm extremely new to WP. I want to add an extra field to the Post interface and show the content on a template. I don't want to show the content of the Post, but just the content in the extra field. Basically what I'm trying to achieve is design a Customer Testimonial page on my website where I show the full testimonial using the extra field, and show the post content as the mini testimonial if you get what Im saying. Please let me know if I need to clarify more. Thanks heaps. I tried custom fields in WP, but not sure how to grab the extra content only. is there a plug out there for this?


title: Two Navigation Menus - secondary nav is including main nav

text: Two Navigation Menus in Themes Produce the same menus? reference the subject on page link above. i created two navs, yet the secondary nav includes all pages. the main nav is fine, but the secondary nav is including the main nav pages as well. the two menus contain only the pages i want per nav (appearance > menus). any suggestions? it is my own theme built from 2010. it is located here > http://journeymaninc.ca/ at a loss at this point. thanks kindly Neil


title: Create page template with some static contents

text: I am new to wordpress. I searched > page vs post and found that pages are mostly static contents (in the sense that they dont need to be changed and stays in its place for ever). My question is my site consists of lets say 20 pages. They are sorted into 4 categories so each category has 5 pages. I want to create one template for each category, the only difference would be the right side bar would contain some static links to the pages in the same category. Is there any easy way of doing it?


title: The same slug in multiple taxonomies

text: We have a project that uses several custom taxonomies, and we're finding that the client wants to add the same term in several of them. While the first slug for Foo may be `foo`, subsequent copies of Foo in different taxonomies become `foo-2`. It would be nicer if the two terms could both use the same slug. It would be less confusing, and allow for nicer URLs like `search?tax=foo` rather than `search?tax=foo-2`. I notice that the `wp_terms` and `wp_term_taxonomy` table are separate, leading me to believe that it's technically possible for the same term (Foo with the slug `foo`) to appear in more than one taxonomy. But this option isn't exposed in the user interface. Is there a good reason for this? Would I be risking future brokenness by fiddling with the database like that?


title: get_the_term_list() wanting to loop through the returned values

text: I have a custom post type, I am echoing out my custom taxonomies in my template by doing the following, `get_the_term_list( get_the_ID(), 'work', '<li>', "", '</li>')` , this currently returns "Design", what I am wanting to do, is the following, for the first value that it is found I want to do the following, `<li><a href="the taxonomies link"> Find out more about Taxonomy Name</a></li>` for the second value (if there is a 2nd) I would like the do the following `<li><a href="the taxonomies link">How Taxonomy Name can benefit you</a></li>` Basically how ever many taxonomies there I only want to show 2 and I want to be able to use them as above? Is this even possible?


title: How do I store get_sidebar in a varaible?

text: > **Possible Duplicate:**   >  how do I get_sidebar into a varaible? I found how do I get_sidebar into a varaible? but the goal was different than mine, so the answers don't apply. I want to get a sidebar and save it into a variable so that I can create an if/elseif statement that will print the correct sidebar depending on my conditional criteria. For example, I currently have something like this...               if ( is_page(1) ) {         $sidebar = get_sidebar('wine');     } elseif ( is_page(2) ) {         $sidebar = get_sidebar('cheese');     } elseif ( is_page(3) ) {         $sidebar = get_sidebar('whatever');     } else {         $sidebar = get_sidebar('primary');     }      I'm not actually using **is_page** in my conditional statements and I am setting more than just the **$sidebar** variable, but you get the idea. Further down in the code I want to do this...               echo $sidebar;      The sidebars I am working with are not all dynamic, but some are. So, is there a function besides **get_sidebar()** that I can use? * * * UPDATE = ANSWER Oh, why did I hit enter? The answer left by goldenapples on the question I linked to (above) did do exactly what I wanted. When I first read it I misunderstood what output buffering did, so I didn't think it applied. My bad.


title: How long to keep old domain for 301 redirects after moving WordPress?

text: I'm looking into moving my WordPress blog from an old domain to another domain that I own. The old domain is getting expensive at $25/year and I have to renew in a month. I had the old domain for 15 years but it no longer serves it's purpose as a standalone blog. I have several options for handling this:   1. Leave it as is and keep paying the renewal registration.   2. I can do the move right now and let the registration expire next month.   3. Make the move and renew for another year before letting the registration expire. How long do I need to keep the old domain up for the 301 redirects to be effective before I let the registration expire?


title: Load template for specific subdomain

text: I'd like to be able to set a wordpress theme for certain subdomains, but still load the same content for all installations. For example, I have www.domain.com that loads the default template with default content. I'd also like to have mobile.domain.com, that too loads the same content but a separate template. What would be the best way to go about this?


title: Strip the + symbol from the_search_query

text: When using the_search_query to display search result on my site, the spaces between words are displayed with a **+** symbol. So if a visitor searches for "wordpress plugins" the_search_query output in search.php returns                   wordpress+plugins      How can I remove the + symbol, and/or replace it with non-break space entity, like so .....                   wordpress plugins         or         wordpress plugins      I tried this approach but it is not working .....                   <?php              $string = the_search_query();             $res = preg_replace("/[^a-zA-Z]/", "", $string);             echo $res;         ?>


title: add_action 'manage_posts_custom_column' in a class

text: I think this may be more of a general php question but I am posting it here as it relates to a WP function. I am having some issues with an `add_action` on `manage_posts_custom_column` inside a class. Here is the code (stripped a little):               class The_class{              function __construct() {             $this->add_actions();         }              function add_actions() {             add_action('admin_notices', array($this, 'admin_notices'));             add_action('manage_posts_custom_column', array($this, 'manage_post_columns', 10, 2));         }              function admin_notices() {         // Works fine         }              function manage_post_columns($column_name, $post_id)             switch ($column_name) {                 case 'xxxyyzz':                     // The code                                                  break;                       default:                     // Error                 break;             }            }     }      The error I am getting is `Warning: call_user_func_array() expects parameter 1 to be a valid callback, array must have exactly two members in xxx/wp- includes/plugin.php on line 405`. Looking deeper I found that the action `manage_posts_custom_column` is referenced in the `WP_Posts_List_Table` class that extends `WP_List_Table` and I wonder if this is the cause of the error? How do I get around this? **Edit:** Well for starters I could write the action properly!!! Instead of `add_action('manage_posts_custom_column', array($this, 'manage_post_columns', 10, 2));` it should be `add_action('manage_posts_custom_column', array($this, 'manage_post_columns'), 10, 2);`. Note the position of the `)`. :-)


title: how to show posts that are missing a meta_value

text: How can I build a query to find posts that DO NOT contain a certain meta key or meta value? for example:               query_posts( array(          'meta_query' => array(             array( 'key' => 'feature', 'value' => '_wp_zero_value', 'compare' => '!=' )         )     ) );


How to query posts from single post format on Genesis framework? I want to just show posts from **gallery post** format only. I tried this query:               <?php      $recent = new WP_Query(         "taxonomy=post-format&field=slug&terms=post_format-link&posts_per_page=5"     );      while($recent->have_posts()) :      $recent->the_post();     ?>      But I didn’t get what I wanted.


title: Nginx + Redirection Plugin breaks Permalinks

text: I'm migrating from Apache to Nginx. Everything works great, except if I have the Redirection plugin enabled. In this case, I can't access any of the pages on my site with the exception of the home page. They all return a 404 error. If I disable the plugin again, I'm able to navigate my site normally. My Nginx config is as follows:               upstream php      {         server 127.0.0.1:9000;     }              server         {             listen  80;              root    /home/clearpointccs/public;             server_name www.clearpointcreditcounselingsolutions.org clearpointcreditcounselingsolutions.org;             index    index.php;                  location /              {                    index       index.php;                  try_files $uri $uri/ /index.php;             }                          location ~\.php$             {                    include             /etc/nginx/fastcgi_params;                 fastcgi_param       SCRIPT_FILENAME     $document_root$fastcgi_script_name;                 fastcgi_pass        php;                  fastcgi_index       index.php;             }            }      I've tried to look into this, but everything else I read says the plugin is compatible with Nginx, which makes me believe it's something in my config. Any ideas? EDIT: A peek at the error logs shows the following:                14 2012/06/29 21:36:48 [error] 17279#0: *703 FastCGI sent in stderr: "ould not be called statically, assuming $this from incompatible context in /home/clearpointccs/public/wp-content/plugins/re    direction/models/match.php on line 68      15 PHP Strict Standards:  Non-static method Red_Action::create() should not be called statically, assuming $this from incompatible context in /home/clearpointccs/public/wp-content/plugins/redir    ection/models/redirect.php on line 46      16 PHP Strict Standards:  Non-static method Red_Action::available() should not be called statically, assuming $this from incompatible context in /home/clearpointccs/public/wp-content/plugins/re    direction/models/action.php on line 20" while reading response header from upstream, client: 96.228.60.10, server: www.clearpointcreditcounselingsolutions.org, request: "GET /about-us/ HTTP/    1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.clearpointcreditcounselingsolutions.org", referrer: "http://www.clearpointcreditcounselingsolutions.org/"


title: Locking one blog of many in a multi user/blog Wordpress installation

text: I have a multi user /wordpress installation that is working fine. One of the blogs running on that multi user /wordpress installation will never be updated again but I want it there for historic reasons. Is it possible to make one blog read-only even though it is on a multi user /wordpress installation and sharing a database with the other blogs? **Edit**   To make it clear; I want to freeze the entire blog including contents and users. I have implemented the suggestions given for the blog I am currently asking about since it only has 1 user, but I wish not having to delete users at a later time on other blogs i administer since then their names and timestamps would disappear from the site which is not what I want. Cheers.


title: Building advanced search form with option post or category

text: I want to give my browsers a bit more options on my search form. In my search from, there is radio buttons optioning with "Game" or "The rest of the site". If he/she chooses "Game", it search posts in the "Game" category. Or if he/she chooses "The rest of the site", it search posts/pages in the site except posts in the "Game" category. How do I do it? Cheers.


title: Display an archives name

text:
I want to display the current archives name, so for the url below I could do something like this
<?php echo "answer" ?>
      which would output something like this
News
      or better yet
News: supplierName
      http://www.site.com/suppliers/news/?supplierstax=supplierName


title: Get closest page ID from URL

text: Lets say on my WordPress website I navigate to: > www.example.com/media-centre/news/17/an-example-news-post In this case I am looking at a post in a CPT called `News`. What I want to do is get the page ID thats closest to that URL. I know the closest page ID can be found at: > www.example.com/media-centre/news/ So how do I loop back over my URL to find the closest page and then how do I get the ID of that page?


title: Get how many days since last post of the current user

text: How do I get how long since current user's last published post? For example:               It has been <?php echo $days_since_last_post; ?> days since your last post      I need to use that number in a variable for a plugin I am developing. I’m looking for a solution with performance in mind.


title: setting website with ww

text: I have a project and i want to make a replica of my website, and copy over to ww.abc.com , its a wordpress site, does ww is a domain or what? should i use any plugin? Can i make a master/slave database? if i want? One database will be used by all four, www.abc.org, ww.abc.org, www.abc.info and ww.abc.info for Comments and Comment Related Data only. Setup the database for www.abc.org as the master database and comments and comment related data should update on the others from there. Comments will be places on www.abc.org and those need to be pushed out to the other sites.


title: Wordpress Dashboard Characters Messed Up

text: I recently added a new post, and afterwards, many of the text lines on the wordpress dashboard appear messed up, almost as if they are protecting from a security breach or something. ![enter image description here](http://i.stack.imgur.com/B6T4v.png) I have tried disabling all plugins, emptying the cache, using a different browser, but none of these seem to work. I am developing locally too, not sure if that has any bearing. Many thanks for any help in advance


title: Nginx Multisite redirects (incorrectly) on Chrome IE and Mobile, but works (correctly) on Firefox

text: I'm having an issue that I can't find anybody else talking about anywhere. I have a wordpress multisite setup utilizing sub-directories. It's running on Debian Squeeze, and it's powered by nginx, php 5.4, and php5-fpm. Currently I am using the batcache plugin and the advanced apc caching plugin from mark jaquith. **The Bad:** So, the problem I'm having is that when I access the site with either IE, Chrome or by mobile, it always redirects back to the root site. The only time it doesn't is when accessing wp-admin. **The Good:** The whole setup works perfect on firefox. I have ran some `curl -I` passes on the site to get the header info. Here are the results: http://pastebin.com/VryGXAAY **What I've Tried:** I have cleared the browser cache. Tried it on a different machine. And yelled at it a lot. **Here is a copy of the config files:** sites-enabled/example.com: http://pastebin.com/69xsMuwb globals/mu-dir.conf: http://pastebin.com/CSup1q1h globals/mu-files.conf:               # Rules for any Multisite install     # For uploads     if ( $uri ~ "files" ) {         rewrite ^/(?:.*/)?files/(.+) /wp-includes/ms-files.php?file=$1;     }      globals/restrictions.conf: http://pastebin.com/rhrr5Qkf globals/common-locations.conf: http://pastebin.com/GiYBRP1y Let me know what other info you might need. Any help would be appreciated! :)


title: Panoramica Theme Portfolio

text: I am using panoramica theme for my WordPress website. I want to show the portfolio with category "Meet the team" along with other post category in one page. How can it be possible. Now I am able to show the post of a specific category in one page.I need to add Posrtfolio page to this. below is the code I used to show the post of a specific category in one page.               <?php     /*      Template Name: Custom Template     */     ?>     <?php get_header();              $recent = new WP_Query("cat=4&posts_per_page=5");          while($recent->have_posts()):$recent->the_post();               the_content();               endwhile;                get_footer();     ?>


title: Show content based on width?

text: Is it possible to show content based on width of page/screen? I would like to show part of the header and footer only when the paged is shown in full width and then have it go away when used on smaller screen/mobile/pad. The best thing would be able to use a responsive theme and have areas above and below that only shows when using "full screen" = 1000px. * * * [FIXED AREA SHOWN ONLY WHEN WIDTH IS 1000+ PX] Responsive theme [FIXED AREA SHOWN ONLY WHEN WIDTH IS 1000+ PX] * * * Best regards, Mikael


title: Show all parts in multipage post

text: You can do a multipage post by using the `<!--nextpage-->` inside the post. The question is: How can I display the whole post (not paged) for this post.


title: Can anyone see a syntax error in this?

text: My hosting at wp-engine wont allow me to upload this file by git because of a syntax error. Can anybody see what the error is?               <?php     $aryWPMUConfig = get_site_option('wpmu-piwik_global-settings',false);     if (is_plugin_active_for_network('wp-piwik/wp-piwik.php') && $aryWPMUConfig) {     foreach ($aryWPMUConfig as $key => $value) {         self::$settings->setGlobalOption($key, $value);     }     delete_site_option('wpmu-piwik_global-settings');     self::$settings->setGlobalOption('auto_site_config', true);     } else {     self::$settings->setGlobalOption('auto_site_config', false);     }     self::$settings->setGlobalOption('dashboard_seo' = false);     self::$settings->setGlobalOption('stats_seo', false);     self::$settings->setGlobalOption('track_404', self::$settings->getOption('track_404'));     self::$settings->setGlobalOption('track_compress', false);     self::$settings->setGlobalOption('track_post', false);      This is update/90001.php from wp-piwik


title: How to rename wp-includes folder?

text: Is there a way that we could rename wp-includes folder I have found out there are ways to do for other folders. But how do we do it for wp-includes folder? http://pythoughts.com/how-to-hide-that-you-use- wordpress/


title: Javascript/jquery loads super slow (around 6 seconds) which affects only homepage

text: I got a custom wordpress theme from a developer but he isn't responding to me anymore. Basically my homepage takes ages to load which causes all the elements on the homepage not function until the javascript loads. I believe the problem lies within this script which is found in the `functions.php` file, I'm running wordpress 3.5. Can anyone spot some glaring issues, please help a lost soul.               function theme_init_theme() {         # Enqueue jQuery         wp_enqueue_script('jquery');              if (is_admin()) { /* Front end scripts and styles won't be included in admin area */             wp_enqueue_style('theme-custom-admin', get_bloginfo('stylesheet_directory') . '/css/admin.css', array(), '1.0');             return;         }         # Enqueue Custom Scripts         # @wp_enqueue_script attributes -- id, location, dependancies, version         //wp_enqueue_script('custom-script', get_bloginfo('stylesheet_directory') . '/js/custom-script.js', array('jquery'), '1.0');         wp_enqueue_script('jquery-flexslider', get_bloginfo('stylesheet_directory') . '/js/jquery.flexslider-min.js', array('jquery'));         wp_enqueue_script('jquery-cookie', get_bloginfo('stylesheet_directory') . '/js/jquery.cookie.js', array('jquery'));         wp_enqueue_script('jquery-colorbox', get_bloginfo('stylesheet_directory') . '/js/jquery.colorbox-min.js', array('jquery'), '1.0');         wp_enqueue_script('jquery-functions', get_bloginfo('stylesheet_directory') . '/js/functions.js', array('jquery', 'jquery-flexslider', 'jquery-cookie'));         wp_enqueue_style('googlefont-open-sans', 'http://fonts.googleapis.com/css?family=Open+Sans:400,800italic,800,700italic,700,600italic,600,400italic,300italic,300');         wp_enqueue_style('googlefont-merriweather', 'http://fonts.googleapis.com/css?family=Merriweather:400,900,700,300');         wp_enqueue_style('colorbox', get_bloginfo('stylesheet_directory') . '/css/colorbox.css', array(), '1.0', 'all');     }     add_action('init', 'theme_init_theme');     add_action('after_setup_theme', 'theme_setup_theme');


title: very last action before during user registration before he is redirected to homepage

text: I'm using wordpress social login plugin. So some of my users register via facebook. I'm trying to hook myself to user_register and display only once upon registration and upon using facebook as source some special message. Wordpress social login plugin creates meta_key Facebook if user registered via facebook. So I created this little script:               //save referral information passed from cookie: referral_user     add_action('user_register', 'register_referral');          function register_referral($user_id) {        $userdata = array();        $userdata['ID'] = $user_id;        wp_update_user ($userdata);                   //IF user there is appropriate user_meta field.         $user_origin = get_user_meta($user_id,'Facebook',true);              if ($user_origin) {           {echo 'registered via faceboook, hurey!';}         } //master if     }      Problem is `$user_origin` is never evaluated true, because when this IF statement is run `meta_value Facebook` is not Yet created! I tested it by putting break; before and checking DB for this field. So, my question is this, is there a way to move my action to be the last action upon registration of user. So that first Facebook is created by social login plugin, and than I can evaluate and run my scripts. Thanks@! Edit: Plugin doesn't use user_register hook. Greped "add_action" and got:               Sandros-MacBook-Air:plugins sandro$ grep -ir "add_action" wordpress-social-login/*     wordpress-social-login/includes/plugin.auth.php:add_action( 'init', 'wsl_process_login' );     wordpress-social-login/includes/plugin.init.php:    add_action( 'admin_init', 'wsl_register_setting' );     wordpress-social-login/includes/plugin.init.php:add_action('admin_menu', 'wsl_admin_menu' );      wordpress-social-login/includes/plugin.init.php:add_action('admin_menu', 'wsl_admin_menu_sidebar');     wordpress-social-login/includes/plugin.ui.php:add_action( 'login_form', 'wsl_render_login_form_login' );     wordpress-social-login/includes/plugin.ui.php:add_action( 'register_form', 'wsl_render_login_form_login' );     wordpress-social-login/includes/plugin.ui.php:add_action( 'after_signup_form', 'wsl_render_login_form_login' );     wordpress-social-login/includes/plugin.ui.php:add_action( 'wordpress_social_login', 'wsl_render_login_form_login' );     wordpress-social-login/includes/plugin.ui.php:add_action( 'comment_form_top', 'wsl_render_comment_form' );     wordpress-social-login/includes/plugin.ui.php:add_action( 'login_head', 'wsl_add_javascripts' );     wordpress-social-login/includes/plugin.ui.php:add_action( 'wp_head', 'wsl_add_javascripts' );     wordpress-social-login/includes/plugin.ui.php:add_action( 'login_head', 'wsl_add_stylesheets' );     wordpress-social-login/includes/plugin.ui.php:add_action( 'wp_head', 'wsl_add_stylesheets' );


title: woocommerce product in multiple categories navigation

text: I wonder if someone has an answer to this or could point me in the right direction I have a woocommerce product which resides in multiple categories like so                           /**the product categories structure is something like this**/                  (id 1)  cat-a                  (id 2)     -subcat-a-1                  (id 3)         -subcat-a-1-1                  (id 4)         -subcat-a-1-2 (product in this category)                  (id 5)         -subcat-a-1-3                  (id 6)     -subcat-a-2                  (id 7)         -subcat-a-2-1                  (id 8)         -subcat-a-2-2                  (id 9)         -subcat-a-2-3                  (id 10)        -subcat-a-3                  (id 11) cat-b                  (id 12)    -subcat-b-1                  (id 13)    -subcat-b-2                  (id 14)    -subcat-b-3                  (id 15)        -subcat-b-3-1 (same product in this category too)                  (id 16)        -subcat-b-3-2                  (id 17)        -subcat-b-3-3                          (id 18) cat-c                 .......and so forth......      i also have the woocommerce navigation menu on the product category as well as single product page. when i go to a category like                           http://www.domain.com/categories/cat-a/subcat-a-1/subcat-a-1-2       the right products gets shown and the navigation selects/shows the right subcategory. so far so good. however, when then going to a product the naviagtion on the single product page always selects the same category , regardless of where we came from so to speak. I realise that the links to products on category pages do not include the category we were coming from, so I i added the following to "archive- product.php"                           /**get currently selected category, so we can                      add cat id to product link to select appropriate                      side nav cat when selected                 **/                 global $wp_query,$msci_cat_obj;                 $msci_cat_obj = $wp_query->get_queried_object();      and this to "content-product.php"                           global $msci_cat_obj;                 /**                     some more stuff                 */                      /*changing link to add category id to url**/                 <a href="<?php the_permalink(); ?><?php echo $msci_cat_obj->term_id; ?>" title="<?php the_title() ?>">                 /**                     even more stuff                 **/      which now gives me a url to the product like so                           http://www.domain.com/product/example-product/4/                 and                 http://www.domain.com/product/example-product/15/      respectively depending on which (sub)category I am in. obviously , when now going to the respective product page by using aforementioned links i can explode (or whatever) the url to just get the category id I came from. What I do _not_ know (and have tried from days to figure out ) is how to use this id to persuade the navigation to set this category to be selected in the navigation on the single product page and not always the same one. Any hints/suggestions/links much appreciated.


title: Can I connect a page to a taxonomy?

text: I'm creating a website for a soccer club. It has news, reports and media custom post types. There you can connect the post to the Team taxonomy. But I also need to have a page for that team where I can add info, team photo etc. Can I connect a page to a certain taxonomy? For example I got a page called "Team 1" and connect that to the taxonomy term "Team 1"? If not what is the best option?


title: Woocommerce pagination problem

text:
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


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

text: 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!


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

text: 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!


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

text: 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?**


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

text: 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.


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

text: 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?


title: Copy a file from a plugin into my theme directory

text: 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


title: Slideshow missing when page loads?

text: 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.


title: Taxonomy archive link from term id

text: 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      ?>


title: How can I insert a disclaimer in a Wordpress site?

text: 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


title: Create a post from every image in my media gallery

text: 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!!


title: How-to Change Content with location change?

text: 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


title: custom post type parsed as attachment

text: 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');


title: Videos in posts are not rendered

text: 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?


title: Display default WordPress login/registration form into a modal window

text: 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!


title: What is the best way to store custom variables

text: 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 ?


title: Corrupted .GIF thumbnails from featured image

text: 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).


title: Thumbnail is corrupt but image is good

text: 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?


title: How can I paginate a list of related posts?

text: 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.


title: Creating /blog subsite on WP multisite network

text: 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?


title: Can WordPress store comment cookies on two different computers?

text: 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


title: Direct some posts to only appear on a specific page

text: 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.


title: Custom permalink structure only for default posts

text: 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.


title: Dictionary-style definition list plugin

text: 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?


title: Taxonomy order exception for specific term

text: 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?


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

text: 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?


title: Read more content not displayed loops back to blog page

text: 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 .


title: Javascript alert appears before <!DOCTYPE> tag

text: 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.


title: Wordpress Login Box horizontal at the top.

text: 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?


title: Animated Gif image not uploading correctly

text: 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?


title: Category ID is appearing

text: 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


title: wp enqueue style and style sheet depth

text: 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.


title: Change featured thumbnail based on screen size

text: 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.


title: get_children - wp_get_attachment_image

text: 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');         }     }


title: Creating Theme Options Page

text:
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          ?>


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

text:
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;          ?>


title: Slider with pop-up

text: 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 !


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

text: 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.


title: Display multiple "save draft button" on a post edit

text: 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


title: Wordpress is converting & to & inbetween [code] brackets

text: 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.


title: Use meta box drag and drop to order items independently

text: 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


title: Link to file in plugin directory from wordpress template?

text: 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??


title: Wordpress pagination URL posts not load

text:
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);


title: Setup proper 301 redirect for deleted tags

text: 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.


title: Contact Form 7 Plugin emails not being received by some accounts

text: 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?


title: Issues with set cookie

text: 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.


title: Menu_order for WooCommerce set all with value 0 to 999999999999

text: 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


title: Wordpress Website Featured Image Replacement Issue

text: 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.


title: How do I filter posts by taxomony using AJAX

text: 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?


title: Where is stored the Publish date value for a post?

text: 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


title: Combining custom taxonomy posts with default posts on one archive page

text:
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; ?>


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

text: 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"


title: Facebook like button not reading correct og: meta content

text: 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!


title: How to output data from meta box with cloned fields?

text:
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.


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

text: 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. :)


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

text:
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));     }?>


title: Display different category template if custom field is checked

text: 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


title: Most recent post from another database

text:
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; ?>


title: Custom Wordpress Does Not Display Anything But Background in IE

text: 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


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

text: 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**?