"Widgets" menu doesn't appear

I'm developing a WordPress theme, which works great on my localhost and one of my live servers, but on my other live server the Widgets menu (from Appearance) doesn't appear. And yes, all 3 servers have the same 3.6.1 WordPress version, and the theme files are the same. Any idea what could cause this? Here's the area of `functions.php` that registers the widget areas:               if (function_exists('register_sidebar')) {     register_sidebar(array(         'name' => 'RLTheme - Footer Left',         'id'   => 'rltheme_footer_left',         'description'   => 'The left area of the footer.',         'before_widget' => '',         'after_widget'  => '',         'before_title'  => '
',         'after_title'   => '
'     ));          register_sidebar(array(         'name' => 'RLTheme - Footer Center',         'id'   => 'rltheme_footer_center',         'description'   => 'The center area of the footer.',         'before_widget' => '',         'after_widget'  => '',         'before_title'  => '
',         'after_title'   => '
'     ));          register_sidebar(array(         'name' => 'RLTheme - Footer Right',         'id'   => 'rltheme_footer_right',         'description'   => 'The right area of the footer.',         'before_widget' => '',         'after_widget'  => '',         'before_title'  => '
',         'after_title'   => '
'     ));          register_sidebar(array(         'name' => 'RLTheme - Sidebar Left',         'id'   => 'rltheme_sidebar_left',         'description'   => 'The right sidebar area.',         'before_widget' => '
',         'after_widget'  => '
',         'before_title'  => '
',         'after_title'   => '
'     ));          register_sidebar(array(         'name' => 'RLTheme - Sidebar Right',         'id'   => 'rltheme_sidebar_right',         'description'   => 'The left sidebar area.',         'before_widget' => '
',         'after_widget'  => '
',         'before_title'  => '
',         'after_title'   => '
'     ));     }      P.S. If I switch from my theme to the default one (on that live server where I can't see the "Widgets" menu when I activate my theme) I can see the "Widgets" menu, so the WordPress installation there doesn't appear to be broken.


woocommerce allow users to select or use avatar

I am working on constructing a ecommerce site that is run by woocommerce and the free woo theme artificer. Standard with the plugins there is a my account page which allows you to put in basic information. The users can also use their accounts to comment on blog posts. When they comment they currently have the default grey siloutte for their associated image. How do I allow them to associate an avatar with their account and use that when they comment? The testing is going on at the address: www.violet-rain.com/post-trees


How to resize attachement

I m having trouble in resizing media images. I tried add_image_size function to resize my original image like below. > add_image_size( 'my_thumb', 145, 100); it creates thumb images with height 100 but it changes width for every image. like some image `66x100,140X100` .How to make sure the width 145 Sorry could n't share links and screenshot due to low reputation I tried also timthumb. getting same result.Where i'm stucking . Please help me. Thanks in advance


save data from metabox does not work

i have used the tutorial of add metabox . but my data does not save in the box . ihave the meta box in edit link page , but when i put any data in the box and press update button it dont save the data. Then actually i want to know when i put the data in the box can i get the data by using $_POST[] ? if yes, plz help me so me error part of my code..               // backwards compatible          add_action( 'admin_init', 'blc_add_custom_link_box', 1 );                    /* Do something with the data entered */          add_action( 'save_link', 'blc_save_linkdata' );                    /* Adds a box to the main column on the Post and Page edit screens */          function blc_add_custom_link_box() {              add_meta_box(                   'backlinkdiv',                  'Backlink URL',                  'blc_backlink_url_input',                  'link',                  'normal',                  'high'              );          }          /* Prints the box content */          function blc_backlink_url_input( $link ) {            // Use nonce for verification            wp_nonce_field( plugin_basename( __FILE__ ), 'blc_noncename' );                    #  if(get_option( "backlink_url" ) != $_POST['backlink_url']) {          #    update_option( "backlink_url", $_POST['backlink_url']);          #  }            ?>            <input type="text" id="backlink-url" name="backlink_url" value="<?php echo get_option('backlink_url'); ?>" size="60"/>       <?php                    }          /* When the link is saved, saves our custom link data */          function blc_save_linkdata( $link_id ) {            // 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 $link_id;          #              #    }                         if( isset( $_POST['backlink_url'] ) ){                   update_option( $link_id, "backlink_url", $_POST['backlink_url'] );              }      Now i want to save the data in the box that may not save in data base. So how the data from meta box save . Plz help me..


wp add inline style in loop

I want to add inline styles thanks to the wp_add_inline_style wordpress function. The inline styles will be added in a loop. In my case, I output an isotope grid in my loop and this grid can have differents css customization for each grid. Actually I have this php script:               function grid_register_styles(){         $themeversion =  wp_get_theme()->display('Version');         wp_register_style( 'grid-style', get_bloginfo('stylesheet_url'), array(),     floatval($themeversion) , false  );     }     add_action( 'init', 'grid_register_styles' );          function grid_inline_styles($guttercss) {         wp_enqueue_style( 'grid-style' );         wp_add_inline_style( 'grid-style', $guttercss);     }          /* this is the function used for the loop */     function grid_init() {              /* There is some stuff before */              /* I calculate a variable in order to apply a style base on some options */         $guttercss  = '.gutter-'. $gutter .' .to-item-wrapper {';         $guttercss .= 'margin: '. $gutter/2 .'px !important;}';              /* Then I call my function to output inline css style */         grid_inline_styles($guttercss);              /* There is some stuff after */          }      This code works in the loop and output different css style for each generated isotope grid. However, the generated css is in the footer instead of the head.... I success to put it in the head with an add_action() but it can't only works outside the loop and only one time. I think that I don't correctly understand the way to use wp_add_inline_style().


wp query to get child pages of current page

Can anyone please help me to with the wp_query. I am making a template file/loop to create and archive page of the current page children pages. This query needs to be automatic as I am using in on few pages. This is my query below, but it just returns my posts instead of child pages.               <?php          $parent = new WP_Query(array(              'post_parent'       => $post->ID,                                        'order'             => 'ASC',         'orderby'           => 'menu_order',         'posts_per_page'    => -1          ));          if ($parent->have_posts()) : ?>              <?php while ($parent->have_posts()) : $parent->the_post(); ?>                  <div id="parent-<?php the_ID(); ?>" class="parent-page">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?>

<?php the_advanced_excerpt(); ?>

                <?php endwhile; ?>          <?php unset($parent); endif; wp_reset_query(); ?>      Thanks in advance for any help. Josh


WordPress not auto updating to 3.8.1 on some sites

I manage a handfull of WordPress blogs and while some were automatically updated to 3.8.1 in the last weeks, some are still stuck at 3.8. I could upgrade them manually but I'd like that to happen automatically. I can't find out why not all are running 3.8.1 by now. Furthermore some of the stuck ones already have `$wp_version = '3.8.1';` in `version.php` with the file being touched on january 24th. A few things:   * They are german localized version (de_DE).   * Some of them are visited only rarely.   * I used "Background Upgrade Tester" and all came out positive.   * I have not disabled automatic background updates I thought of creating a cronjob to hit all my blogs a few times after 8pm each day but if I understand the process right, this is not how it works. Any suggestions on how to track this down? Thanks!


Is it possible to rename an url from custom post type?

On my test site: http://outletdokkum.nl/kollum/dagaanbiedingen/y-bike-2/ You see a week offers (weekaanbiedingen in dutch). But as you can see the url says Day offers (Dagaanbiedingen in dutch). Is there a possibility with .htaccess or a plugin to rename the url? The url is generated by a plugin called Types, it's a custom post type plugin. I've tried to rename the url slug in the custom post type, but then my links are broken and it does not redirect to the weekly offer anymore. EDIT: Editing my slug in custom post type taxonomies works fine, but I need to edit the page where the week offer is shown too. I need to change the line:               <?php query_posts('post_type=dagaanbiedingen & posts_per_page=99'); $teller=0; ?>       To:               <?php query_posts('post_type=weekaanbiedingen & posts_per_page=99'); $teller=0; ?>       When I edit my custom post type taxonomies to weekoffer (weekaanbieding)


Widget that shows categories with posts numbers

Is there any solution to show categories with posts numbers like 'Archives' widget without changing the font size? UPD0: Sorry if my question is not clear. What I want? We have a pretty nice widget, which generates the following Archives like this: ![enter image description here](http://i.stack.imgur.com/i5cy7.png) The question is, how we can get the same view for categories? Like this:               Categories     My Category (12)     Another category (16)


auto-scheduling posts

I had to make a script for auto-scheduling post.. The interval between every post published should be of 20mins This is the code i made so far                  function techento_data_valid_schedule($data) {     if ($data['post_type'] == 'post') {        if ($data['post_status'] == 'publish') {     // If post data is invalid then     $time += 60;     $data['post_status'] = 'future';     $data['post_date'] = date('Y-m-d H:i:s', $time);     $data['edit_date'] = true;          }     }     return $data;     }          add_filter( 'wp_insert_post_data', 'techento_data_valid_schedule', '99', 2 );      but this script moves the post status to draft mode and it isn't scheduled


User-edit role setting distinct from wp_capabilities?

I need find out how $profileuser->roles is set. wp_capabilities can hold multiple roles Whereas user-edit role caters only for a single role. Under certain circumstances it is possible for there to be one or more roles in wp_capabilities but none set in user-edit. That suggests that there must be another setting used to define user-edit role distinct from wp_capabailities. In order to import a large batch of of legacy user data with roles set, I need to understand how/where the user-edit setting is stored distinct from wp_capabilities. The particular circumstance is with syncing between wp users and membership type in civiCrm. The sync uses mapping between wp user-edit role setting to civi Membership type. Civi allows multiple membership types per user. WP 3.8.1, Members plugin 0.2.4 civiCrm plugin 4.4


Can't change theme options, connection reset error

I've downloaded a theme and applied it, but whenever I go to Appearance - Theme options and click on "save settings", I get an "ERR_CONNECTION_RESET" error, while in address bar I see "www.myblogsite.com/wp-admin/options.php". After that I realized that options.php is present on server, but I can't figure out where is the problem. What should I do? I'm using Wordpress 3.9 Regards


Using next_posts_link in related post of single post page

I am trying to do a related post query with a load more button, I have some ajax setup with this button to get more post from a url but the problem is next_posts_link does not work within a single post to grab more post within the query. I think that has something to do with it being inside of a single post and the url of the post. Can i use next_posts_link inside of a post within another query outside of the single while loop? Any Suggestions are appreciated. This is what I have in my single.php file.               //single post while loop     <?php while ( have_posts() ) : the_post(); ?>               <?php endwhile; ?>     <?php the_title(); ?>     <?php echo get_the_date( 'n-d-Y' ); ?>     <?php the_content(); ?>          //Related post query     <?php                  $category_id = get_the_category();                  $args = array(                'post_type' => 'post',                'cat' => $category_id[0]->term_id,                'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1),                'posts_per_page' => 2             );                  query_posts($args);             $x = 0;             $xx = 1;                  while (have_posts()) : the_post(); ?>                    <?php the_title(); ?>                  <?php endwhile; ?>                  <?php wp_reset_query(); ?>          <?php next_posts_link('More Post') ?>


How should I structure a WP website project using git and updating from WP dashboard?

For months I've been trying to plan out a good project structure for using git version control for WordPress website development that doesn't sacrifice the ability to update core and plugins through the WP dashboard, doesn't require an unconventional directory structure (wp-content outside of the WP parent folder) and that is easy to manage and deploy whole websites. I've read about submodules, subtrees, nested repos, etc, and I'm still having a hard time fitting it all together and choosing the right strategy. Here's what I'm thinking right now, with my thoughts for how I would handle git repos in parenthesis.               root (main project repo)     |-- wordpress (public git repo added as subtree)     |    |-- wp-content      |    |    |-- plugins     |    |    |    |-- my-custom-plugin (git repo added as subtree)     |    |    |    |-- other-plugin-with-git-repo  (git repo added as subtree)     |    |    |    +-- other-plugin-without-git-repo (ignored/untracked)     |    |    |-- themes     |    |    |    |-- my-custom-theme (git repo added as subtree)     |    |    |    |-- other-theme-with-git-repo  (git repo added as subtree)     |    |    |    +-- other-theme-without-git-repo (ignored/untracked)     |    |    +-- uploads (ignored/untracked)     |    |-- wp-admin     |    +-- wp-includes     |-- wp-config.php (ignored/untracked)     +-- other-files.txt      This leaves me with several problems/questions;   * Automatic updates; I love the new auto updates feature, it could potentially save a lot of time and effort in keeping my sites updated and secure, but it seems that it throws a wrench in tracking code changes with git. Is there any way to track my code changes while still allowing WordPress core to auto update?   * Does having subtrees under the WordPress core repo prevent me from using git to merge in new core updates or pushing out my changes back to the WordPress core repo (if I ever decide I'd like to be a core contributor)?   * For plugins that don't have a public git repo, completely ignoring them creates the problem of not being able to quickly clone the entire site on a new server without manually copying files over to the server. It also causes a problem if I want to make changes to that plugin's code those changes aren't tracked and could easily be lost in a plugin upgrade. So, to summarize, what is a good git+WordPress setup that avoids these problems? I would appreciate your feedback on my proposed project structure. Any way that you can help me improve this, would be much appreciated! PS, if there is a better forum for this discussion, please point me there.


Custom taxonomy, get_the_terms, listing in order of parent > child

I have a hierarchical custom taxonomy which I can display using `print_r(get_the_terms( $post->ID, 'taxonomic_rank' ));`:               Array     (         [46] => stdClass Object             (                 [term_id] => 46                 [name] => Aplocheilidae                 [slug] => aplocheilidae                 [term_group] => 0                 [term_taxonomy_id] => 53                 [taxonomy] => taxonomic_ranks                 [description] =>                  [parent] => 39                 [count] => 1                 [object_id] => 443             )              [47] => stdClass Object             (                 [term_id] => 47                 [name] => Aplocheilus                 [slug] => aplocheilus                 [term_group] => 0                 [term_taxonomy_id] => 54                 [taxonomy] => taxonomic_ranks                 [description] =>                  [parent] => 46                 [count] => 1                 [object_id] => 443             )              [39] => stdClass Object             (                 [term_id] => 39                 [name] => Cyprinodontiformes                 [slug] => cyprinodontiformes                 [term_group] => 0                 [term_taxonomy_id] => 52                 [taxonomy] => taxonomic_ranks                 [description] =>                  [parent] => 0                 [count] => 1                 [object_id] => 443             )          )      This taxonomy will always take the following form: **Order** (parent) > **Family** (child of Order) > **Sub-family** (child of Family) Is there a quick and easy way of displaying these taxonomies in the correct order, so that I could print out the following line? `Order: <order>, Family: <family>, Sub-family: <sub-family>` Thanks in advance


Dynamically change post_parent in every page load?

What's the correct Wordpress action where I can hook to dynamically change the post_parent of a post? I understand that a post can't have multiple parents so that's the only way I can think of to assign multiple parents to all posts(custom post type actually). I'm actually just modifying the behavior of a plugin so doing this via tags/categories is not an option. Preferably, I'd like to be able to change it before any query(for a post) has been initiated.


Wordpress appends RSS item with unwanted content

Wordpress is adding a message to the end of each item in RSS feed that reads "The post [post_name] appeared first on ]site_name]." I want this message to go away. I browsed through a my feed.php files, but couldn't find the code that assembles this message. Where should I look for this?


Base URL missing from post permalinks

My social media sharing buttons on my site don't work. Finally saw something I've never ever seen in WordPress before and am sure this is the culprit. The base (main) URL is missing from the permalinks!! Have you ever seen this before? ![missing base url](http://i.stack.imgur.com/MUY0g.png) Only the editable slug is reflected.


How to make my blog available to other website using RSS feed?

I do blogging a lot. I run my own website - www.tune2wizard.com I want my blogs to be published in other websites like codeproject - articles etc. However, I don't know how to create the RSS link for my website articles. I use word press on my website. How can I do so?


deleted menu still present

I deleted a menu, but it still shows at the top of my website (About Us -to- Request Consulting Services). The site is using AppThemes.com's JobRoller theme as a parent, and the Flux child theme. There are no caching plugins installed. When I change the theme, the front end changes immediately. So why doesn't the menu change immediately after it is deleted?


Limit get_pages to only show 5 items

How can I limit the get_pages to only show 5 items? I thought adding `'number' => 5` to the array would limit it to 5 but it doesn't show anything. Here's my code:               <?php      $pages = get_pages(array('post_type' => 'page','sort_column' => 'menu_order','sort_order' => 'ASC','child_of' => 765));          foreach($pages as $post)     {     setup_postdata($post);     $fields = get_fields();     ?>
<?php echo $fields->start_date; ?> <a href="<?php echo get_page_link($post->ID) ?>"><?php echo substr($fields->event_title,0,24) . "..."; ?>
     <?php     }          wp_reset_query();     ?>


Query specific number of posts for each post type in specific order

This is related to this other question, I tried with `get_posts`, `pre_get_posts`, `WP_Query` and basically every option I could find for 2 days now, no solution yet. The full problem in hand: I have 2 post-types, `articles` and `news`. A post from "news" can be "featured" or "non-featured". I need to query 1 featured news, 4 articles and 2 non-featured news, and display them on a page in that order. The page uses the `page-mypage.php` template. The posts need to be in that specific order because the size of the post changes depending on the type and the "featured" meta option. My grid is using Masonry and the sequence that works to have a full grid (no holes or weird empty space) is `featured, article, article, article, article, non-featured, non-featured`. With the `get_posts` approach in the other question I can't get the pagination working. It works when navigating to `/page/X` but I tried a bunch of custom pagination solutions that didn't work and `paginate_links` which I couldn't get to work either. So now I'm thinking of using a regular `WP_Query` but how do I tell WordPress I want that many posts from each post-type and in that particular order? Here's what I really want to do but I can't seem to find a way to do it with `WP_Query` to make pagination work properly (damn pagination!):               $articles = get_posts(array(       'post_type' => 'articles',       'numberposts' => 4     ));          $featured = get_posts(array(       'post_type' => 'news',       'numberposts' => 1,       'meta_query' => array(         array(           'key' => 'featured-news',           'value' => 'Yes',           'compare' => 'LIKE'         )       )     ));          $non_featured = get_posts(array(       'post_type' => 'news',       'numberposts' => 2,       'meta_query' => array(         array(           'key' => 'featured-news',           'value' => 'No',           'compare' => 'LIKE'         )       )     ));          // Merge in the order I need them to appear     $all_posts = array_merge($featured, $articles, $non-featured);          // The loop      Halp!.


So strange result of wp_query and have_posts

I've tested some piece of simple code, but the result is so so strange. **Test 1:**               $featured_posts = new WP_Query( $query_args );     while ($featured_posts->have_posts()) {         $featured_posts->the_post();         the_title(); echo '
';                }     echo 'End: "' . $featured_posts->have_posts() . '"'; // have_post() is TRUE, WHY?      **Test 2:**               $featured_posts = new WP_Query( $query_args );     $have_posts = $featured_posts->have_posts();     while ($have_posts) {         $featured_posts->the_post();         the_title(); echo '
';                    $have_posts = $featured_posts->have_posts();     }     echo 'End: "' . $have_posts . '"'; // false -> I think false is right.                   echo 'End: "' . $featured_posts->have_posts() . '"'; // but still TRUE, WHY?      Am I missing anything?


How to force a 404 on WordPress

I need to force a 404 on some posts based on conditions. I managed to do it ( although I don't know if I did it the right way) and I'm a getting my `404.php` template to load as expected. **My code:**               function rr_404_my_event() {       global $post;       if ( is_singular( 'event' ) && !rr_event_should_be_available( $post->ID ) ) {         include( get_query_template( '404' ) );         exit; # so that the normal page isn't loaded after the 404 page       }     }          add_action( 'template_redirect', 'rr_404_my_event', 1 );      Code 2 from this related question \- same problem:               function rr_404_my_event() {       global $post;       if ( is_singular( 'event' ) && !rr_event_should_be_available( $post->ID ) ) {         global $wp_query;         $wp_query->set_404();       }     }          add_action( 'wp', 'rr_404_my_event' );      **My Issue:** Although it _looks_ good, I get a status `200 OK` if I check the network tab. Since it's a status `200`, I am afraid that search engines might index those pages too. **Expected Behaviour:** I want a status `404 Not Found` to be sent.


Link to a admin submenu item using a custom link

**Situation:** I am developing my first Wordpress plugin with multiple admin pages. This plugin has a menu and some submenus in _Admin Menu_. I am using Wordpress 3.9 on XAMPP, Windows 8.1 Pro. **Problem:** What I want to achieve is like _Add New_ button (link) which is in _All Posts_ page. I mean when one clicks on the _Add New_ link in _All Posts_ page, they are taken to the _Add New_ page itself, with the submenu _Add New_ selected. ![enter image description here](http://i.stack.imgur.com/YY8Hd.png) Here is my code:               function nes_general_settings_view () {          echo "In General Settings";     }          function nes_vendor_view () {          ?>         All Vendors <a href="<?=HOW_TO_LINK_TO_nes_vendor_new_view_function?>">Add New Vendor
            ...
         <?php          }          function nes_vendor_new_view () {          echo "In New Vendor";     }          function nes_tell_us_view () {         echo "In Tell Us";     }               add_action("admin_menu", function () {     add_menu_page(         "Our Service",            "Our Service",                    "manage_options",                     "nes_general_settings",               "nes_general_settings_view",          null,                                 4                                 );          add_submenu_page( "nes_general_settings", "General Settings", "General Settings", 0, "nes_general_settings", "nes_general_settings_view");          add_submenu_page( "nes_general_settings", "Vendors", "Vendors", 0, "nes_vendor", "nes_vendor_view");     add_submenu_page( "nes_general_settings", "New Vendor", "New Vendor", 0, "nes_vendor_new", "nes_vendor_new_view");          add_submenu_page( "nes_general_settings", "Tell Us", "Tell Us!", 0, "nes_tell_us", "nes_tell_us_view");      }); **Question:** How to generate such a link (in particular `HOW_TO_LINK_TO_nes_vendor_new_view_function` in source code)? Shall I use a special function to generate dynamic contents? And also can you tell me which file generates the _All Posts_ admin page, for the sake of reference?


Unable to save datetime custom meta field using update_post_meta() function

When I do something like this (in my plugin function inside WP admin):               $metaboxes = get_post_meta( $post_id );     echo "<pre>";     print_r($metaboxes);     echo "</pre>";     die();      I get all my metaboxes info **except the datetime**. Why is that? Where are they stored and how can I access them? I am using this plugin http://www.deluxeblogtips.com/meta-box/ to add custom meta fields to my content type like:               array(       'name'  => 'Date and time:',       'type'  => 'datetime',       'id'    => "rw_datetime",     ),      I want to save the `datetime` field if some other field has certain value using `save_post` function and this is not working for datetime for some reason:               update_post_meta($post_id, 'rw_datetime', '2013-08-28 11:11' );      But something like this for a text field is working nice:               update_post_meta($post_id, 'rw_some_textfield', 'This is working!' );      Why is that? Why it's not working for datetime and why it is working for other field types? How can I grab the datetime value if I know the `$post_id` and then update this field using `update_post_meta()` function? **UPDATE:** Code of my save_post function:               add_action( 'save_post', 'things_before_save' );           function things_before_save( $post_id ) {               // No auto saves          if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;               // make sure the current user can edit the post          if( ! current_user_can( 'edit_post' ) ) return;              // assure the post type         if ( ! get_post_type($post_id) == 'cards' ) return;              // working         update_post_meta($post_id, 'rw_some_textfield', 'This is working!' );              // not working ;(         update_post_meta($post_id, 'rw_datetime', '2013-08-28 11:11' );          }       Notice that I am not working with any variables, just with strings `This is working!` and `2013-08-28 11:11` to eliminate possible errors. So, I guess the problem is that rw_datetime is stored somewhere else and not at the same place as other metaboxes.


short code is not working in in custom wordpress theme it's only working in default theme

<?php /*template name: my template*/ ?>          <?php get_header(); ?>          <?php get_header(); ?>          <?php echo do_shortcode('[STORE-LOCATOR]'); ?>          <?php if ( have_posts() ) : while ( have_posts() ) : the_post();  ?>     <?php the_content(); ?>     <?php endwhile; else: ?>
<?php _e('Sorry, no posts matched your criteria.'); ?>
     <?php endif; ?>       I use this code in my template, and I also use my short code. But this short code is working only in default theme not in custom theme so please let me know how to use shortcode in custom theme.


WooCommerce After Payment Hook

I have made a custom post type called press_release, and connected it to the custom post type of woocommerce shop_order using a custom field, where the order_id is the same as the custom field value. I have also made another custom field called "pay_status" in the custom post type "press_release" which should be "Not Paid" if the order is not paid, and "Paid" if the order is paid. I am using the Authorize.net payment module (test mode). However when I use the woocommerce_payment_complete hook, then it shows that the press_release post does not exist, I have used the following way to check it, It always returns the email that post does not exist.               add_action('woocommerce_order_status_changed', 'pr_paid');          function pr_paid( $order_id ) {     $pr_args = array(         'post_type' => 'press_release',         'post_status' => array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', 'trash'),          'meta_key' => 'order_id',          'meta_value' => $order_id     );     $pr_post = new WP_Query($args);          if($pr_post->have_posts()) {     while($pr_post->have_posts()) : $pr_post->the_post();         $title = the_title();         $content = the_content();         wp_mail( 'email address here', '' . $title . '', '' . $content . '' );     endwhile;     } else {         wp_mail( 'email address here', 'Post Does Not Exist', 'Some content' );     }     wp_reset_query();     }      The custom post type is created using the hook woocommerce_new_order. Here is the code for it.               add_action( 'woocommerce_new_order', 'add_pr_to_db' );          function add_pr_to_db($order_id) {          $session = WP_Session::get_instance();     $title = $session['title'];     $desc = $session['desc'];          $new_post = array(         'post_type'     => 'press_release',         'post_title'    => $title,         'post_content'  => $desc,         'post_status'   => 'pending'     );          $prid = wp_insert_post( $new_post );          $image_url = $session['image'];     $upload_dir = wp_upload_dir();     $image_data = file_get_contents($image_url);     $filename = basename($image_url);     if(wp_mkdir_p($upload_dir['path']))         $file = $upload_dir['path'] . '/' . $filename;     else         $file = $upload_dir['basedir'] . '/' . $filename;     file_put_contents($file, $image_data);          $wp_filetype = wp_check_filetype($filename, null );     $attachment = array(         'post_mime_type' => $wp_filetype['type'],         'post_title' => sanitize_file_name($filename),         'post_content' => '',         'post_status' => 'inherit'     );     $attach_id = wp_insert_attachment( $attachment, $file, $post_id );     require_once(ABSPATH . 'wp-admin/includes/image.php');     $attach_data = wp_generate_attachment_metadata( $attach_id, $file );     wp_update_attachment_metadata( $attach_id, $attach_data );          set_post_thumbnail( $prid, $attach_id );          add_post_meta( $prid, 'order_id', $order_id );     add_post_meta( $prid, 'pay_status', 'Not Paid' );     }


Query for custom post type objects in a taxonomy and with a meta value

I want fetch all posts from the post type `book` in the custom taxonomy `book_tags` with the meta key `lang` and the meta value `en`. My code:               <?php      $args = array(          'post_type'      => 'book',         'posts_per_page' => 40,         'paged'          => "$paged",               'meta_query'     => array(             array(                  'key'     => 'lang',                 'value'   => 'en',                 'compare' => 'LIKE'             )         ),         'tax_query' => array(             array(                 'taxonomy' => 'book_tags',                 'field'    => 'slug',                 'terms'    => get_queried_object()->slug             )         )     );          $additional_loop = new WP_Query($args);           while ($additional_loop->have_posts()) :          $additional_loop->the_post();      This doesn’t work? Why? If I remove "meta_query" it works. Is there a bug in "meta_query"?


Copying blog from root to /folder (Not moving)

Here is the scenario - I want to COPY (not move) the blog from www.domain_name.com/ to www.domain_name.com/folder... I want to keep the copy in root folder intact but run the same blog on subdomain too (with entirely different database but replicated).. You might find me idiot to do that, but this is the need.. We are moving blog to sub folder but the scenario is such that it wants me to keep the copy intact in a root folder entirely (with it's independent database). We will remove the root blog later anyway.. It is just for time being. I can move the blog but not getting how can I replicate the blog (with independent database) in a sub directory.. Please share your views..


Overwrite CSS with without deleting it

I have some css in the theme that I am using, I want to keep the stock style.css without deleting any of it. I want to use my child-theme style.css to remove or hide some values of a class. I would like to do this so I do not have to update my css with each new theme update. This is what is in the stock theme               .et_pt_portfolio_entry {     border: 1px solid #dadada;     border-bottom: 1px solid #b7b7b7;     background: #fff;      padding: 5px;     -moz-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1);     -webkit-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1);     box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1);     margin-bottom: 7px;     }      This is what I want to use in its place                   .et_pt_portfolio_entry {         margin-bottom: 7px;         padding: 5px;         }      Normally I use display:none but I want to keep that class displaying, I just want to remove the other values without deleting the stock file. Thoughts?


Check if post id exist in table than only update instead of inserting new row

I am trying to add simple view counter for my advert and everything seems works fine with below code but only it is inserting each time new row on post "Update". What I want if the post id is exists than it should not add or modify anything into that table just ignore so view counter will use same row instead of multiple row of Function to insert row on publish or update               function get_publishing_id($post_id) {         global $wpdb;              $post= get_post($post_id);         if ($post->post_type == 'post'           && $post->post_status == 'publish') {                  if(empty ($counter)) {                      $counter = 1;                      $wpdb->insert(                      $wpdb->prefix . 'advert_views',                      array(                          'postid' => $post->ID,                         'view_count' => $counter,                     ),                     array(                         '%d',                         '%d'                     )                 );                       }              } // end if     } // end function     add_action('save_post','get_publishing_id');      Function to update table on view               function update_counter($post_id){              global $wpdb;              $query = "SELECT view_count FROM ".$wpdb->prefix."advert_views WHERE postid = $post_id";              $query_run = mysql_query($query);              if(mysql_num_rows($query_run) > 0) {                  $count = mysql_result($query_run, 0, 'view_count' );                  $count_inc = $count + 1;                  $query_update = "UPDATE ".$wpdb->prefix."advert_views SET view_count = $count_inc WHERE postid = $post_id";             @$query_update_run = mysql_query($query_update);                 }          }      Also one more thing I want to know in `function udaate_counter()` do I need to have `@$query_update_run = mysql_query($query_update);` or can be use alternate way?


Deleted feed in Wordpress, now Webmaster Tools deliver error 500 (server error)

I deleted the feed in my Wordpress-blog. Now, Google Webmaster Tools complains over the following URLS:               comments/feed/     feed/rss/     feed/      And states that it's a code 500 (server error). How in heavens name can I fix this? If it means I have to re-create the feed, so be it. Any good ideas? * * * I'm afraid not. I'm not a shark with codes, but I can so or so work my way around. I created the blog and because my theme didn't really allow me to turn off the feed without doing other things at the same time, I looked around in the templates and pushed a few buttons (so to speak). All of a sudden, I had removed the feed-thingy from the templates. All good. Alas, but then Webmaster Tools began to complain. And seriously: I've got no problem with the feed missing, I just don't get why GoogleBot so deseperately want's to index them. I've even disallowed them in the robots.txt ... but still it tries :D \--- AFTER REINSTALL --- Thanks for idea. Reinstalled it, but still no change: My browser just states: ERR_FILE_NOT_FOUND when I go into the /feed/ directory. Same with the others. Rather strange?


How to redirect to settings page once the plugin is activated?

I created the Plugin of my own. Everything seems OK but one thing I want to do in that plugin is redirect to the corresponding plugin settings page when the plugin is activate. **For example:**   `http://www.example.com/wordpress/wp-admin/options-general.php?page=rotator` Is there a way to redirect to the corresponding page on activation, for example with `register_activation_hook`?


Can't get content of all (19) posts - Incomplete Chunked Encoding

I've got some documentation stored in a WordPress install for something I'm developing, and I want to have a pure html, single page version of it in addition to the regular templated version which is navigated more like a blog. The idea of the pure html single page version is to be able to save it and include it with the product. The documentation is contained in 19 posts of a custom post type called articles. I've got the following functions in functions.php to set a few query vars on the articles post type.               // Always sort articles by menu_order     function sort_articles_by_menu_order( $query ) {         if( 'articles' == get_query_var( 'post_type' ) ) {             $query->set( 'orderby', 'menu_order' );             $query->set( 'order', 'ASC' );         }         return $query;     }     add_action( 'pre_get_posts', 'sort_articles_by_menu_order' );               // Output all posts on html docs tpl     function get_all_docs( $query ) {         if( isset( $_GET['html'] ) ) {             $query->set( 'posts_per_page', -1 );         }         return $query;     }     add_action( 'pre_get_posts', 'get_all_docs', 9999 );      I've also got the following function that checks for `?html` in the URL and switches to my single-page template.               // Use HTML template for articles if URL paramater set     function html_docs_template_redirect( $template ) {         if( isset( $_GET['html'] ) ) {             $new_template = locate_template( array( 'html-docs.php' ) );             if ( '' != $new_template ) {                 return $new_template ;             }         }         return $template;     }     add_action( 'template_include', 'html_docs_template_redirect' );      The `html-docs.php` template is pretty basic, it is just a html shell with the loop in the middle. It does not include `get_header()`, `language_attributes()` or `get_footer()`. The problem is that if I use `the_content()` or `apply_filters( 'the_content', get_the_content() )`, WordPress only returns some of the posts, then stops all output (doesn't even finish outputting the page template like `</body></html>` etc). In Chrome's console I see this error: `net::ERR_INCOMPLETE_CHUNKED_ENCODING` If I comment out the parts that get the content, everything works fine. Even if I call `get_the_content()` without applying filters it works fine. I've also tried using a different server with the same results. My template file - though I don't think this is where the problem lies.               <!doctype html>                   <meta charset="UTF-8">         <title>Aptus Documentation</title>
Aptus Documentation
                               <?php // Loop outputs content and stores nav             $contents = '';             if (have_posts()) : while (have_posts()) : the_post();                      $contents .= '
post_name . '">';                     $contents .= get_the_title();                 $contents .= '
';                 ?>                      <article id="<?php echo $post->post_name; ?>" class="doc">

<?php the_title(); ?>
                                                  <?php the_content(); ?>                         <?php //echo apply_filters( 'the_content', get_the_content() ); ?>

                  <?php endwhile; endif; ?>

Contents

                     <?php echo $contents; ?>

                              I _think_ I have also ruled out an encoding problem in the content of one of the posts, because depending on different things I try it stops output at a different post (it seems to just output a certain number of bytes before stopping). I am lost on this so would appreciate suggestions.


Hiding any option or menu from menubar

Just after logging in through the 'Login' menu when any valid user will reach to the profile page that time the 'Login menu will be hidden in a wordpress theme. That means after logging him/herself in he/she can't see the 'Login' menu.


Category name as same name as post type

Is it possible to have a post's category name the same as a CPT? I'm running into an issue where I have 2 different pieces of content for the same 'type' of thing. I have written articles that reside in the default post structure and in an 'events' category. I have an 'events' custom post type that does not have categories in the slug, so it just reads as site.com/events/event-name. I wish to have the articles portion be site.com/articles/events/event-article- name where as 'articles' would be a base for only editorial content and 'events' in this url is actually a category. I know there are all sorts of issues with things being named the same, however I thought this could be avoided by appending category bases etc. Is this possible?


Use phpbb user database for Wordpress

I've got a phpbb forum and recently I've added a Wordpress website to my domain. I want my phpbb users to be able to login to my Wordpress page using the same username and password they have on my phpbb forum. I've tried to get the connection working. But I can't. So does anyone have a solution for this?


Extend WP_Customize_Control with Multiple Field Control

I'm trying to figure out how to code a custom control but frustratingly all the information I find online points to the same example of creating a single textfield. I'd like to create a custom control which presents 4 input fields for padding (top,right,bottom,left)

             Top	             Right	             Bottom	             Left

             <input type="number" name="top" min="0" max="20">	             <input type="number" name="right" min="0" max="20">	             <input type="number" name="bottom" min="0" max="20">	             <input type="number" name="left" min="0" max="20">


How to split the Wordpress database?

I have a site that is used to log client and meal information. It is based on Wordpress, but has quite a bit of custom code. We have custom taxonomies set for the client and meal data. Our problem is that the database has gotten quite large and it's causing the site to operate very slow. I would like to essentially archive out the different years of the database into separate databases so that we could still refer back to some of the data if we needed to, but decrease the size of the database for the active year. I've searched for an archival tool or plugin that could do this, but haven't been able to find anything (most of the results are for Wordpress archives - not the actual process of archiving out data from the Wordpress database). For example, in my database, the "postmeta" table currently has 2,656,529 rows, the "posts" table has 241,725 rows, and the "term_relationships" table has 1,164,119 rows. The entire size of the database is 356.7 MB. We have custom reports created for the front-end admins to be able to generate meal & client reports, but they now will break if you select a date range longer than 1 month. FYI - I've ran the WP Optimize plugin and have removed all post revisions already (which were very few to begin with). What I need to do is actually split these tables of the database up so that all of the meals that have been logged for 2012 are separate from 2013 which neesd to be separate from 2014. Does anyone have any suggestions as to what we can do to get the database under control?


Revealing 'code' hidden button in TinyMCE4 and Wordpress 3.9.x

Please, I need help with Wordpress 3.9.1 and TinyMCE4. Before, with Wordpress 3.8.x and TinyMCE3, I have used this code in my _functions.php_ theme file to reveal the hidden 'code' button in TinyMCE3:               function my_mce_buttons_2($buttons) {     $buttons[] = 'code';     return $buttons;     }     add_filter('mce_buttons_2', 'my_mce_buttons_2’);      The 'code' button is used to open a little window in TinyMCE which shows the real HTML code. The before code is from a Wordpress Codex page. Well, now, with Wordpress 3.9 and TinyMCE4, this do NOT work anymore. I can't reveal this button. But, instead, if I follow the Wordpress Codex instructions linked before, and use 'superscript' or 'subscript' instead of 'code'... IT WORKS!! But don't know why, because 'code' is one of the buttons listed in the TinyMCE site as available. Please, help me, I don't have the programing knowledge to solve this on my own. THANKS. \-- Please, excuse my poor english, it's not my mother language.


When using javascript to dynamically add a textarea, how can I render it as a tinyMCE editor (in wordpress)?

I have a plugin that allows the user to dynamically add sections that need to have the tinyMCE editor in them. The jQuery clones a `div` and places it into a container. One of the input boxes is a textarea set up like so: `<textarea name="sectionContent_1" id="sectionContent_1"></textarea>` I need to replace the textarea with the tinyMCE editor. I've looked at: How to load wp_editor() through AJAX/jQuery and use wordpress wp_editor in dynamic/ajax html Neither of these seem to work for us I've tried this inside the trigger that calls to add the textarea section:               $(this).parent().find('.sectionOptions').html(ctHolder);          var textAreaID = 'sectionContent_'+sectionID;          tinyMCE.execCommand('mceRemoveEditor', true, textAreaID);     tinyMCE.execCommand('mceAddControl', false, textAreaID);      In this, I'm adding the cloned data (ctHolder) to the `.sectionOptions` setting the textarea's ID, resetting the editor on the ID, then adding control to the ID... this doesn't work but seems to be most commons suggestion.


Implementing Pillar Posts; Long Posts yet with Some Page-Like Handling?

One of the best blogging practices is that of writing "pillar posts" - featured content that's longer than a typical post and will likely generate a high volume of traffic to your site. Extensive tutorials, comprehensive user guides, and in-depth product reviews mostly fall into this category. They're the 1500-word behemoths that sit alongside your daily 300-word "update" articles. Most of the times, pillar posts can be thrown to the top of your site with stickies. This makes them visible, directs the user's attention, and keeps timeless content relevant. After a while, though, you might want to promote these posts to static pages - still searchable and useful, but with their own special spot on the blog. I have a series of articles I plan to write over the next month or so regarding the XML-RPC API built in to WordPress. It's a great system, but scantily documented ... so I'm going to put together some comprehensive method documentation. The thing is, my docs will cover roughly 5-6 different pillar posts. I want this content to be featured on my blog when it's published (once per week), but I'd also like the entire series to be repeated as a static page on the site. The static page would be broken up into individual pages (using `<!-- nextpage-->` to divide sections) so that each post is contained in a different section. How can I have my featured content be both individual posts on the blog and a separate static page? I'm looking at both usability and SEO here ... having the content duplicated is a huge negative, so a simple copy-paste job with both versions on the site isn't my goal. My first inkling would be to develop a custom post type for features like this with its own custom taxonomy. Each "post" would be an individual feature (custom post type) and would be owned by a series (custom taxonomy). Then each post could be included in the loop when published but also on the archive page for the series. So my question (and the reason I'm marking this as a wiki), is how would you approach this situation?


Large size image breaks template layout

If I upload a large size image inn my wordpress, the image breaks my template width. I have seen some templates which scale the large image's width to the maximum width of the post div. What CSS or code I need to change for that purpose? Thanks.


Allow WordPress users to 'follow' RSS feeds from blog authors

I have a WordPress blog that allows users to register. Each user will have their own profile page that has their picture and various information. I'd like users to be able to subscribe to RSS feeds in the WordPress blog such as feeds from categories and tags by clicking a "follow" button. Then the feeds would automatically appear on the User's Profile page. Then I'd like the option for the users to be able to unsubscribe to the feeds (unfollow) so it stops appearing on their profile page if they want. Is that possible? Can someone help me out with some code or a plugin? I looked everywhere and can't seem to figure out how to do this.


Could not create directory /wp-content/upgrade/

When I try to automatically install updates to Wordpress or plugins, I receive an error: > An error occurred while updating... Could not create directory .../wp- > content/upgrade/... My web host runs an Apache environment, and other Wordpress websites I own don't have this problem. I have CHMOD the /wp-content/upgrade folder to both 777 and 2777, without any change in the error message. I have installed the Core Control plugin, and the Filesystem Access module says the only error is that SSH2 is not available, but this is not required for automatic updates. How do I perform the command:               chown www-data:www-data /path/to/wp-content/ -R      from a Windows machine? Is it telnet, or putty? What commands do I use to login? Thanks.


Get most recent media upload

Wordpress sites this as an example of how to get the thumbnail: ` <?php echo get_the_post_thumbnail( $post_id, $size, $attr ); ?> ` I want to know how can I use the same basic function but just have it automatically get the latest media upload's ID number instead of having to specify the post_id.


404 on Pages for Custom Post Type & Query_Posts

It took me quite a while to find a good solution for ordering a custom post type by two custom meta keys. When I finally got it working, I found out the pagination no longer works. I've tried dozens of different code snippets found online but nothing has fixed my unique. I would appreciate any help I can get, or if you think rewriting would work, please provide me examples of a better way to do this. I have a custom post type named Episodes. These have season and episode numbers that I wish to sort by. archive-episodes.php               if ( get_query_var('page') ) { $paged = get_query_var('page'); }     else { $paged = 1; }     $args = array(       'post_type' => 'episodes',       'paged' => $paged,       'posts_per_page' => 10,       'orderby' => 'meta_value',       'meta_key' => 'season_number',       'meta_query' => array(             array(                 'key' => 'season_number',                 'value' => '',                 'compare' => 'LIKE'             ),             array(                 'key' => 'episode_number',                 'value' => '',                 'compare' => 'LIKE'             )         ));     query_posts($args);     if ( have_posts() ) : ?>              <?php /* Start the Loop */ ?>         <?php while ( have_posts() ) : the_post(); ?>         [...]      functions.php               add_filter('posts_orderby', 'edit_posts_orderby');     function edit_posts_orderby($orderby_statement) {         if(is_post_type_archive('episodes')) {             $orderby_statement = "mt1.meta_value, mt2.meta_value DESC";             return $orderby_statement;         }     }      I am aware that Query_Posts on an archive page is NOT best of practices, but I couldn't make the ordering work using pre_get_posts. If someone knows how to rewrite it to work in pre_get_posts I'm willing to try it. I understand my pagination may work again just by switching but I'm just not sure how to. Thanks!


Need Header slider plugin recommendation

i want the plugin to show header image slider with pagination and the images are **capable to change threw the admin panel**.* _integrating via theme_ *(template part) is very important. I tried wp-nivo and nivo jquery slider but it doesn't support to change the images threw admin panel. am diggingmy head for past 2 days.any one help me to get rid of this problem. thanks in advance


Two Search Boxes: one all content, one only titles

I would like to have two separate search functions. The first is fine how it is, the second, I would like to only search titles. I have tried the code suggested [here]( Two Search boxes: One only searches Titles, the other searches all content?), but do not know how to make the function conditional on the hidden value `('by-ref')` in my search form.               <form method="get" id="searchform" action="<?php bloginfo('home'); ?>/">     <input type="text" value="" name="s" id="search-text" />     <input type="hidden" name="search-type" value="by-ref" />     <input name="submit" type="submit" value="Go" />     </form>


Stopping WordPress' WYSIWYG Editor from Converting "didn't" into "didn'''''''''t"?

**didn't becomes didn''''''''''''''''''t** in Wordpress WYSIWYG editor. I searched a lot in google then found this solution   * http://www.lancebledsoe.com/how-to-turn-off-wordpress-smart-quotes/ I followed the steps of this article but when I activated the plugin I got this error at the top of dashboard: > The plugin generated 3 characters of unexpected output during activation. If > you notice “headers already sent” messages, problems with syndication feeds > or other issues, try deactivating or removing this plugin. Without checking, it solved the problem or not I deactivated the plugin, thought it can break the site. Is there any other solution to solved this problem? **WordPress Version is 3.0.1**


Displaying Posts Depending on Number of Comments and Latest Comments?

I would like to be able to display a list of posts on a page depending on when and how many comments they've got. Something similar to how it is here on stackexchange. To be more specific, I want:   * A page with the most commented posts.   * A page with the most recently commented posts.    * A page with all the uncommented posts. Help with this would be very appreciated, thanks in advance.


qTranslate in functions.php

I have a function which redirects user to certain page:               wp_redirect('http://address/page');      Usually I would just use:               <?php _e("<!--:en-->english permalink<!--:--><!--:de-->german permalink<!--:-->"); ?>      But this is specific situation and I can't use it this way... Any idea how to do this? Thanks!


single.php error

writingyourwaytosuccess.com/blog Attempting to view a single post returns the following error:               Fatal error: Call to undefined function atmosphere_posted_on() in     /home/content/46/7460046/html/wp-content/themes/atmosphere-2010/single.php on line 17      Thanks!


register_taxonomy - show in admin menu, but not on post type (edit) screen

I've been trying a lot of things so far and investigated core inside out, but couldn't find a way that allows me to **add the submenu item** , but **doesn't add the meta box** for a custom taxonomy. ## The Menu item               // From: ~/wp-admin/menu.php     // That is the file that builds the menu and submenu entries.     // This is the part, where it adds the submenu items for taxonomies.     // This gets repeated for every (custom) post type menu entry.     $i = 15;     foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {         if ( ! $tax->show_ui || ! in_array('post', (array) $tax->object_type, true) )             continue;              $submenu['edit.php'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name );     }     unset($tax);      ## The Meta Box               // From: ~/wp-admin/edit-form-advanced.php     // That is the file, that shows the content of a post type "edit" screen     // all taxonomies. Here it adds some meta boxes for taxonomies     foreach ( get_object_taxonomies($post_type) as $tax_name ) {         $taxonomy = get_taxonomy($tax_name);         if ( ! $taxonomy->show_ui )             continue;              $label = $taxonomy->labels->name;              if ( !is_taxonomy_hierarchical($tax_name) )             add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', null, 'side', 'core', array( 'taxonomy' => $tax_name ));         else             add_meta_box($tax_name . 'div', $label, 'post_categories_meta_box', null, 'side', 'core', array( 'taxonomy' => $tax_name ));     }      The `public` argument seems to only affect the query. The only factor, that I can see being responsible for both, adding the menu entry, as well as the meta box, is the `show_ui` argument. Please proof me wrong. Thanks.


Safe to throw 404 error in request filter?

I am working on a plug-in for my personal site and I would like it have a certain permalink structure (/projects/project-type/sub-type/project). To achieve this, I am using the `request` filter. Inside my hook method, I am checking to make sure that the taxonom(y|ies) (project_type) exists before I load the post type (project). If it does not, the filter throws a 404 error and loads the theme's error template instead of just showing the project. Is it safe to do this?               public function request( $request ) {         $dummy_query = new \WP_Query();         $dummy_query->parse_query( $request );              if ( ! $dummy_query->is_admin && isset( $request['project_type'] ) ) {             $last_segment = basename( $request['project_type'] );                  if ( false === get_term_by( 'slug', $last_segment, 'project_type' ) ) {                 $types = explode( '/', substr( $request['project_type'], 0, strrpos( $request['project_type'], '/' ) ) );                      foreach( $types as $type ) {                     if ( false === get_term_by( 'slug', $type, 'project_type' ) ) {                         header( 'HTTP/1.0 404 Not Found' );                         locate_template( array( '404.php' ), true, true );                         exit;                     }                 }                      $request['post_type'] = 'project';                 $request['project'] = $last_segment;                 $request['name'] = $last_segment;             }         }              return $request;     }      This code was modified from this answer.


Simple Data Table Update and Page Integration

There are a variety of tables (page-level, not database) in a website I manage that need to be regularly updated. The difficult issue is that this information is often only one or two data columns, so I usually snake the data into multiple columns. Here is an example. This reduces scrolling and fills the page much better, but it is very tedious to update by hand! I currently create the table in the editor using TinyMCE Advanced and then shift the cells by hand whenever new data is entered. For another example, I have a list of about 200 corporate members, which would be great to display in a table (even sortable and paged), but I only have two columns, the company name and logo. I would really like to be able to snake this into four columns to fill the page and avoid scrolling. That said, I also need a solution that is not time consuming to update! I looked into WP-Tables Reloaded, but this does not seem to have the ability to snake columns. Any suggestions would be greatly appreciated!


Add blogs to "Blogs i Follow" sidebar

We've been reading through the documentation and watched a video, and gone through all the options in the Dashboard, but whenever we try adding links to the Blog Roll or 'Blogs I follow' section, they never appear on my blog. How do you add favorite links/links to blogs to the side of the blog?


issue displaying variations in custom template using WPeC 3.8.9.2

I’m having trouble displaying variations in a custom built template, each time i call the wpsc function have_variation_groups() within my loop i get the following php error commerce/wpsc-includes/product-template.php on line 1419 [22-Nov-2012 23:27:39] PHP Fatal error: Call to a member function have_variation_groups() on a non-object in /home/tofapost/public_html/sandbox/wp/wp- content/plugins/wp-e-commerce/wpsc-includes/product-template.php on line 1419. have_variation_groups() is being called inside a WP_Query loop like so;               $args = array('post_type' => 'wpsc-product', 'posts_per_page' => -1);     $loop = new WP_Query($args);     while ($loop->have_posts()) : $loop->the_post();             ...           <?php if (wpsc_have_variation_groups()) { ?>     <fieldset>         <legend>             <?php _e( 'Product Options', 'wpsc'); ?>         </legend>

                 <?php while (wpsc_have_variation_groups()) : wpsc_the_variation_group();                 ?>
                                              <label for="<?php echo wpsc_vargrp_form_id(); ?>">                             <?php echo wpsc_the_vargrp_name(); ?>:                     	                     <?php /** the variation HTML and loop */?>                                              <select class="wpsc_select_variation" name="variation[<?php echo wpsc_vargrp_id(); ?>]"                         id="<?php echo wpsc_vargrp_form_id(); ?>" <?php while (wpsc_have_variations())                         : wpsc_the_variation(); ?>                             <option value="<?php echo wpsc_the_variation_id(); ?>" <?php echo wpsc_the_variation_out_of_stock();                             ?>>                                 <?php echo wpsc_the_variation_name(); ?>                             </option>                             <?php endwhile; ?>                         </select>
                 <?php endwhile; ?>

              </fieldset>     <?php } ?>               ...          endwhile;      Whats strange is other wpsc functions like, wpsc_the_product_id() and wpsc_product_has_stock() work while no functions related to variations do... Any help appreciated Thanks


Custom post type single-{custom}.php not working

I made a custom post type with the machine name special_media_post and wordpress is simply not seeing the single-special_media_post.php. I am at a complete lose. It keeps defaulting to the index.php Here is my code for my custom post type and its taxonomies:               //Post and Taxonomy stuff     //Register Custom Post Type     function special_media_post() {     $labels = array(         'name'                => _x( 'Media Posts', 'Post Type General Name', 'text_domain' ),         'singular_name'       => _x( 'Media Post', 'Post Type Singular Name', 'text_domain' ),         'menu_name'           => __( 'Media Post', 'text_domain' ),         'parent_item_colon'   => __( 'Media Post:', 'text_domain' ),         'all_items'           => __( 'All Media Posts', 'text_domain' ),         'view_item'           => __( 'View Media Post', 'text_domain' ),         'add_new_item'        => __( 'Add New Media Post', 'text_domain' ),         'add_new'             => __( 'New Media Post', 'text_domain' ),         'edit_item'           => __( 'Edit Media Post', 'text_domain' ),         'update_item'         => __( 'Update Media Post', 'text_domain' ),         'search_items'        => __( 'Search Media Posts', 'text_domain' ),         'not_found'           => __( 'No media posts found', 'text_domain' ),         'not_found_in_trash'  => __( 'No media posts found in Trash', 'text_domain' ),     );          $rewrite = array(         'slug'                => 'mediapost',         'with_front'          => true,         'pages'               => true,         'feeds'               => true,     );          $args = array(         'label'               => __( 'mediapost', 'text_domain' ),         'description'         => __( 'Post Type for Media', 'text_domain' ),         'labels'              => $labels,         'supports'            => array( 'title', 'editor', 'custom-fields', ),         'taxonomies'          => array( 'year', 'type' ),         'hierarchical'        => false,         'public'              => true,         'show_ui'             => true,         'show_in_menu'        => true,         'show_in_nav_menus'   => true,         'show_in_admin_bar'   => true,         'menu_position'       => 5,         'can_export'          => true,         'has_archive'         => true,         'exclude_from_search' => false,         'publicly_queryable'  => true,         'query_var'           => 'mediapost',         'rewrite'             => $rewrite,         'capability_type'     => 'page',     );          register_post_type( 'special_media_post', $args );     }          // Register Custom Taxonomy     function media_year()  {     $labels = array(         'name'                       => _x( 'Years', 'Taxonomy General Name', 'text_domain' ),         'singular_name'              => _x( 'Year', 'Taxonomy Singular Name', 'text_domain' ),         'menu_name'                  => __( 'Year', 'text_domain' ),         'all_items'                  => __( 'All Years', 'text_domain' ),         'parent_item'                => __( 'Parent Year', 'text_domain' ),         'parent_item_colon'          => __( 'Parent Year:', 'text_domain' ),         'new_item_name'              => __( 'New Year Name', 'text_domain' ),         'add_new_item'               => __( 'Add New Year', 'text_domain' ),         'edit_item'                  => __( 'Edit Year', 'text_domain' ),         'update_item'                => __( 'Update Year', 'text_domain' ),         'separate_items_with_commas' => __( 'Separate years with commas', 'text_domain' ),         'search_items'               => __( 'Search years', 'text_domain' ),         'add_or_remove_items'        => __( 'Add or remove years', 'text_domain' ),         'choose_from_most_used'      => __( 'Choose from the most used yearss', 'text_domain' ),     );          $rewrite = array(         'slug'                       => 'year',         'with_front'                 => true,         'hierarchical'               => true,     );          $capabilities = array(         'manage_terms'               => 'manage_categories',         'edit_terms'                 => 'manage_categories',         'delete_terms'               => 'manage_categories',         'assign_terms'               => 'edit_posts',     );          $args = array(         'labels'                     => $labels,         'hierarchical'               => true,         'public'                     => true,         'show_ui'                    => true,         'show_admin_column'          => true,         'show_in_nav_menus'          => true,         'show_tagcloud'              => true,         'query_var'                  => 'year',         'rewrite'                    => $rewrite,         'capabilities'               => $capabilities,     );          register_taxonomy( 'year', 'special_media_post', $args );     }          // Register Custom Taxonomy     function media_type()  {     $labels = array(         'name'                       => _x( 'Types', 'Taxonomy General Name', 'text_domain' ),         'singular_name'              => _x( 'Type', 'Taxonomy Singular Name', 'text_domain' ),         'menu_name'                  => __( 'Type', 'text_domain' ),         'all_items'                  => __( 'All Types', 'text_domain' ),         'parent_item'                => __( 'Parent Type', 'text_domain' ),         'parent_item_colon'          => __( 'Parent Type:', 'text_domain' ),         'new_item_name'              => __( 'New Type Name', 'text_domain' ),         'add_new_item'               => __( 'Add New Type', 'text_domain' ),         'edit_item'                  => __( 'Edit Type', 'text_domain' ),         'update_item'                => __( 'Update Type', 'text_domain' ),         'separate_items_with_commas' => __( 'Separate types with commas', 'text_domain' ),         'search_items'               => __( 'Search types', 'text_domain' ),         'add_or_remove_items'        => __( 'Add or remove types', 'text_domain' ),         'choose_from_most_used'      => __( 'Choose from the most used types', 'text_domain' ),     );          $rewrite = array(         'slug'                       => 'type',         'with_front'                 => true,         'hierarchical'               => true,     );          $capabilities = array(         'manage_terms'               => 'manage_categories',         'edit_terms'                 => 'manage_categories',         'delete_terms'               => 'manage_categories',         'assign_terms'               => 'edit_posts',     );          $args = array(         'labels'                     => $labels,         'hierarchical'               => true,         'public'                     => true,         'show_ui'                    => true,         'show_admin_column'          => true,         'show_in_nav_menus'          => true,         'show_tagcloud'              => true,         'query_var'                  => 'media_type',         'rewrite'                    => $rewrite,         'capabilities'               => $capabilities,     );          register_taxonomy( 'type', 'special_media_post', $args );     }          // Hook into the 'init' action     add_action( 'init', 'special_media_post', 0 );          // Hook into the 'init' action     add_action( 'init', 'media_year', 0 );          // Hook into the 'init' action     add_action( 'init', 'media_type', 0 );      If there is something else you need to see, I can put it up, but it doesn't even see it if I put an echo 'Hello World' in there. So it is simply not seeing either the single-special_media_post.php or the archive- special_media_post.php


Best way to automate the page/post publication process?

I'm working on a spreadsheet that has the contact information for thousands of training programs related to my niche. I'm wondering if any of you know a way to automate the process of creating a landing page for each entry. Each page will contain:   1. School name    2. School address   3. School phone number   4. School website   5. School accreditation date Since this is a very routine process, there must be a way to automate it all instead of posting 3,000+ landing pages. Let me know if you have any suggestions. Thank you.


How can I use AJAX with check-box categories?

How can I build a search filter (something like this) with WordPress? I have a custom post type name: "Locatii". It is a custom post type with categories. Ex: Cat 1 , Cat 2 ... and so on. How can I implement AJAX so that when I click Cat 1 ( checkbox) and Cat 2 I should retrieve the posts that are in that categories, without having a search button.


Article source link for posts

Is there a way to add a source link at the end of an article like TechnoBuffalo (scroll down to end of post) with a plugin? If someone could find a plugin or quickly make one for me that would be great.


How to preload the entire site with javascript?

I don't know if I'm in the right place because is not strictly for Wordpress, I think someone can get some benifit of this question without using Wordpress but in this case I'm using it. So, I'm using a modified theme with some plugin enabled, carousel, and other fancy things. There is a problem with some graphics, when I call the site from a remote host, and it's not cached, it's not quick as it's in localhost so all the images are preload in the same place one above the other and when the JS is ready all go in place, but you see a mess while the site is reading... This is not very nice as you thinking... My intention is to achive a "site is loading" pulsating or a progress bar while the site is ready in background. How to do this?


How should I set up a Tumblr blog at a WordPress Page?

I am developing a site for a client, let's call it `whatever.com`. He wants to have his Tumblr blog at `whatever.com/blog`. (Tumblr lets you name the URL at which your Tumblr page will be served, and if it's a site root, you adjust your domain's A-Record, which obviously I can't do here.) Right now I have a blank page called `blog` so that it shows up in the nav using `wp_list_pages()`, but I'm guessing this won't work unless I do some fiddling elsewhere. Anyone know how to do this?


How to Detect if I am on a bbpress 'plugin' page?

How can I check if I am on a forum page or forum post inside my theme. I am using the bbpress plugin (not standalone bbpress). There should be some conditional like is_bbpress() or something?


Refine search results using WP_Query

I am trying to modify (refine?) Worpress search results by using WP_Query, just as it's explained in the Codex. The snippet featured in that article is on the top of the Search Template PHP file, and all results are displaying accordingly. When I try to append the WP_Query array with arguments of my choice, to create a modified query (for example: posts containing term user searches for, not included in a certain taxonomy), WP_Query completely ignores the appended arguments and gives me the original search results all over again. Code below:               $search = new WP_Query(array( 'taxonomy' => 'media', 'field' => 'image', 'operator' => 'NOT IN'));      I also tried it this way, but I have a feeling it's completely wrong:               <?php     global $query_string;     $query_args = explode("&", $query_string);     $search_query = array();     foreach($query_args as $key => $string) {         $query_split = explode("=", $string);         $search_query[$query_split[0]] = urldecode($query_split[1]);     } // foreach     $args = array(             'tax_query' => array(             array(                 'taxonomy' => 'media',                 'field' => 'slug',                 'terms' => 'media',                 'operator' => 'NOT IN'             )         ),         $search_query     );      What follows is the usual:               if ( $search->have_posts() ) :         while ($search->have_posts() ) : $search->the_post(); ?>      I am not very fluent when it comes to coding, but trying to teach myself the quirks of Wordpress as a CMS. I read through replies on this site, none of the methods used did it for me, though. Can you see what I'm doing wrong? Thanks!


Should I change these content meta types before building complex archive page?

Hi and thanks in advance for reading this long question. I'm about halfway through building a site for a NYT bestselling author, and have hit a point where I realize I may not have organized myself in the best way in terms of data management. Before I go back and rebuild, I figured I should ask the experts their opinions. My stumbling block is how do I code the main Books archive page. I'd like it organized like this: Genre (organized in specific order, can be hard-coded) \-- Series (organized by which series contains the most recently published book OR by custom post order set by admin - either is acceptable) \--- Books (organized by custom field "Book in Series") \-- Series \--- Books Genre \-- Series \--- Books ... etc. I would also like each Genre and Series to have its own archive page. For the Genre archive it should again be organized by Series and then books within each series. **Here's what I'm set up now:** Books (Custom Post Type)   * Original Publication Date (custom field)   * ISBN (custom field)   * Featured Characters (custom taxonomy)   * Secondary Characters (custom taxonomy)   * Series name (custom taxonomy)   * Book in Series (#) (custom field)   * Synopsis (custom field)   * Additional freeform content (default content of post type Books) Book Excerpts (Custom Post Type)   * sets Parent ID for related book via dropdown list of books / custom field Book Praise (Custom Post Type)   * sets Parent ID for related book via dropdown list of books / custom field **My concerns**   1. What is the best way to code the Books archive page? Would it more efficient/easier to code if I made Series and Genre custom post types with parent/child relationships between themselves and the books, instead of custom taxonomies? **EDIT:** I ask because when I went to code this page I realized I would need to do multiple nested loops (I think, though maybe I could use something like the solution suggested here?).   2. Should I make Book Excerpts and Book Praise custom fields instead of separate custom post types? I need the content for each to display on a separate page from the single Book page to which it is attached, as it can be quite long.   3. Is there anything else I'm doing in a needlessly complicated way?  If it makes any difference, I have been using the Verve Meta Boxes and Custom Post UI plugins to create my various custom post types / taxonomies / custom fields. Thank you again for taking the time to read this and also for any advice you can throw my way! :-)