Single install or multisite?

I'm at a bit of an impasse trying to satisfy this client's requirements. Long story short, they would like an overall site that certain people can access and modify, plus a blog with a completely different look and feel. Their current site was just redesigned, and it is what I'll be primarily porting to WordPress. They also have a WordPress blog sitting at /blog running an outdated WP with a Kubrick-based theme - they would like to keep that theme/styling. Here's the issues:   * They want to manage it all from a single backend   * They want the blog with the different look and feel to reside on /blog for the links that are already out there (multisite won't allow this).   * The blog pages should all be consistent - categories, single posts, archives, etc   * Search should return results from both site and blog So basically, I'm wondering if this is feasible from a single install with conditional statements and theming, or if a multisite is necessary (and all the hassles that come with it). Normally I would just go multisite because of the separate theming, but since the blog that has the separate theme needs to sit on /blog, that won't work (easily). Any ideas?


Open portfolio image in light box

I am creating a website using chamber theme. This is the portfolio of my site like this. Now I want to open these portfolio images in lightbox, but I didn't find where to be change in the code. My `portfolio.php` is               session_start();          if (!isset($hide_header) OR !$hide_header) {         get_header();     }          if (isset($_SESSION['pp_portfolio_style'])) {         $pp_portfolio_style = $_SESSION['pp_portfolio_style'];     }     else {         $pp_portfolio_style = get_option('pp_portfolio_style');     }          if (empty($pp_portfolio_style)) {         $pp_portfolio_style = '2';     }          include(TEMPLATEPATH."/templates/template-portfolio-".$pp_portfolio_style.".php");


Creating a 3-column layout on a Wordpress Page

At the moment I am creating a page with Wordpress. Now there is some content, that won't chance often, that's why I want to use a page for it. I also want to create a custom template for that page. You see, nothing special. On that page, I want a 3-column layout, meaning 3 different blocks of text positioned with normal HTML. Now the problem is, when I use a normal page in Wordpress, there is only one text area in the admin area which basically means that I can't have 3 different blocks of texts accessible through the admin area. How do I realize this without hardcoding the text into the HTML? Of course I could write it as a plugin, but that seems a bit over the top for me. I hope you understand my problem, it's hard to explain for me, I am sorry.


WordPress Automatic Testing Probelm

After much trial and error. I've managed to get the automatic testing setup and running. I'm running a test on a plugin that has no code. It's just the plugin header. Just to make sure everything is working with the phpunit tests. It's on a brand new multipress install and there is no data besides the default data that comes with a fresh WordPress install. The problem I'm having is even though there's nothing that should cause a failed test, but I'm getting a bunch of fails. The notes on the fails all seem to have the same problem. The test are looking for database tables that don't exists. The test are looking for the tables "wptests_65_terms" and "wptests_65_posts". Should I just manually create these tables? That doesn't really makes sense though, because from what I understand the test drops all the tables during the test.


Sub-loop / nested loops Best Practices

I'm trying sort through the morass that is WP documentation, and just need someone to clear up the use of the term "The Loop" and how it relates to subloops. My understanding of "The Loop" is that there is, and should only ever be, ONE "The Loop" per page/post - and that The Loop is responsible for iterating through that page/post/archive's content. In particular the_post() will populate a number of global variables with the relevant data extracted from the current position of the query in the main Loop. I also believe I understand that whenever creating a sub-loop (say you want to get a list of all child posts of each post listed in a category archive), you should use a new instance of the WP_Query object, as in: $subQuery = new WP_Query($args); Where I run into confusion with the Codex docs is in the documentation of Wp_Query, specifically $subQuery->have_posts() and $subQuery->the_post(). The documentation lists "to be used when in The Loop" for both of those methods, implying (to me) that they manipulate global variables that would affect The (outer) Loop. Is this the case? Or is $subQuery->have_posts() safe to use (ie: read only)? What about ->the_post()? Does it affect The Loop globals? What's the best practice for iterating through elements of a nested sub-loop that will not interfere with The Loop?


Determine if page is the Posts Page

On the **Reading Settings** page you can set a "Front Page" and a "Posts Page". You can check whether the current page `is_front_page();` Is there a similar function for the "Posts Page". I have noticed that `is_page();` does not work for this special page. Thanks


How do I convert all custom_field php timestamps in the database to js timestamps?

For the past year, we've been storing date-time values into a custom field `_date` using strtotime(). There are about 100 PHP date-time stamps in our database from over the past year. I would really like to use a jQuery datepicker for this custom field - to make it more user friendly. However, the datepicker stores date values differently. Even if I use UNIX time, it adds "000" to the end. This creates problems on the front-end retrieving the data and sorting through it accurately. From what I can see, I have two basic options.   1. Convert all current `_date` values to JS values   2. Write my code on the front end to account for both JS and PHP values. I'm using the Advanced Custom Fields datepicker. I think the cleanest way to do this would be to update the existing values in the database to JS time- stamps. Is there an easy way to do this? I don't really feel like manually updating > 100 dates. All values in this custom_field are currently like this:   * `1375820168` (php in seconds) I need them to be like this:   * `1375820168000` (js in milliseconds) Or this:   * `20130706` (js yymmdd)


Change jQuery(document).ready to $.delegate in wordpress

I am trying to change:               add_action('wp_footer','myscript_in_footer');     function myscript_in_footer(){     ?>     <script type="text/javascript">       jQuery(document).ready(function(){        jQuery("div.domTip_tipBody").mouseover(function(){        jQuery("#yyy a.tippy_link").css("background-color","yellow");});               jQuery("div.domTip_tipBody").mouseout(function(){        jQuery("#yyy a.tippy_link").css("background-color","red");      });       });        </script>     <?php     }      To               add_action('wp_footer','myscript_in_footer');     function myscript_in_footer(){     ?>     <script type="text/javascript">       function(){         $.delegate('p','mouseover', function(e){          jQuery("#yyy a.tippy_link").css("background-color","yellow");});              $.delegate('p','mouseout', function(e){         jQuery("#yyy a.tippy_link").css("background-color","red");      });       });        </script>     <?php     }      The first one works but the second one dose not. The reason for the change is that I have elements that are output by a shortcode (e.g "div.domTip_tipBody") that the first function is not reading and it was suggested that the second method might work, but I can not get the second method functioning even with the element 'p'. Thanks Tim


Should I use custom post types or a custom database tables for plugin development?

I'm fairly new to writing wordpress plugins, but I've jumped in the deep end already and I want to make sure I'm doing it "right" on my upcoming big project. I'm going to be heavily extending wordpress into a pretty big web app and want to keep my data structures as native as possible to rely on the wordpress framework, but I don't know if it is better to create my own custom database tables or try to make use of custom post types. I don't know all my data yet, but there will be a number of tables (or cpts) relationally linked. I get the "vibe" from my research that I should avoid custom database tables, but I'm not sure how to determine the best solution. Specifically I'm concerned about three areas:   * the number of post metafields I'll need for my extra fields per cpt if I go that route, and if that will make things "tricky"   * how well I can get back queries using semi complex relational filters for reports   * how to best manage relationships, especially if I have many to many relationships Is there a "right" way? Thanks for your input.


Force [wordpress_social_login] shortcode to display where it is embedded

The WordPress Social Login plugin contains a `[wordpress_social_login]` shortcode that can be used in posts and pages. The problem is, no matter where I place it in the body of the post, it always renders as the very first thing on the page. I am using the Salient theme and I have been looking through one of the plugin functions called `wsl_render_login_form()` which seems to render it but it isn't obvious how it is placing it on the page first. How can you make the shortcode render where you actually place it? Seems like this should be the default but it is annoyingly not the case.


How to have multiple URLs working on the same wordpress site

how do I run the SAME site (content+database) with different domains? domains: 123example.com exampleabc.info As far as I know: If i point both domains to my server and configure nginx to use both domains for /var/www/123example.com/ it will show the same wordpress homepage no matter if I visit 123example.com or exampleabc.info I can only set one URL in wordpress. So if I set 123example.com as home-url in wordpress settings then every link will be 123example.com/?page_id=x , even though if I'm visiting the site over exampleabc.info. How do i configure wordpress that if I visit exampleabc.info it shows all URLs with exampleabc.info/ ; and if I visit 123example.com all URLs are 123example.com/ ? I want the same content and database (=the whole site) be accessible by 2 different domains. If it makes any difference: I'm using nginx.


Custom post types category

I have created a theme with a custom post type called 'project' and there is a problem. I want to show 5 different custom post type categories on a page in different portions, like posts to show on pages from their respective categories. Is there any solution? This is my custom post type code with custom taxonomy                <?php         /**          * Registers a custom post type.          */         function Project_post_type()         {             register_post_type(                 'Project',                 array(         'labels'               => array(         'name'                => __('Project', 'text_domain'),         'singular_name'       => __('Project', 'text_domain'),         'menu_name'           => __('Project', 'text_domain'),         'name_admin_bar'      => __('Project Item', 'text_domain'),         'all_items'           => __('All Items', 'text_domain'),         'add_new'             => _x('Add New', 'prefix_portfolio', 'text_domain'),         'add_new_item'        => __('Add New Item', 'text_domain'),         'edit_item'           => __('Edit Item', 'text_domain'),         'view_item'           => __('View Item', 'text_domain'),         'search_items'        => __('Search Items', 'text_domain'),         'not_found'           => __('No items found.', 'text_domain'),         'not_found_in_trash'  => __('No items found in Trash.', 'text_domain'),         'parent_item_colon'   => __('Parent Items:', 'text_domain'),                     ),         'public'     => true,         'menu_position'  => 5,         'supports'    => array(                         'title',                         'editor',                         'thumbnail',                         'excerpt',                         'custom-fields',                     ),         'taxonomies'   => array(                         'Project_categories',                     ),              'menu_icon'   => get_template_directory_uri() . '/img/project-icon.png',         'has_archive' => true,         'query_var'  => true,         'rewrite' => array(         'slug'    => 'Project',         ),         )        );         }              add_action('init', 'Project_post_type');                   /**          * Registers a custom taxonomy.          */         function Project_taxonomy()         {             register_taxonomy(                 'Project_categories',                 array(                     'Project',                 ),         array(         'labels'               => array(         'name'                => _x('Categories', 'prefix_portfolio', 'text_domain'),         'singular_name'       => _x('Category', 'prefix_portfolio', 'text_domain'),         'menu_name'           => __('Categories', 'text_domain'),         'all_items'           => __('All Categories', 'text_domain'),         'edit_item'           => __('Edit Category', 'text_domain'),         'view_item'           => __('View Category', 'text_domain'),         'update_item'         => __('Update Category', 'text_domain'),         'add_new_item'        => __('Add New Category', 'text_domain'),         'new_item_name'       => __('New Category Name', 'text_domain'),         'parent_item'         => __('Parent Category', 'text_domain'),          'parent_item_colon'   => __('Parent Category:', 'text_domain'),         'search_items'        => __('Search Categories', 'text_domain'),                     ),         'show_admin_column'    => true,         'hierarchical'   => true,        'rewrite'   => array(       'slug'    => 'portfolio/category',      ),     )     );     }          add_action('init', 'Project_taxonomy', 0);          function theme_prefix_rewrite_flush() {     flush_rewrite_rules();     }     add_action( 'after_switch_theme', 'theme_prefix_rewrite_flush' );      Here is my code to display one category               $args = array(     'post_type' => 'project',     'posts_per_page' => 200,      'cat' => 'Initiatieffase'         );     $loop = new WP_Query($args); while ($loop->have_posts()) : $loop->the_post();     echo '
' . the_post_thumbnail() . '
';     endwhile;     wp_reset_query();      **EDIT** This is my new post type function               <?php     // Register Custom Post Type     function project_post_type() {              $labels = array(             'name'                => _x( 'Projects', 'Post Type General Name', 'text_domain' ),             'singular_name'       => _x( 'Project', 'Post Type Singular Name', 'text_domain' ),             'menu_name'           => __( 'Project', 'text_domain' ),             'parent_item_colon'   => __( 'Parent Item:', 'text_domain' ),             'all_items'           => __( 'All Items', 'text_domain' ),             'view_item'           => __( 'View Item', 'text_domain' ),             'add_new_item'        => __( 'Add New Item', 'text_domain' ),             'add_new'             => __( 'Add New', 'text_domain' ),             'edit_item'           => __( 'Edit Item', 'text_domain' ),             'update_item'         => __( 'Update Item', 'text_domain' ),             'search_items'        => __( 'Search Item', 'text_domain' ),             'not_found'           => __( 'Not found', 'text_domain' ),             'not_found_in_trash'  => __( 'Not found in Trash', 'text_domain' ),         );         $args = array(             'label'               => __( 'project_post_type', 'text_domain' ),             'description'         => __( 'Project Description', 'text_domain' ),             'labels'              => $labels,             'supports'            => array( 'title', 'editor', 'thumbnail', ),             'taxonomies'          => array( 'category', 'post_tag' ),             'hierarchical'        => false,             'public'              => true,             'show_ui'             => true,             'show_in_menu'        => true,             'show_in_nav_menus'   => true,             'show_in_admin_bar'   => true,             'menu_icon' => get_template_directory_uri() . '/img/project-icon.png',             'menu_position'       => 5,             'can_export'          => true,             'has_archive'         => true,             'exclude_from_search' => false,             'publicly_queryable'  => true,             'capability_type'     => 'post',         );         register_post_type( 'project_post_type', $args );          }          // Hook into the 'init' action     add_action( 'init', 'project_post_type', 0 );               // Register Custom Taxonomy     function project_taxonomy() {              $labels = array(             'name'                       => _x( 'Projects', 'Taxonomy General Name', 'text_domain' ),             'singular_name'              => _x( 'Project', 'Taxonomy Singular Name', 'text_domain' ),             'menu_name'                  => __( 'Project', 'text_domain' ),             'all_items'                  => __( 'All Items', 'text_domain' ),             'parent_item'                => __( 'Parent Item', 'text_domain' ),             'parent_item_colon'          => __( 'Parent Item:', 'text_domain' ),             'new_item_name'              => __( 'New Item Name', 'text_domain' ),             'add_new_item'               => __( 'Add New Item', 'text_domain' ),             'edit_item'                  => __( 'Edit Item', 'text_domain' ),             'update_item'                => __( 'Update Item', 'text_domain' ),             'separate_items_with_commas' => __( 'Separate items with commas', 'text_domain' ),             'search_items'               => __( 'Search Items', 'text_domain' ),             'add_or_remove_items'        => __( 'Add or remove items', 'text_domain' ),             'choose_from_most_used'      => __( 'Choose from the most used items', 'text_domain' ),             'not_found'                  => __( 'Not Found', 'text_domain' ),         );         $args = array(             'labels'                     => $labels,             'hierarchical'               => false,             'public'                     => true,             'show_ui'                    => true,             'show_admin_column'          => true,             'show_in_nav_menus'          => true,             'show_tagcloud'              => true,         );         register_taxonomy( 'project', array( 'post' ), $args );          }          // Hook into the 'init' action     add_action( 'init', 'project_taxonomy', 0 );               function theme_prefix_rewrite_flush() {     flush_rewrite_rules();     }     add_action( 'after_switch_theme', 'theme_prefix_rewrite_flush' );      and this is template function               <?php       $args = array(       'post_type' => 'project',        'tax_query' => array(         array(         'taxonomy' => 'Initiatieffase',          'field' => 'slug',           'terms' => 'bob'            )          )       );     $query = new WP_Query( $args );     $loop = new WP_Query($args);     while ($loop->have_posts()) : $loop->the_post(); ?>
      <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?>
     <?php endwhile; ?>     <?php wp_reset_postdata(); ?>      but its still showing nothing * * * This is my new post type function               <?php     // Register Custom Post Type     function project_post_type() {              $labels = array(             'name'                => _x( 'Projects', 'Post Type General Name', 'text_domain' ),             'singular_name'       => _x( 'Project', 'Post Type Singular Name', 'text_domain' ),             'menu_name'           => __( 'Project', 'text_domain' ),             'parent_item_colon'   => __( 'Parent Item:', 'text_domain' ),             'all_items'           => __( 'All Items', 'text_domain' ),             'view_item'           => __( 'View Item', 'text_domain' ),             'add_new_item'        => __( 'Add New Item', 'text_domain' ),             'add_new'             => __( 'Add New', 'text_domain' ),             'edit_item'           => __( 'Edit Item', 'text_domain' ),             'update_item'         => __( 'Update Item', 'text_domain' ),             'search_items'        => __( 'Search Item', 'text_domain' ),             'not_found'           => __( 'Not found', 'text_domain' ),             'not_found_in_trash'  => __( 'Not found in Trash', 'text_domain' ),         );         $args = array(             'label'               => __( 'project_post_type', 'text_domain' ),             'description'         => __( 'Project Description', 'text_domain' ),             'labels'              => $labels,             'supports'            => array( 'title', 'editor', 'thumbnail', ),             'taxonomies'          => array( 'category', 'post_tag' ),             'hierarchical'        => false,             'public'              => true,             'show_ui'             => true,             'show_in_menu'        => true,             'show_in_nav_menus'   => true,             'show_in_admin_bar'   => true,             'menu_icon' => get_template_directory_uri() . '/img/project-icon.png',             'menu_position'       => 5,             'can_export'          => true,             'has_archive'         => true,             'exclude_from_search' => false,             'publicly_queryable'  => true,             'capability_type'     => 'post',         );         register_post_type( 'project_post_type', $args );          }          // Hook into the 'init' action     add_action( 'init', 'project_post_type', 0 );               // Register Custom Taxonomy     function project_taxonomy() {              $labels = array(             'name'                       => _x( 'Projects', 'Taxonomy General Name', 'text_domain' ),             'singular_name'              => _x( 'Project', 'Taxonomy Singular Name', 'text_domain' ),             'menu_name'                  => __( 'Project', 'text_domain' ),             'all_items'                  => __( 'All Items', 'text_domain' ),             'parent_item'                => __( 'Parent Item', 'text_domain' ),             'parent_item_colon'          => __( 'Parent Item:', 'text_domain' ),             'new_item_name'              => __( 'New Item Name', 'text_domain' ),             'add_new_item'               => __( 'Add New Item', 'text_domain' ),             'edit_item'                  => __( 'Edit Item', 'text_domain' ),             'update_item'                => __( 'Update Item', 'text_domain' ),             'separate_items_with_commas' => __( 'Separate items with commas', 'text_domain' ),             'search_items'               => __( 'Search Items', 'text_domain' ),             'add_or_remove_items'        => __( 'Add or remove items', 'text_domain' ),             'choose_from_most_used'      => __( 'Choose from the most used items', 'text_domain' ),             'not_found'                  => __( 'Not Found', 'text_domain' ),         );         $args = array(             'labels'                     => $labels,             'hierarchical'               => false,             'public'                     => true,             'show_ui'                    => true,             'show_admin_column'          => true,             'show_in_nav_menus'          => true,             'show_tagcloud'              => true,         );         register_taxonomy( 'project', array( 'post' ), $args );          }          // Hook into the 'init' action     add_action( 'init', 'project_taxonomy', 0 );               function theme_prefix_rewrite_flush() {     flush_rewrite_rules();     }     add_action( 'after_switch_theme', 'theme_prefix_rewrite_flush' );      and this is template function               <?php       $args = array(       'post_type' => 'project',        'tax_query' => array(         array(         'taxonomy' => 'Initiatieffase',          'field' => 'slug',           'terms' => 'bob'            )          )       );     $query = new WP_Query( $args );     $loop = new WP_Query($args);     while ($loop->have_posts()) : $loop->the_post(); ?>
      <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?>
     <?php endwhile; ?>     <?php wp_reset_postdata(); ?>      but its still showing nothing


Check in which custom taxonomy belongs and change the style

I want to change the css style of a single.php which belongs to a custom taxonomy, based on the category. I achieved to do it in taxonomy.php for some of the categories but i can't make it to work on a single.php. For the taxonomy.php i used `is_tax` and worked ok. For single.php i used `has_term` but nothing. What am i doing wrong? Both of the files full code are here and here thank you Here is the taxonomy.php which everything worked great.               <?php get_header(); ?>     <div class="non-home-parallax product-listing-parallax" style="     <?php if( is_tax ('product-cat', 'fama-advance') ) { ?>      background-image:url('<?php echo get_template_directory_uri(); ?>/img/parallax/advance.jpg');      <?php }      elseif ( is_tax ('product-cat', 'fama-premium') ) { ?>       background-image:url('<?php echo get_template_directory_uri(); ?>/img/parallax/premium.jpg');      <?php }      elseif ( is_tax ('product-cat', 'fama-confectionary-solutions') ) { ?>       background-image:url('<?php echo get_template_directory_uri(); ?>/img/parallax/confectionary.jpg');      <?php }     elseif ( is_tax ('product-cat', 'fama-powder-solutions') ) { ?>       background-image:url('<?php echo get_template_directory_uri(); ?>/img/parallax/powder.jpg');      <?php }      elseif ( is_tax ('product-cat', 'fama-improvers') ) { ?>       background-image:url('<?php echo get_template_directory_uri(); ?>/img/parallax/improvers.jpg');      <?php }      elseif ( is_tax ('product-cat', 'fama-chocoday-creams') ) { ?>       background-image:url('<?php echo get_template_directory_uri(); ?>/img/parallax/chocodaycreams.jpg');      <?php }      elseif ( is_tax ('product-cat', 'fama-choco-day') ) { ?>       background-image:url('<?php echo get_template_directory_uri(); ?>/img/parallax/chocoday.jpg');      <?php }      elseif ( is_tax ('product-cat', 'fama-deliciozo') ) { ?>       background-image:url('<?php echo get_template_directory_uri(); ?>/img/parallax/deliciozo.jpg');      <?php }      elseif ( is_tax ('product-cat', 'fama-frutopia') ) { ?>       background-image:url('<?php echo get_template_directory_uri(); ?>/img/parallax/frutopia.jpg');      <?php }      elseif ( is_tax ('product-cat', 'fama-fruigel') ) { ?>       background-image:url('<?php echo get_template_directory_uri(); ?>/img/parallax/fruigel.jpg');      <?php }      elseif ( is_tax ('product-cat', 'fama-creams') ) { ?>       background-image:url('<?php echo get_template_directory_uri(); ?>/img/parallax/creams.jpg');      <?php }       elseif ( is_tax ('product-cat', 'fama-ice') ) { ?>       background-image:url('<?php echo get_template_directory_uri(); ?>/img/parallax/ice.jpg');      <?php }       else { ?> <?php } ?> ">

                         <h4 style="                         <?php if( is_tax ('product-cat', 'fama-advance') ) { ?>                          background-color: #ff9900;                          <?php }                          elseif ( is_tax ('product-cat', 'fama-premium') ) { ?>                          background-color: #004A93;                          <?php }                          elseif ( is_tax ('product-cat', 'fama-confectionary-solutions') ) { ?>                          background-color: #E7C388;                                             <?php }                         elseif ( is_tax ('product-cat', 'fama-powder-solutions') ) { ?>                          background-color: #FFED3D;                                             <?php }                          elseif ( is_tax ('product-cat', 'fama-improvers') ) { ?>                          background-color: #FDBA2F;                                             <?php }                          elseif ( is_tax ('product-cat', 'fama-chocoday-creams') ) { ?>                          background-color: #693A18;                                             <?php }                          elseif ( is_tax ('product-cat', 'fama-choco-day') ) { ?>                          background-color: #3B210D;                                             <?php }                          elseif ( is_tax ('product-cat', 'fama-deliciozo') ) { ?>                          background-color: #DB0070;                                             <?php }                          elseif ( is_tax ('product-cat', 'fama-frutopia') ) { ?>                          background-color: #98005D;                                             <?php }                          elseif ( is_tax ('product-cat', 'fama-fruigel') ) { ?>                          background-color: #BB001C;                                             <?php }                          elseif ( is_tax ('product-cat', 'fama-creams') ) { ?>                          background-color: #96C031;                                             <?php }                           elseif ( is_tax ('product-cat', 'fama-ice') ) { ?>                          background-color: #9FDAF1;                                             <?php }                           else { ?> <?php } ?> ">                         <?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); echo $term->name; ?>

      And here is some code of the single.php               <?php get_header(); ?>     <div class="non-home-parallax product-listing-parallax" style="     <?php if( has_term ('fama-advance', 'product-cat') ) { ?>      background-image:url('<?php echo get_template_directory_uri(); ?>/img/parallax/advance.jpg');      <?php }      elseif ( has_term ('fama-confectionary-solutions', 'product-cat') ) { ?>       background-image:url('<?php echo get_template_directory_uri(); ?>/img/parallax/premium.jpg');      <?php }      elseif ( has_term ('fama-premium', 'product-cat') ) { ?>       background-image:url('<?php echo get_template_directory_uri(); ?>/img/parallax/confectionary.jpg');      <?php }      else { ?> <?php } ?> ">


Plugin update not reflected in Wordpress plugin page

I've created a plugin and added it to WP plugins repository. Later, I've seen few mistakes on `readme.txt` file. So I've fixed it and commited the changes:               svn add --force trunk/readme.txt     svn ci -m 'Fix readme.txt'      Then, the changes have been reflected on WP plugin page. I've done a few more changes on the same file and commited them again, but the last change is not updated on the WP plugin page. As you can see here, the SVN repository has the last update, but it is not reflected on WP plugin page (look at "Description"). Here is shown the last update ("Fix 4 readme.txt"). As it is my first WP plugin, I'm not sure if I just have to wait some more, or there is something wrong on my last update.


How can I remove menu items from "my sites" on a multi-site network?

I have a multi-network site, and so there's a menu in the WP Admin Bar that says "My Sites," and contains a list of the user's sites. I'd like to remove the root site from this list. I thought it'd be as easy as:               function my_remove_commons_link_from_my_sites() {             global $wp_admin_bar;             if (!is_admin() && !is_super_admin()) {                     _log("Removing this crazy business.");                     $wp_admin_bar->remove_node('blog-1');                     _log($wp_admin_bar->get_nodes());             }          }     add_action( 'admin_bar_menu', 'my_remove_commons_link_from_my_sites', 9999 );      (Where `_log` is just a function I have to write stuff to the log file.) I notice that in the log file, the list of nodes is missing `blog-1`, so it looks like this function successfully removed the node. Yet it is still there in the final display. Is something else creating this menu item, after I've removed it? How can I remove this menu item?


Make an array listing custom taxonomy

I am trying to populate an array with a list of categories in a custom taxonomy I created. The taxonomy, called _clips_ , has a slug called _clipcat_. I only want the array to populate with children of a clip with the same slug as the page slug the list is on. Here's my code so far:                  <?php              global $post;             $slug = get_post( $post )->post_name;             $taxes = array('clipcat');             $args = array(                 'parent' => $slug,             );              $categories = get_terms( $taxes, $args );             print_r($categories);        ?>      To my knowledge, the code is as it should be, but when I print the array (the last line in the code), the array is empty even though I know the clip category that is successfully assigned to `$slug` has three sub categories (so I must be coding something wrong). Any suggestions to what I'm doing wrong?


1 post per category on homepage and counting those posts

What I'm trying to do on my homepage is to pull the latest post from each of 6 categories but then I need the variable $counter to increase (+1) for each post so that I can style them properly. I've managed to display the latest post from each category in the right order, but by doing that I can't get $counter to work properly. Any help would be greatly appreciated - thanks!               <?php get_header(); ?>
                  <?php                   if (get_option('woo_show_carousel') == 'true' AND !is_paged()) { include (TEMPLATEPATH . "/includes/featured.php");}             ?>                  <?php              if (is_paged()) $is_paged = true;                  if (get_option('woo_slider_exclude') == "true") $shownslides = get_option('woo_shown_slides');             if(empty($showslides) || get_option('woo_show_carousel') == 'false'){                 $showslides = array();             }                     $showvideo = get_option('woo_show_video');              $vidtags = get_option('woo_video_tags');              if(!empty($vidtags)) {                 $vidtags_array = explode(',',$vidtags);              } else {                  $vidtags_array = array();              }                   global $wpdb;              foreach ($vidtags_array as $tag_name){                  $tag_name = trim($tag_name);                  $tagid = $wpdb->get_var("SELECT term_ID FROM $wpdb->terms WHERE name='$tag_name'");                  $tagids[] = $tagid;                }                              $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;                       $taxonomy = 'category';//  e.g. post_tag, category         $param_type = 'category__in'; //  e.g. tag__in, category__in         $term_args=array(              'include' => '3,4,5,6,11,14',              'orderby' => 'ID',              'order' => 'ASC'             );                 $terms = get_terms($taxonomy,$term_args);         if ($terms) {         foreach( $terms as $term ) {                 $args = array(                         "$param_type" => array($term->term_id),                 'post_type' => 'post',                 'post_status' => 'publish',                 'posts_per_page' => 1,                 'caller_get_posts'=> 1,                     'post__not_in' => $shownslides,                     'tag__not_in' => $tagids,                     'paged'=> $paged                     );              query_posts($args);                        $home_content = get_option('woo_home_content');              $home_boxes = get_option('woo_home_boxes');                   if (have_posts()) :                    $full = FALSE;                   $width = get_option('woo_full_thumb_width');              $height = get_option('woo_full_thumb_height');                   if( $home_boxes == 'On') { $small = TRUE; }              elseif ($home_boxes == 'Off') { $full = TRUE; }               else {  $large_posts = intval($home_boxes); }                   $counter = 0;               while (have_posts()) : the_post();                  $counter++;                 $post_class = 'full';                  if( ($counter > $large_posts OR $small == TRUE) AND $full ==  FALSE)                 {                     $width = get_option('woo_boxed_thumb_width');                     $height = get_option('woo_boxed_thumb_height');                     if( $small == FALSE ) $counter = 1;                     $small = true;                         if ($counter%2 == 0 ) { $post_class = 'fr';  }                          else { $post_class = 'fl'; }                 }                   ?>              <div class="post-outer post <?php echo $post_class; ?>">
                                 <?php woo_get_image('image',$width,$height); ?>
<a title="<?php _e('Permalink to ',woothemes); ?><?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?>

<?php the_category(', ') ?>
                               <?php if ($home_content == 'false') { ?>
<?php echo strip_tags(get_the_excerpt(), ''); ?>
                          <?php } else { ?>                         <?php the_content(__('Continue Reading',woothemes)); ?>                                          <?php } ?>

                      <?php if ($counter%2 == 0 AND $small == TRUE ) { echo '

'; } ?>                  <?php endwhile; ?>             <?php endif;              }             }             wp_reset_query();              ?>
                 <?php if (function_exists('wp_pagenavi')) wp_pagenavi(); else { ?>
<?php previous_posts_link(__('« Newer Entries ',woothemes)) ?>

<?php next_posts_link(__(' Older Entries »',woothemes)) ?>

                 <?php } ?>

                       <?php                  if (get_option('woo_show_video') == 'true') { include (TEMPLATEPATH . "/includes/video.php");}             ?>                  <?php                  if (get_option('woo_show_talking_points') == 'true') { include (TEMPLATEPATH . "/includes/talking-points.php");}             ?>


How to change the standard navigation menu color when using genesis

I need to change the font color for a wordpress menu. I'm currently using genesis as my parent theme & putting all of the css changes for it in a child theme. I would like to change the font color of my primary navigation menu, where do I put these changes in wordpress? In the child theme style.css or at Appearance > Menus ?


How to get the first term for the current taxonomy?

I'm using the following code to display the term for a specified taxonomy:               $terms = get_terms( "book_review" );     $category = $terms[0]->name;      However I want to display the term for whatever the currently displayed taxonomy is, rather than specifying a particular taxonomy. Basically what I'm wanting is a way to replicate the functionality of get_the_category, but for the current taxonomy instead of the current category. I'm trying to display this on a single custom post type page (single-custom_post_type_name.php)


Multiple domains and caching

this is my dilemma I have one blog which delivers both SFW and NSFW content. I'm trying to run a SFW version of it. For that, I have set up another domain, which leads the user to the same place as the primary domain. Let's say:   * domain.com - the full content website   * domainsfw.com - leads to domain.com I'm trying to make it so, when a user accesses domainsfw.com it will only show posts taged with the SFW tag. I was able to do this by checking and changing $args before query_posts. BUT, there are two issues: 1 - This won't change the website's internal links. Which means when the user accesses domainsfw.com, the content will be filtered, but, as soon as he navigates, the links will point to domain.com, which will show all the content again. I had solved this by using a plugin, but it stopped working and is not supported any longer. 2 - More importantly, caching won't work properly with this. It seems WP Super Cache gets pretty confused while caching multiple domains, which means user's won't see the website being properly updated. Would you guys suggest any solution? Thanks!


Is this a plug-in in wordpress  or a custom JavaScript

On the www.valendesigns.com website I like the JavaScript (I think that's what it is) near the top of the page where when you click on one of the three images, it rotates to the front. Does anyone know if this is a plug-in? If so do you know where I can get it? If it is not a plug-in, does anyone know where I can learn how to do this? Thanks


Possible to turn off autosave for single custom post type

So I'm having an issue with my custom fields in my custom post type. For whatever reason the fields save and then clear somewhat randomly... I'm sure it's not random but I'm not sure what's triggering this to happen. Here's the code for my custom post type:                   // Custom Post Type: Strategic Giving     add_action('init', 'giving_register');          function giving_register() {            $labels = array(         'name' => _x('Invest Items', 'post type general name'),         'singular_name' => _x('Item', 'post type singular name'),         'add_new' => _x('Add New', 'giving item'),         'add_new_item' => __('Add New Item'),         'edit_item' => __('Edit Item'),         'new_item' => __('New Item'),         'view_item' => __('View Item'),         'search_items' => __('Search Items'),         'not_found' =>  __('Nothing found'),         'not_found_in_trash' => __('Nothing found in Trash'),         'parent_item_colon' => ''         );            $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'query_var' => true,         'menu_icon' => get_stylesheet_directory_uri() . '/images/cpt-giving.png',         'rewrite' => array( 'slug' => 'giving_items' ),         'capability_type' => 'post',         'hierarchical' => true,         'menu_position' => null,         'supports' => array('title','thumbnail','editor'),         'paged' => false,         );             register_post_type( 'givings' , $args );     }          register_post_type( 'givings' , $args );          add_action("admin_init", "giving_admin_init");          function giving_admin_init(){       add_meta_box("giving_info-meta", "Item Options", "giving_info", "givings", "side", "high");     }          function giving_info(){       global $post;       $custom = get_post_custom($post->ID);       $amount = $custom["amount"][0];       $monthly = $custom["monthly"][0];       $user_entered_value = $custom["user_entered_value"][0];       $item_name = $custom["item_name"][0];       $special = $custom["special"][0];       ?>

           Amount:             <input style="width: 180px" type="text" name="amount" id="amount" value="<?php echo $amount; ?>" />           Example: 30.00

           Monthly?             <?php if ($monthly == 'on') { ?>             <input type="checkbox" name="monthly" id="monthly" checked="checked" />           <?php } else { ?>             <input type="checkbox" name="monthly" id="monthly" />           <?php } ?>

           Special Item?             <?php if ($special == 'on') { ?>             <input type="checkbox" name="special" id="special" checked="checked" />           <?php } else { ?>             <input type="checkbox" name="special" id="special" />           <?php } ?>

           Allow Giver To Enter Custom Value?             <?php if ($user_entered_value == 'on') { ?>             <input type="checkbox" name="user_entered_value" id="user_entered_value" checked="checked" />           <?php } else { ?>             <input type="checkbox" name="user_entered_value" id="user_entered_value" />           <?php } ?>

           Item Name:                         <input style="width: 180px" type="text" name="item_name" id="item_name" value="<?php echo $item_name; ?>" />
           If item is a per item then enter the name of the singular item. Example: Chair - which will be displayed as "30.00 per Chair"

           Strategic Giving photo must be horizontal and uploaded/set as the Featured Image (see below).           Do not add photo to content area.

       <?php }            add_action('save_post', 'giving_save_details_amount');     add_action('save_post', 'giving_save_details_monthly');     add_action('save_post', 'giving_save_details_user_entered_value');     add_action('save_post', 'giving_save_details_item_name');     add_action('save_post', 'giving_save_details_special');          function giving_save_details_amount(){       global $post;       update_post_meta($post->ID, "amount", $_POST["amount"]);     }          function giving_save_details_monthly(){       global $post;       update_post_meta($post->ID, "monthly", $_POST["monthly"]);     }          function giving_save_details_user_entered_value(){       global $post;       update_post_meta($post->ID, "user_entered_value", $_POST["user_entered_value"]);     }          function giving_save_details_item_name(){       global $post;       update_post_meta($post->ID, "item_name", $_POST["item_name"]);     }          function giving_save_details_special(){       global $post;       update_post_meta($post->ID, "special", $_POST["special"]);     }          add_action("manage_pages_custom_column",  "givings_custom_columns");     add_filter("manage_edit-givings_columns", "givings_edit_columns");          function givings_edit_columns($columns){       $columns = array(         "cb" => "<input type=\"checkbox\" />",         "title" => "Strategic Giving Item",         "amount" => "Amount",         "monthly" => "Monthly",         "special" => "Special Item",         "giving_image" => "Image"         );            return $columns;     }          function givings_custom_columns($column){       global $post;            switch ($column) {         case "amount":         $custom = get_post_custom();         echo $custom["amount"][0];         break;              case "monthly":         $custom = get_post_custom();         $is_monthly = $custom["monthly"][0];         if ($is_monthly == "on") {           echo "Yes";         };         break;              case "special":         $custom = get_post_custom();         $is_special = $custom["special"][0];         if ($is_special == "on") {           echo "Yes";         };         break;              case "giving_image":           echo get_the_post_thumbnail(NULL, 'staff_admin');         break;       }     }          function giving_amount(){       $custom = get_post_custom();       return $custom["amount"][0];     }          function giving_monthly(){       $custom = get_post_custom();       return $custom["monthly"][0];     }          function giving_special(){       $custom = get_post_custom();       return $custom["special"][0];     }          function giving_user_entered_value(){       $custom = get_post_custom();       return $custom["user_entered_value"][0];     }          function giving_item_name(){       $custom = get_post_custom();       return $custom["item_name"][0];     }      **Update:** So I did more research and figured it out. Autosave (aka Revisions) - Post metadata deletes itself. Is it possible to turn off autosave for just a single post type and not globally?


How to allow commentetors to get notifications on replies to their comments?

Whenever someone comments on a blog post I've written, I want to reply to him as a comment. However, I'm sure that most of the time that person doesn't see my reply, because he's only subscribed to my post feed, not my comment feed (which makes sense - he's not interested in all comments that are posted to my blog). Is there a way to help commentators be notified when someone replies to them in another comment?


Create terms when registering taxonomy?

I'm registering taxonomy in my functions.php file:               register_taxonomy("our_gallery_types", array("gallery"), array("hierarchical" => true, "label" => "Categories", "singular_label" => "Category", "rewrite" => true));      And it works perfectly. But I want also to automatically create two terms in this taxonomy, how would i do that? When you run Wordpress for the very first time and click Posts there is "Uncategorized" category. I want to do exactly the same for my taxonomy, so my users won't get confused and won't have to create categories for their own. How do i achieve that?


Child page from 2 different parent pages

currently I have 3 parent page types with multiple child pages under each. Feature * feat 1 * feat 2 .. Creative * creat 1 * creat 2 ... Info * info 1 * info 2 ... I have been successful with pulling the children page content onto the parent page, but now I want to get the children of Feature and Creative onto Creative Parent page. here is what I am using to get the child pages of Featured parent page.

     <?php     $projectpage = get_pages('child_of=14&sort_column=post_date&sort_order=desc');          $count = 0;     foreach($projectpage as $page)     {     $content = $page->post_content;     if(!$content)          continue;     if ($count == -1)     break;     $count++;          $content = apply_filters('the_content', $content);          ?>

<a href="<?php echo get_permalink($page->ID); ?>"> <?php echo get_image ("thumbnail",1,1,1,$page->ID);?>

<?php echo $page->post_title ?>

     <?php     }     ?>
      I tried to list both parent page id's in 'child_of=14,15&...' but it did not work. Thanks!


"W3 Total Cache" with "What Would Seth Godin Do" (and widgets?!)?

I would like to use "What Would Seth Godin Do" with "W3 total cache" - can that be done? Also, is there a way to use this inside widgets? (I was thinking of maybe using some sort of php widget for it - but again, what about the w3 total cache?) Thanks for any pointers and/or help! Tal


Adding custom post type to loop

Hope someone can help me with this. I have a custom post type ('article') in my WordPress installation, and I'd like to display those posts alongside the default posts in the regular post feed. This is my current loop:               <?php         if ( have_posts() ) {         while ( have_posts() ) {             the_post();             global $more;             $more = 0;              //include the post template         locate_template( array( 'includes/post-template.php' ), true, false );     }          locate_template( array( 'includes/post-pagination.php' ), true, false );          }else {     _e( 'No posts available', 'pexeto' );     }     ?>


How to arrange PHP files to allow for multiple types of pages

I am new to WordPress development (the most I've ever done on the web design/development side of things is creating basic HTML sites); so this may be an extremely simple question, but I am trying to create a multi-page site. I want 3 static pages, a Homepage, About page and Portfolio page and a Blog which is populated using the WordPress backend. Initially, I was going to just put the blog on a separate sub-domain (e.g. `blog.example.com`), however, I wish to populate a list on all the pages with a list of recent posts so I wish to keep all of them on the same domain. However, I'm not sure how to link the pages together, if I put `index.php`, `about.php`, `portfolio.php` and `blog.php` in the theme folder; the `index.php` shows as expected, however, if I create the links as follows, it doesn't work (all the `href`s are blank strings):

<a id="nav_bar" href="<?php get_home_template() ?>">Home

<a id="nav_bar" href="<?php get_query_template('about') ?>">About

<a id="nav_bar" href="<?php get_query_template('portfolio') ?>">Portfolio

<a id="nav_bar" href="<?php get_query_template('blog') ?>">Blog

      And if I direct the links to the wp-content folder, using the following syntax:               <a id="nav_bar" href="<?php bloginfo('template_url') ?>/about.php">About      The link is rendered properly, it points to the PHP files in the wp-content folder, but when navigating to that page, it cannot call the WordPress functions (i.e. `get_header()` cannot be found). What is the best way to achieve what I want to do?


Upload Excel to Wordpress Custom Post

Have a "unique" scenario to try and solve. We have a client roster that is typically sent to the dev team as an excel sheet with the appropriate information (client name, client website, category, etc). This information needs to be uploaded per custom post and then displayed in a table on the front-end. Any plugins or built-in php / wordpress things I can use to execute this?


wordpress post not showing my "<somehting>" text>?

I am trying to make a post where there is a text line : > some libraries to run which we will import by using "`#include > <filename.h>`" command. instead of outputting the text as it is. It shows as: > some libraries to run which we will import by using “#include ” command. in post so `<filename.h>` is missing for some reason. I am quite sure I am missing something here but unable to find. I think for some reason WordPress escapes anything between <> tags so how can i show them if i need to?


wp-content/db.php : where is this file?

At the top of the source file `wp-includes/wp-db.php` I can find the following comment:               /**      * WordPress Database Access Abstraction Object      *      * It is possible to replace this class with your own      * by setting the $wpdb global variable in wp-content/db.php      * file to your class. The wpdb class will still be included,      * so you can extend it or simply use your own.      I was wondering how replacing the wpdb class with a different class would work but I cannot find any file under wp-content/db.php. Is there an error in the documentation? Thanks.


Run function after post is updated

I would like to run a function after a post is saved. That function takes a .txt file thats uploaded with `Advanced Custom Field` file field, makes it into an array to then a json data. I want the json data to be saved into the database. I've read on `update_post_meta()` and I'm assuming that that's what might be the best option. I'm confused on where I would place this function. Is it in my theme's `function.php` file? Is this technically a plugin? And if so, where would it go? Thanks for the help.


Adding to he format dropdown menu tinyMCE in Wordpress

Does anyone know the steps needed to add a custom format to the blockformat (p,h1,h2,h3 etc.) dropdown in the tinyMCE editor in Wordpress? I've found a lot of different ways to do that, which seem to either contradict each other or have absolutely no effect. I've had very little interaction with Wordpress as a developer so I'm not even sure where what is located. wordpress tinymce


How do I add paragraph tags to all of my posts after relying on wpauto?

I found a way to export my posts in text form so that I can move them to a blog with static pages. The only problem is that there are no paragraph tags, so every post is a huge block of text. I had been using line breaks and relying on wpauto to add paragraph tags automatically. Is there any way to add those tags into my posts without doing it by hand?


wp-admin blank in a clean install of Wordpress on PHP 5.4

A clean install of Wordpress 3.4.2 is giving a blank screen when logging into the admin panel. This is due to the following resources not loading in Chrome:               GET /wp-admin/  /wp-admin/:32     GET /wp-admin/load-styles.php?c=0&dir=ltr&load=wp-jquery-ui-dialog&ver=3.4.2  /wp-admin/:32     GET /wp-admin/load-scripts.php?c=0&load=jquery,utils&ver=3.4.2  /wp-admin/:32     GET /wp-admin/load-styles.php?c=0&dir=ltr&load=admin-bar,wp-admin&ver=3.4.2  /wp-admin/:26     GET /wp-admin/load-scripts.php?c=0&load=admin-bar,hoverIntent,common,jquery-color,wp-ajax-response,wp-lists,quicktags,jquery-query,admin-comments,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,postbox,dashboard,thickbox,plugin-install,media-upload,word-count,jquery-ui-resizable,jquery-ui-draggable,jquery-ui-button,jquery-ui-position,jquery-ui-dialog,wpdialogs,wplink,wpdialogs-popup&ver=3.4.2  /wp-admin/:32      However, visiting these links directly returns the contents as normal. There are no entries in Apache's error log for this. I have found that if I add the following line just before `echo $out;` in **wp-admin/load-scripts.php** and **load-styles.php** , the page loads the assets correctly, aside from TinyMCE:               header('Content-Length: ' . strlen($out));      Similarly, if I add the following line to my `wp-config.php` the admin panel loads correctly (as it bypasses **load-X.php** ):               define('CONCATENATE_SCRIPTS', false);      Content does display correctly in Firefox however. **Is this a bug?** If so, is the issue already known? * * * The only oddities about my setup are that I am running PHP version `5.4.8-1~precise+1`, obtained from Ondřej's PPA, on Apache/2.2.22 (on Ubuntu). The most common suggestion seems to be that it is a problem with my configuration, rather than Wordpress - my Apache install is fairly standard, the VirtualHost for this blog configured as so:               <VirtualHost *:80>         ServerName example.com              DocumentRoot /var/www/wordpress         <Directory /var/www/wordpress>             Order allow,deny             allow from all             Options -Indexes +FollowSymLinks         </Directory>              ErrorLog /var/log/www/wordpress/error.log         LogLevel warn         CustomLog /var/log/www/wordpress/access.log combined     </VirtualHost>      The Wordpress install has no extra themes, plugins and whatnot. It is a simple download from Wordpress.org that has been configured using the installer.


Image File Names

I've been poking around the Codex in hopes of finding out how WP renames image files when you upload them... it's probably there but I can't seem to find it. It seems that if I upload 1 file, like xue.jpg, that I get many files, like: xue-123x456.jpg xue-456x789.jpg and so on. I take it that WP is making a series of different sizes for easy use in resizing or thumbnails or different displays or, haha, IDK really why WP does this, but I assume it's something like that. So FIRST QUESTION - why is WP doing this and is there a predictable format to understand what the naming is? SECOND QUESTION - I'm not certain this is the issue, but it seems that when I try to import a site using WP importer v0.6 that I get a lot of broken links which seem to be related to this naming issue. The post will call for, eg: xue-456x789.jpg but the importer didn't get that file. It DID get xue.jpg and if I manually go through the posts and delete the "-456x789" so it's calling for just "xue.jpg" then the image IS there and it does load. But this isn't practical for lots of posts. I'd like to understand better how images are being renamed on upload, and how this does or doesn't get handled if the blog is later imported to another host. TY!


Run a function when post is deleted?

Is it possible to run a function every time a post is deleted. The function has to be run when the post is deleted from the admin or by the wp_delete_post() function.


add_theme_support not outputting thumbnails

so, i wanted to thumbnails in my query and i came across `add_theme_support`, it says you have to have that to enable actions such as `thumbnail`, so i put the following in my functions               function pippin_add_thumbnail_support() {         if(!current_theme_supports('post-thumbnails')) {             add_theme_support('post-thumbnails');         }     }     add_action('init', 'pippin_add_thumbnail_support');      Even after that code, my query doesn't generate a post thumbnail, when my query is               <?php                 $posts = get_posts(array('posts_per_page' => 4));                 foreach ($posts as $post) {                     if( has_post_thumbnail()){                         get_the_post_thumbnail($post->ID,'thumbnail');                          echo $post->post_title;                     }      Am i missing something, or doing something wrong?


WP_Query breaks pagination

I've been on this problem for a week now. I've searched through countless posts that just aren't answering the question. It seems that my wp_query breaks pagination. I've looked through a lot of the post on wp_query and pagination on here but with still no joy. As far as I can see it's set up correctly. I have one instance where it will show all posts in one page, and in the other it repeats the content on each page. See the code below for a stripped down version with notes. Can anyone see what the problem is?               <?php      /*               Let's asume that this is the search query in the address bar:          ?s=media&trend=&industry=&d=2012-05-17|2012-11-17         (To iterate, it's saying search for keyword 'media'          posted between 17th May 2012 and 17th Novemer 2012)              It gives 13 results and shows all on the same page.          I have set show 10 posts per page so it should be cutting off          at first 10.               PAGINATION: On line 56 If I change the code to          $wp_query->max_num_pages, the pagination works but then          repeats the same 10 posts.           */          // Setup pagination     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;          // Sort trend taxonomy     $tr = $_GET['trend'];      // Sort industry taxonomy     $ind = $_GET['industry'];      // Set date var     $d = $_GET['d'];           $args = array(         'post_type' => 'post',          'paged' => $paged,         'posts_per_page' => 10,         'trend' => $tr,         'industry' => $ind     );       // Date range function, if available                             if( (isset($_GET['d'])) && ($_GET['d']!=='') ) {         function filter_where( $where = '' ) {             $date_range = $_GET['d'];             $date_range = explode("|", $date_range);             $that_date = $date_range[0];              $this_date = $date_range[1];                                             $where .= " AND post_date >= '".$that_date."' AND post_date <= '".$this_date."'";             return $where;         }         // Add the filter          add_filter( 'posts_where', 'filter_where' );     }             // setup the wp_query     $allsearch = new WP_Query($args);           // Remove the date filter where clause     if( (isset($_GET['d'])) && ($_GET['d']!=='') ) {         remove_filter( 'posts_where', 'filter_where' );      }          while ( $allsearch->have_posts() ) : $allsearch->the_post();          // Show the posts     endwhile;          //      if ( $allsearch->max_num_pages > 1 ) : ?>

‹ Older posts

› Newer posts

     <?php endif; ?>     <?php wp_reset_query(); ?>


List the number of posts for each custom taxonomy and specific custom field value

I would like to list my posts by a specific taxonomy. At the same time, for each taxonomy, I woud like to count the number of posts with a specific custom field value. So the list would look like this: for each: custom taxonomy name / count of posts / count of posts in this taxonomy that contains custom post field (key) with specific value All I have been able to do so far is to list custom taxonomy and the count of posts (simply by listing category or by wp database query) or to list posts with specific meta_value for meta_key. I couldn't combine both though: for the custom taxonomy list and post count:                $variable = wp_list_categories('taxonomy=organy&echo=0&show_count=1&title_li=&');     $variable = preg_replace('~\((\d+)\)(?=\s*+<)~', '$1', $variable);     echo $variable;      for the custom field's value post count:               $status_count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_value = 'fixed';");     echo '
number of posts: ' . $status_count . '
';      I figure it should be done by wpdb query. I would appreciate help from more advanced programmers... My another attempt is:               $terms = get_terms("MY_TAXONOMY_TERM");     $count = count($terms);     $meta_count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_value = 'MY_SPECIFIC_VALUE';" );          if ( $count > 0 ){     echo "
";     foreach ( $terms as $term ) {     echo "" . $term->name  ,"	 ",  $term->count . "	 ",  $meta_count, "";          }     echo "
";     }      But here what happens is the list of all the posts with a specific value (MY_SPECIFIC_VALUE).


How to make duplicatable custom metabox fields for image slider in wp?

I want make duplicatable custom metabox fields for an image slider. For example:   1. Image title field   2. image upload filed   3. add button for add another image.   4. Remove button for remove this individual image   5. Edit each images   6. Finally display this images in front page ! How to do this?


Multisite wide post type?

Is it possible to have a multisite wide post type without duplicating the posts? That is a post type that is the same no matter what blog you are on? _Theoretical example:_ StackExchange has many sites (blogs) but wants their site-wide news post type, I'll call it `sitewide_news`, to be the same on every blog. If they happen to be in blog id 4 and make a change or add a new post it will show up in 3 or 8 as if they made the change there. In other words only one database entry exists. Thanks!


How to "Custom Post Type" as a non-programmer?

I need to create a Wordpress Custorm Post Type with the following fields, I am not a developer and would appreciate a cut and paste. The Fields are: Contact Person, Address, Telephone, Cellphone, Fax, Email, Website HELP


The holy grail of Event Management Plugins?

i know similar questions have been asked before, but the answer's to them don't quite satisfy my needs, so i'm re-iterating the question: I'm looking for a modern Event Management plugin with the following criteria:   * simple, WP-like UI (Event Calendar 3 is excellent in that regard)   * uses modern WP functionality like custom post types or post meta   * Events are either posts or a custom post type or at least behave like so   * multiple days per Event (can be a single span over several days)   * Registration Management   * clickable Event List or Event Calendar Widget   * ideally, Paypal Integration   * ideally, Email Notification I've tested a few, but:   * Events Calendar 3 seems to do a lot of things right, but is too basic   * Events Manager Extended looks good, but doesn't seem to work properly with 3.1 (i get neither the map display nor a registration option to show on frontend)   * WP Events Calendar just feels ages old and overwrites my stylesheet on every update   * Event Espresso Lite looks great in terms of functionality, but the Admin Interface is horrible UI I also tested 'Events' and a few others which were either too simple or had horrible admin interfaces. Is there anything i haven't seen, yet that i should have a look at?


query_posts() ALWAYS displays something?

OK, I'm using posts_query() to display posts. The problem is, at least in my case, posts_query() always outputs something. For example:               <?php              $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;         query_posts("posts_per_page=1&paged=$paged");         global $more;         $more = 0;              while ( have_posts() ) : the_post(); ?>                          <?php endwhile ?>      Displays raw first part of a post (and without $more = 0 the whole post). Why is it happening? I want to style the output on my own, but I'm not able to, because for example:               while ( have_posts() ) : the_post(); ?>
<?php the_title();?>

<?php the_content( __( '') ); ?>
     <?php endwhile ?>      Gives:
MyTitle

something something something something something

something something something something something


No posts are being listed by <plugin-list-category-post>

I just installed the List Category Post plugin, and I've followed the directions. No posts are being listed. For example, at the end of this page, there should be a list, and it's just blank. Is the plugin working on 3.1?


How to create a page that lists custom taxonomies with links?

I want to create a page that lists all the Custom Taxonomies, with each item linking to a page that will list all the terms in a given taxonomy. I can produce a list of taxonomies using this                <?php      $args=array(       'public'   => true,       '_builtin' => false          );      $output = 'names'; // or objects     $operator = 'and'; // 'and' or 'or'     $taxonomies=get_taxonomies($args,$output,$operator);      if  ($taxonomies) {       foreach ($taxonomies  as $taxonomy ) {         echo '<p>'. $taxonomy. '</p>' ;       }     }     ?>      But of course no links. Looking at the codex there is very little information on the parameters - at least for neophyte like myself. Any suggestions on how to output a link for each custom taxonomy? Thanks


How to get the Gravityform entry ID from current user's form submission?

**Case:** When a user submits a (Gravity)form, the plugin automatically generates an unique entry ID for that specific form. In my case the form settings only allow user to submit the form once, and only if user is registered. When user submits the form, a page is created with the content of the form. The URL of that page is dynamically generated and based on the entry-ID (www.example.com/entry-ID). **Question:** After user have submitted a form, and user is loged in, I want to show a link to the page that is created by the user. Not only just after submission, but every time user is logged in again. But how to get, and display, that user's entry ID on a page if that user is logged in? I have this code on the page.php to identify the user and determine what to display:               <?php if ( is_user_logged_in() ) { ?>          <?php global $wpdb;     $user = wp_get_current_user();     $where = get_posts_by_author_sql( 'page', true, $user->ID );     $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );          if ( $count >= 1 ) { ?>     // This is what user see if form is submitted, where '{entry-ID}' should be replaced by the user's entry iD
Hey <?php echo $current_user->display_name ?>, thank you for submitting the form. Visit your page here: www.example.com/{entry-ID}
          <?php } else { ?>     // If user have not submitted a form, user is shown the info below with the form to submit
Hey <?php echo $current_user->display_name ?>, Thank you for joining. To create a page please submit the form below:
<?php echo do_shortcode('[gravityform id="2" name="just a form" title="false" description="false"]'); ?>          <?php } } else { ?>     // if user is not logged in, user is urged to log in to submit form
<Please log in to create a page <?php do_action( 'wordpress_social_login' ); ?>
          <?php } ?>      This is the function I use to make the form (ID=2) to create a 'page':               add_filter("gform_post_data", "change_post_type", 10, 2);     function change_post_type($post_data, $form){         //only change post type on form id 1         if($form["id"] != 2)            return $post_data;              $post_data["post_type"] = "page";         return $post_data;     }


Let's Create Custom Field Template Documentation

I've been using the Custom Field Template plugin for a while now, and I really like it. It's fantastic for adding quick custom field meta boxes in the wordpress back end. It handles TinyMCE, file uploads, repeating fields, date picker, etc. For really advanced stuff I do custom coding, but nothing beats rapid development with this plugin. There is only one problem with this powerful plugin: the developer is japanese and the documentation is almost non-existant. The docs on his site in english are poor, and other stuff I've found on the web is limited. The question: where is the best place for Custom Field Template documentation - especially for the more advanced features. I'm guessing that there is no place so lets begin creating the definitive source right here on wonderful Wordpress Answers. Here is what I found so far:   * Author's website (english version of Japanese)   * Multiple Fields & Groups with the WordPress Custom Field Template Plugin


Require a Custom Taxonomy to be checked

I have a custom taxonomy, "position", with multiple terms for a custom post type, "employee" in the admin. I want to validate the form to require a position to be selected when you save/update a post. How do I validate and make the position custom taxonomy a required field in the wordpress admin? Also, I'd like to display an error message to indicate to users that a position is required to be checked. Thanks!


Frontend image uploading from edit profile page. (goldenapples)

I have been following **goldenapples front end file uploads** tutorial, however i do have that working for my frontend posting page, but what i am wanting to accomplish now is to add an image from edit profile page (again this is a frontend file upload scenario. In theme functions.php i have:               function insert_complogo($file_handler,$user_id,$setthumb='false') {     // check to make sure its a successful upload     if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK) __return_false();     require_once(ABSPATH . "wp-admin" . '/includes/image.php');     require_once(ABSPATH . "wp-admin" . '/includes/file.php');     require_once(ABSPATH . "wp-admin" . '/includes/media.php');          $attach_id = media_handle_upload( $file_handler, $user_id );          if ($setthumb) update_usermeta($user_id,'_thumbnail_id',$attach_id);     return $attach_id;     }        In my profile-edit.php at the top i have:               if ($_FILES) {     foreach ($_FILES as $file => $array) {     $newupload = insert_complogo($file,$user_id);     }     }        also this:               if ( !empty( $_POST['authorphoto'] ) )         update_usermeta( $current_user->id, 'comp_logo', esc_attr($_POST['comp_logo']   ) );         and my input type is:
        <?php _e('Add Company Logo', 'comp_logo') ?>
                              <input type="file" name="comp_logo" id="comp_logo" value="Upload Logo" size="50" />
        As you can tell from the first three blocks of code above i have changed post_id references to user_id, Now the upload of the company logo does work, however even using user_id and update_usermeta the info is being saved into wp_postmeta table which is not where i want it to be as i need to pull the info from wp_usermeta to populate the author.php page. So my question (got there eventualy) is why when im using update_usermeta is the attachment info going into wp_postmeta, im guessing its because codex says that image attachments are a type of post so no matter what that is where they go, but how can i get that image from wp_postmeta and associate it with the correct author?


How to count current user's pages?

There are a lot of answers on how to count users posts by using:               <?php         if ( is_user_logged_in() ) {             global $wpdb;         $user = wp_get_current_user();         $where = get_posts_by_author_sql( 'page', true, $user->ID );         $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" ); ?>          //option 1
Hey <?php echo $current_user->display_name ?>, check your page here: {page title with link to page}
          <?php } else { ?>     //option 2
Welcome <?php echo $current_user->display_name ?>, etc.. text with tags etc.
          <?php } } else { ?>     //option 3
text with tags etc.
          <?php } ?>      But since users can also create pages, how does one get the count of current user's pages in a similar situation as the code above?


Query 1 taxonomy term, exclude another

Here's the code I'm using to try and query a single taxonomy for one term, but exclude returned posts for that term that also belong to another. In English, this is what I want: query 'resource-type' for 'testimonies', but not 'testimonies' that are also 'audio'. Tips to tweak this code to get it to work?               <?php              $testimonials_args = array(                  'post_type' => 'resource',             'posts_per_page' => 1,             'tax_query' => array(             'relation' => 'AND',                  array(                     'taxonomy' => 'resource-type',                     'field' => 'slug',                     'terms' => array( 'testimonies' )                 ),                 array(                     'taxonomy' => 'resource-type',                     'field' => 'slug',                     'terms' => array( 'audio' ),                     'operator' => 'NOT IN'                 )             )         );          ?>


Creating gallery with taxonomy images plugin?

My code uses a taxonomy category image plugin to display images for categories. It also displays subcategories of the main category in the parent category page (`category.php`). I want to display only one level of subcategories in the page, for example: hardware (parent category)   * monitor (first level subcategory of harware)     * samsung (second level subcategory)       * lcd (third level subcategory ) When the user clicks on the hardware link, they should see only the monitor subcategory link. Clicking on monitor, they should see the samsung category link, and when they click on samsung, lcd should display. How I should change my code to achieve this? **My code:**               <?php     $cat_id = get_query_var('cat');     $catlist = get_categories('hide_empty=0&child_of=' . $cat_id);     echo "
";          foreach($catlist as $categories_item)     {     echo '
term_id ) . '" title="' . sprintf( __( "View all products in %s" ), $categories_item->name ) . '" ' . '>' . $categories_item->name.'
 ';          echo '
';         $terms = apply_filters( 'taxonomy-images-get-terms', '' );         if ( ! empty( $terms ) ) {                foreach( (array) $terms as $term ) {             if($term->term_id == $categories_item->term_id) {                print 'taxonomy ) ) . '">' . wp_get_attachment_image( $term->image_id, 'thumbnail' );                echo '';             }         }         echo '
'. $categories_item->description; echo '
';     }     echo '
';     }     echo "
";     ?>


TinyMCE Advances is removing blanks (" ")

I want to keep blanks " " inserted by the user in Wordpress with the TinyMCE Advanced plugin. He keeps them only if there are some letters at the beginning. E.g.               Fr     09:00 - 18:00      But he don't keep them if I use something like this               Mo-FR  09:00 - 18:00            09:00 - 18:00      What can I do against this? * _My solution: *_ I went away from this structure. Now I use `Mo-Fr   09:00 - 18:00`


Why am I being limited to ten posts on a custom loop?

For example, I have a link on my site like /tag/green and select content from all posts tagged green are shown using a file loop-tag.php which is about as simple as               <?php     if ( have_posts() ) :  while ( have_posts() ) : the_post();  ?>     <!-- Here I grab the image from the post with that tag -->       <?php endwhile;  ?>      This works however it is being limited to 10 posts. Why is this being limited to 10 like this?


Is it possible to reduce image filesize on the fly (when users enter my website)?

**The main problem here is about too large file size of image not image re- sizing** My wordpress website is like a web gallery which contains many images. Initially, I just uploaded hundreds of images via wordpress media uploader without caring of its file size at all. However, when i browse my website, it's too slow to load the homepage because the image file size is too large. Since i don't want to modify images which are already uploaded, is it possible to create a filter or plugin to reduce image filesize ( **no dimension changes** )or reduce its quality on the fly to make the website load faster? P.S. Anyways, my last resort is to use photoshop to modify images and reduce its quality in order to reduce its file size. Any suggestions?


Custom Rewrite Rule with Sub Folders

I need to create a custom rewrite rule for a WordPress plugin. I have read this topic and came up with a working solution using `add_rewrite_rule()`. However, after testing the plugin, I realized that this doesn't work with a multisite using sub directory (`http://example.com/my-site`). What my rewrite rule is supposed to to is rewrite a URL like `http://exmaple.com/my-site/preview/854376` into `http://example.com/wp- content/plugins/my-plugin/preview.php?id=854376`. I have been searching around but I can't seem to find anything that deals with this issue. I'm actually wondering if using `add_rewrite_rule()` for a rewrite rule NOT pointing to index.php is the right way to do it. Here is my code:               public function add_rewrite_rule() {         add_rewrite_rule( 'preview/([^/]+)/?', WPBP_URL . 'public/views/preview.php?item=$matches[1]', 'top' );     }


How to define theme translation file?

If I have WordPress installation in English, then I can define my theme translation file in the wp-config.php file with following:               define('WPLANG', 'sv_SE');      But if I have WordPress installed in the local language then there is already WordPress translation file defined there, then how can I define my theme translation file?


save_post action inside a custom metabox class not working

I am writing a class to create metaboxes and save the form data. The problem is, I keep getting a warning when I click "publish": > Warning: `call_user_func_array()` expects parameter 1 to be a valid > callback, function `Mighty_Metabox` not found or invalid function name" Some of the things I know: The meta box shows on page load. The save function is called on page load. The warning above is returned on publish. The save function is not called on publish. Do I need to put the `save_post` action hook somewhere else? Am I getting the wordpress integration into my class completely wrong? Some help on how and when to call methods like the save method would be greatly appreciated:                   if (is_admin()){         add_action('load-post.php', 'Mighty_Metabox');     }          //the class     class Mighty_Metabox{              //the vars         public $id = false;         public $title = false;         public $callback = array();         public $post_type = array();         public $context = false;         public $priority = false;         public $callback_args = array();         public $template = false;              public function __construct($params=false){             if($params){                 //arrange params as key => value pairs                 foreach($params as $key => $value){                     $this->{$key} = $value;                 }                      //if admin page, add the action - add (metabox)                 if(is_admin){                     //set the callback to create metabox                     $this->callback = array($this, '_create');                          //add the add metabox action                     add_action('add_meta_boxes', array($this, '_add'));                          //add the save metabox action                     add_action('save_post', array($this,'_save'));                      }             }         }              function _add(){             //add the metabox with user set params             add_meta_box($this->id, $this->title,  $this->callback, $this->post_type, $this->context, $this->priority, $this->callback_args);              }              function _create(){             //create the metabox                         include($this->template);             // create a nonce for verification             echo '<input type="hidden" name="'. $this->id .'_nonce" value="' . wp_create_nonce($this->id) . '" />';         }              function _save(){             // verify if this is an auto save routine.              // If it is our form has not been submitted, so we dont want to do anything             if (defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE) {                 return;             }                  // verify this came from the our screen and with proper authorization,             // because save_post can be triggered at other times             $nonce = isset($_POST[$this->id.'_nonce']) ? $_POST[$this->id.'_nonce'] : NULL;             if (!wp_verify_nonce($nonce, $this->id)){                 return $post_id;             }                  $this->_debug(false); // won't get here on page load         }              private function _debug($exit=true){             var_dump(debug_backtrace());             return ($exit)? exit(): false;         }     }      And here is the use:               $args = array     (         'id' => '_subtitle',         'title' => 'Subtitle',         'post_type' => 'post',         'context' => 'normal',         'priority' => 'high',         'template' => 'subtitle.php'     );          //subtitle metabox     $subtitle_mb = new Mighty_Metabox($args);      FYI: I am fairly new to OOP programming. I have been looking at the codex for metaboxes in order to learn more, but their class just seems like a wrapper for some code and doesn't seem to allow you to instantiate it - I may be wrong in thinking this. **EDIT:** Here is the subtitle.php file that is being included:

             Subtitle	                              <input type="text" id="<?php echo $this->id; ?>" name="<?php echo $this->id; ?>" value="" class='large-text' />
                 The subtitle will appear under the main post or page title.


how to automatically generate hierarchical menus from hierarchy of pages?

I have a photo site, and I take care to crested a logical nested hierarchy of pages. e.g. for photos I just posted, I created the following pages: site.com/2013/ site.com/2013/colorado/ site.com/2013/colorado/crested-butte/ the last of these is the one on which I placed my photos. I want hierarchical menus that are easy to navigate/browse. How do I instruct Wordpress to automatically generate this?


Updating post title using wp_update_post

I am creating a custom post type for a people page for a client website that has meta fields for both first and last name, but I would also like to update the title for the custom posts to be a combination of the two (i.e. "firstname lastname"). I am using `wp_update_post` to do this but am running into a problem. When I go to update a post, the data is updated correctly, but my cursor spins continuously and the page never reloads. I assume this is because `wp_update_post` is causing an infinite `save_post` loop, but the recommended fix for this on the wordpress codex doesn't seem to be working and I assume there is a problem with how I am calling one or more function. Here is my code:               add_action('save_post', 'save_details');     add_action('edit_post', 'save_details');          function save_details($post_id){       global $post;                if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {                   return $post_id;           }                  update_post_meta($post->ID, "firstname", $_POST["firstname"]);             update_post_meta($post->ID, "lastname", $_POST["lastname"]);                  if ( ! wp_is_post_revision( $post_id ) ){                      $args = array();                     $args['ID'] = $post_id;                     $args['post_title' ] = implode(' ', array($_POST["firstname"],$_POST["lastname"]));                      remove_action('save_details','save_post');                     wp_update_post( $args );                 add_action('save_details','save_post');         }          }


Display most recent post in category instead of archive?

I've successfully redirected my blog page to my most recent post - i.e. so when you click the 'blog' link in the nav it goes to the most recent post page and you can click next/prev buttons to navigate between other posts. Now I want to do the same thing but for a specific category so when you click a category link, instead of displaying an archive page of all the posts in that category, it displays the most recent post in that category. **The next/prev buttons then need to navigate to posts only in that category.** Any ideas how I can do this? Thanks **===============UPDATE===============** I copied my code from single.php to category.php and used single_cat_title(); to display the category name at the top of the page. Needed to change my next/previous_post_link to next/previous_posts_link The only disadvantage is that the URL displays /cat=[catname]&paged=2 rather than the name of the post, but not really a big problem. The only issue remaining is how to display the full screen background image which is attached to each post and referenced as follows in my header.php:               $background_image = get_post_meta($page_id, 'mb_background_image', true);        $src = wp_get_attachment_image_src($background_image, 'full');      How can I call this from the category page? **===============UPDATE 2===============** Fixed by replacing this line:               $background_image = get_post_meta($post->ID, 'mb_background_image', true);


Formating content in category.php

I am using WordPress 3.5.1 / Twenty Twelve theme. I am using custom fields and displaying them in category.php in the following way, the php is setup inside category.php in the "/* Start the Loop */ "               $metastime = get_post_meta($post->ID,'user_submit_starttime',true);     echo ''.$metastime.'';     $metaetime = get_post_meta($post->ID,'user_submit_endtime',true);     echo ''.$metaetime.'';     $metaloc = get_post_meta($post->ID,'user_submit_location',true);     echo ''.$metaloc.'';      It works as the custom fields are displaying when I view the category archives ( _the custom fields are displayed under each post title_ ), but I assume there is a better function to use. Like the the following?               get_template_part( 'content', get_post_format() );      Since that code is specific to content.php, I would like the custom fields to show up where the
 <?php the_content('Read more...'); ?>
      Resides in content.php, What is the best way to display the custom fields so they display were the "entry-content" is displayed in category.php ?


Select posts that match multiple category names, must match all categories listed

I need to search for posts that belong to multiple categories, but they must match all categories listed, as in if I list category names 'japanese' and 'dessert' the matching posts need to be in both the 'japanese' and 'dessert categories. Is there something like `category__and` for category names? I am using a wordpress multi instance and my category ID numbers vary between my test and production environments, hence I cannot use `category__and`.


Data won't save on a straightforward metabox, what am I missing?

I need a second set of eyes, because its late and I can't see this anymore. Why won't this save? What am I missing?               add_action("admin_menu", "tf_book_stuff_create");          function tf_book_stuff_create(){         add_meta_box('tf_book_stuff', 'Book Stuff', 'tf_book_stuff', 'books');     }          function tf_book_stuff() {         global $post;         $custom = get_post_custom($post->ID);         $tf_book_number = $custom["tf_book_number"][0];         $tf_book_reader = $custom["tf_book_reader"][0];              echo $tf_book_isbn;         echo $tf_book_level;          ?>

Book ISBN:<input name="tf_book_number" value="<?php echo $tf_book_number; ?>" />

Reading Level:<input name="tf_book_reader" value="<?php echo $tf_book_reader; ?>" />

     <?php }                    add_action("admin_menu", "save_tf_book_stuff");     function save_tf_book_stuff($post_id) {         global $post;              update_post_meta($post->ID, "tf_book_number", $_POST["tf_book_number"]);         update_post_meta($post->ID, "tf_book_reader", $_POST["tf_book_reader"]);     }      Thanks


How can I compare publish and update dates for a single post?

In my theme, I'd like to display the publish date and (only) if the post was updated after the publish date, also display the updated date. The code in my theme now looks like this:               */ stuff above here to display publish date, then do this stuff to see if updated */     if ( get_the_date() != get_the_modified_date() )         {             printf( __( '<br>Updated: <time class="entry-date" datetime="%1$s">%2$s</time>', 'splatone' ),             esc_attr( get_the_date( 'c' ) ),             esc_html( get_the_date() )         );         }      If the post was published and updated on the same day, I'd rather not show the updated line, but it currently is. How can I compare the dates so that I only get it if the date has changed and not just the time?


Customizing the display of custom post types

Currently I have a custom post type and I would like to have some different version of it based on user input - so for example when creating a post the user can select if the post is Featured or Free and then there would be an if- else statement that would display different image if Featured and different if Free in the actual post. Can anyone point me to the right direction? Any advice greatly appreciated.


Add tags to custom post type without menu link

I've worked out how to add tags to custom post types using `'taxonomies' => array('post_tag')` However this adds another "Tags" submenu under my custom post type menu which I do not want. How do I remove this submenu? ![enter image description here](http://i.stack.imgur.com/MJycZ.png)


query vars in url work but not in ajax call

I'm working on ajax script that calls wordpress page and retrieves posts as data. But I've hit a dead end. Using: http://codex.wordpress.org/WordPress_Query_Vars When I directly enter url with query_vars it works and posts get filtered correctly, but when I pass the same using ajax it just lists unfiltered posts. I checked get parameters are getting through, but wp is not catching them. what should I do? Code: http://domain.com/blog/wp-content/themes/wovies-bones/getmovies.php?actor=x And works fine, I get single post that has custom taxonomy actor = x. But when I try to load same using ajax, it behaves differently and ignoring my get request returns all posts... ajax-jquery part:               $.ajax({       url: templatePath + "getmovies.php",       type: "GET",       data: filters_get,       cache: false,       success: function (data){         console.dir(data);       }     });      And php part:                       /* Define these, So that WP functions work inside this file */             define('WP_USE_THEMES', false);             require('../../../wp-blog-header.php');                   ?>
                 <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                     <a href="<?php the_permalink() ?>">                         <?php                             if (has_post_thumbnail()) {the_post_thumbnail('homepage-preview');}                             else {echo '';}                         ?>
<?php comments_number('0 review','1 review','% reviews'); ?>

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

                 <?php endwhile; else: ?>                                      <?php endif; ?>
      filters_get looks like this: ?actor=x&


I changed my url and cant access my site, Help?

I tried to change my URL and ended up losing access to my site? I went into general settings and changed both WordPress URL and Site URL to my new URL. I have my site running again but still have no idea how to set up my new domain.


Edit and make class-wc-widget-featured-products.php update-proof

Within the class-wc-widget-featured-products.php file I need to Remove this on Line 101: `<?php if ( $r->post->post_title ) echo get_the_title( $r->post->ID ); else echo $r->post->ID; ?>` and Remove: `</a> <?php echo $product->get_price_html(); ?>` And change the UL tag to a DIV and delete the li tags, which is fine to do within the core file... but can anyone tell me how I would implement this in the functions file to keep my changes from being deleted with every woocommerce update? I tried adding the edited file to a woocommerce>classes>widgets file structure within my child theme but I've just read that this only works with template files. Any help will be greatly appreciated!! Thanks


using wp_insert_post inside of custom meta box

This is kind of a unique situation. I have an invoicing custom post type that when it is marked as "paid" I want to then generate another custom post type. I have a custom meta file that handles the invoice meta and am trying to get this function to work. Currently, it does work, but it creates an infinite number of new posts all with the same title and such. I have to quickly stop the page and it already has close to 1000 posts. Here is my current function, hopefully someone will see something I am doing wrong. I did try adding the post as a future post as I read somewhere that would eliminate the loop...didn't work.               // Generate CEU if payment is entered manually     function generate_ceu( $post_id ){     // check nonce     if (!isset($_POST['invoice_meta_box_nonce']) || !wp_verify_nonce($_POST['invoice_meta_box_nonce'], 'invoice_meta_box')) {         return $post_id;     }          // check capabilities     if ('invoice' == $_POST['post_type']) {         if (!current_user_can('edit_post', $post_id)) {             return $post_id;         }     } elseif (!current_user_can('edit_page', $post_id)) {         return $post_id;     }          // exit on autosave     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {         return $post_id;     }          // Check if the payment amount already exists so we don't create another CEU     if (!get_post_meta($post->ID, 'invoice_payment_amount', true)) {         if (isset($_POST['invoice_payment_amount'])) {              $title = 'CEU'.date('YmdHs');              // Create the post         $new_post = array(             'post_title'    =>  $title,             'post_date_gmt' => strtotime('+5 minutes'), // Set the post publish time to 5 minutes from now so it wont loop             'post_status'   =>  'future',           // Choose: publish, preview, future, draft, etc.             'post_type' =>  'ceu',  //'post',page' or use a custom post type if you want to         );              $pid = wp_insert_post($new_post);         } // end check for post entry     } // end check for meta data     } // end function          add_action( 'save_post', 'generate_ceu');


How to hide "Trackback" on paginated comments

**My Setup:**   1. On my Single's page I have used this comments_template('', true); to separate Trackback's & regular comments.   2. The Heading "Trackbacks for this post" shows up only if a post has trackbacks.  **Now the issue is, if the comments are paginated:**   1. On First page, the trackback are shown and below them the regular comments are shown along with older/newer links to paginated comments pages.   2. On deeper comments pages (e.g. /comment-page-2/) , no trackbacks are shown, however the title still appears. Is there a way to hide the "Trackback title" on subsequent pages if there are no more trackbacks?