Using Custom Fields in Custom Post Type URL

I'm developing a car site that has showrooms. Each showroom needs it's own custom URL based on it's location. The location (City and County/State) is already inserted as two custom fields. So for example, if it's "Showroom A", located in Liverpool, Merseyside, it's URL would be the following:- http://www.domain.com/location/merseyside/liverpool/showroom-a/ I have a custom post type of "Showroom", that has it's rewrite rules set to false (though it was previously set to true earlier in the test). However when I create the post in question, there's an issue. The permalink is given as everything BAR the name of the showroom (i.e. http://www.domain.com/location/merseyside/liverpool/). Visting this URL causes a 404 error, and even adding "showroom-a" (for example) to the end of the code (http://www.domain.com/location/merseyside/liverpool/showroom-a/), also causes a 404 error. Here is my code.               function add_rewrite_rules()     {         // Register custom rewrite rules              global $wp_rewrite;              $wp_rewrite->add_rewrite_tag('%showroom%', '([^/]+)', 'showroom=');         $wp_rewrite->add_rewrite_tag('%post_custom_data%', '([^/]+)', 'post_custom_data=');         $wp_rewrite->add_permastruct('showroom', 'location/%post_custom_data%', false);          }                              function permalinks($permalink, $post, $leavename)     {         $no_data = 'no-data';         $post_id = $post->ID;              if($post->post_type != 'showroom' || empty($permalink) || in_array($post->post_status, array('draft', 'pending', 'auto-draft')))                  return $permalink;                        $state = sanitize_title_with_dashes(get_post_meta($post_id, 'state', true));         $city =  sanitize_title_with_dashes(get_post_meta($post_id, 'city', true));         $data = $state . "/" . $city;              if(!$data)                  $data = $no_data;                   $permalink = str_replace('%post_custom_data%', $data, $permalink);                        return $permalink;          }          add_action('init', 'add_rewrite_rules');     add_filter('post_type_link', 'permalinks', 10, 3);      Any ideas or help would be appreciated :)


Firing a function AFTER redirect

I am using a function that redirects the user to a custom page, rather than wp-login in the event of errors. In my case I am using the Http Referer function to send the user back to the same page because I have the login form in a modal. How can I execute a function on the redirected page, so that the page automatically opens the modal? This is the code for the redirect in the event of an error:               add_filter('login_redirect', '_catch_login_error', 10, 3);     function _catch_login_error($redir1, $redir2, $wperr_user) {         $rurl = $_SERVER['HTTP_REFERER'];         if(!is_wp_error($wperr_user) || !$wperr_user->get_error_code()) return $redir1;             switch($wperr_user->get_error_code()) {                 case 'incorrect_password':                  case 'empty_password':                  case 'invalid_username':                  default: wp_redirect($rurl); }             return $redir1;          }      This code courtesy of http://projectivemotion.com/2011/12/16/redirect-failed- login-attempt-wordpress/#comment-653 The function I want to execute after redirect is:               add_action('genesis_before_post', 'force_open_modal_1');     function force_open_modal_1() { ?>         <script type="text/javascript">         jQuery(document).ready(function($){             $('#loginmodal').reveal();         });         </script>     <?php }      Is this possible?


Google Authorship on a multi-author blog?

I hav been having some difficulties getting authorship set up for a multi- author blog. Everything appears to be set up correctly, but I am wondering if having multiple rel="author" tags on the home page is preventing the Google+ Profile of the main author from appearing in search results. By default, the wordpress theme I am using uses 'the_author_posts_link()' when linking to other blog posts on the home page. and internal pages.(this automatically adds 'rel="author"' to the link). Although, there is only 1 author profile who is actually linking to his Google+ Profile could have so many `rel="author"` tags be preventing his blog posts from displaying his Google+ Profile photo in the search results? On the specific posts of the author who I am attempting to have Google authorship for, his link looks like this:                     this link appears in the author box at the end of the authors' post. When testing a url of a post by the said author in the rich-snippets-tool, everything looks great. However, it doesn't appear that way in the search results. I have tried several configurations of this, including using plugins and having the author link in the . Any advice or suggestions are much appreciated. thanks.


If Post Meta Equals Current Title Conditional Advanced Custom Fields

I would like to create a custom query loop to display data depending on the current post title. Pseudo-code:               if post title = custom filed          Show related content      I have a page called `artists` made up of custom fields and I would like to show the discography for that artist. By pulling only the posts with the artists name from the discography posts which are in another custom post type. I found this page which is close but not quite right. I have a custom post type called `discography`, and within this post type I have a custom field called `dis_artist`. I am stuck being able to say if the current artist "post title" = "dis_artist" then show other data. How can I do that? * * * Hi I tried but Im not sure I have the right syntax. This piece of code sits within the current post loop               <?php     $args = array( 'post_type' => 'discography', 'posts_per_page' => -1 );     $loop = new WP_Query( $args );     while ( $loop->have_posts() ) : $loop->the_post(); ?>                 <?php     if ( get_the_title() === get_post_meta( get_the_ID(), "dis_artist", true ) ) {   ?>     <?php the_title(); ?>     <?php }    ?>             <?php endwhile; ?>


Get date of last update outside of loop

I'm trying to figure out how to display the date that a post was last updated outside of the loop. I'm able to display the published date using `get_the_time()` but there doesn't seem to be a "loopless" function to get the date of the last update. Does anyone know hot to do this?


How to place an image into header.php?

I'm trying to customize twentyten theme.   this is part of header.php:               <body <?php body_class(); ?>>

           //this img I cannot insert  !
      No errors. Simply - nothing happens.


How do I allow users to follow a post and then allow admins to email all users who have followed that post?

I'm looking to build out the following functionality, but I'm having trouble finding any help on it: user follows a post > user's email is pulled into an admin page and associated with said post > admin can then email all users who have followed a single post, updating them when a significant change has been made I'd appreciate any insights you have!


An alternative to Wordpress's built-in menu functionality

The main menu on my site contains about 30 items, and I am no longer able to save it. This seems to be a fairly common problem with bigger menus in Wordpress. I am on a dedicated server with very generous settings for PHP memory and execution time, but past a certain size, I just can't get menus to save. So, I need an alternative to Wordpress's built-in menu system. I want to keep the setup as flexible and quick to edit as possible. I can edit a flat file if need be, but the easier the better. ## Idea #1 Copy the menu's HTML into a static template file and replace calls to `wp_nav_menu()` with `get_template_part('my_menu_file')`. ## Problem I don't know how I would add `current-menu-item` class to the current menu item. I could live without the other utility CSS classes added by `wp_nav_menu`, but `current-menu-item` is pretty important. ## Idea #2 Since the menu is hierarchical, I could create one menu for the top-level items and separate menus for each dropdown, and then use a plugin like UberMenu to attach the submenus to their top-level items. ## Problem I would have to do a lot of tweaking and retrofitting to get the plugin- generated menu to look identical to the current menu. Are there other approaches or solutions that would make sense here?


Wordpress Categories from Plugin

I've got the Owl Carousel plugin installed, inside of it I can create some categories. Now I'd like to have these Owl Carousel categories displayed on the site, not the regular categories. What you see on the site right now is the regular categories such as 'Uncategorised' which is created from within the POSTS area of wp-admin. i tried using this but still just shows the wrong list of cateogies:               <?php wp_list_categories(               $args = array(               'post_type' => 'owl-carousel'              )      ); ?>       ![enter image description here](http://i.stack.imgur.com/RtKRC.png)   Regular categories page - ![enter image description here](http://i.stack.imgur.com/YTpDn.png) Owl Carousel Categories page   ![enter image description here](http://i.stack.imgur.com/faW7B.png)


Force multisite to use subdirectories on previous wordpress installation

Is it possible to force multi site to use subdirectories on the previous installation without affecting anything, as I am using godaddy shared hosting and it doesn't support subdomains on multisite on shared hosting. When I enabled multisite on the previous installation, it is only giving the options to multisite using subdomains & wordpress doesn't support it on shared hosting. Thus, i am unable to get multisite working on my wordpress blog.


Loop Navigation Problem

currently I have a loop on my index page which is set to show upcoming posts in ascending order. This is an events listing page. However the pagination at the bottom of my page doesn't work, I am not sure why but clicking on page 2 or page 3 etc will change the URL to /page/x/ but it will still show the first page of results. here is my index.php
                      <?php function filter_where($where = '') {                      $where .= " AND post_date > '" . date('Y-m-d', strtotime('0 days')) . "'";                      return $where;                      }                 add_filter('posts_where', 'filter_where');?>                      <?php query_posts('&order=ASC'); ?>                 <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>                      <div <?php post_class('eventlisting') ; ?>>                              <?php if (has_post_thumbnail()) : ?>                         <?php the_post_thumbnail(); ?>                         <?php endif; ?>

<?php the_title(); ?>
                             <?php if ( get_post_meta($post->ID, 'event-subtitle') ) :  ?>
<?php echo get_post_meta($post->ID, 'event-subtitle', true); ?>
                             <?php endif; ?>                             <?php if ( get_post_meta($post->ID, 'event-guests') ) :  ?>
<?php echo get_post_meta($post->ID, 'event-guests', true); ?>
                             <?php endif; ?>
<?php the_time('D d M Y');?>

<?php the_time('H:i');?>

<?php the_excerpt(); ?>
                             <?php if ( get_post_meta($post->ID, 'event-venue') ) :  ?>
<?php echo get_post_meta($post->ID, 'event-venue', true); ?>
                             <?php endif; ?>                             <?php if ( get_post_meta($post->ID, 'event-city') ) :  ?>
<?php echo get_post_meta($post->ID, 'event-city', true); ?>
                             <?php endif; ?>                             <?php if ( get_post_meta($post->ID, 'event-price') ) : ?>
<?php echo get_post_meta($post->ID, 'event-price', true); ?>
                             <?php endif; ?>

                                  <a href="<?php the_permalink();?>">» More Info                             <?php if ( get_post_meta($post->ID, 'event-link') ) :  ?>                                   <a class="buynow" href="<?php echo get_post_meta($post->ID, 'event-link', true); ?>">Buy Tickets                             <?php endif; ?>

                           <?php endwhile; ?>                          <?php numeric_pagination(); ?>                          <?php else : ?>
Nothing Found

Sorry, but you are looking for something that isn't here

<a href="<?php echo get_option('home'); ?>">Return To Homepage
                          <?php endif; ?>
       and here is the function I am using for my pagination.               // ************************************     // NUMERIC NAVIGATION     // ************************************          function numeric_pagination() {              if( is_singular() )             return;              global $wp_query;              if( $wp_query->max_num_pages <= 1 )             return;              $paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1;         $max   = intval( $wp_query->max_num_pages );              if ( $paged >= 1 )             $links[] = $paged;              if ( $paged >= 3 ) {             $links[] = $paged - 1;             $links[] = $paged - 2;         }              if ( ( $paged + 2 ) <= $max ) {             $links[] = $paged + 2;             $links[] = $paged + 1;         }              echo '

' . "\n";              /** Link to first page, plus ellipses if necessary */         if ( ! in_array( 1, $links ) ) {             $class = 1 == $paged ? ' class="active"' : '';                  printf( '
%s
' . "\n", $class, esc_url( get_pagenum_link( 1 ) ), '1' );                  if ( ! in_array( 2, $links ) )                 echo '
…
';         }              /** Link to current page, plus 2 pages in either direction if necessary */         sort( $links );         foreach ( (array) $links as $link ) {             $class = $paged == $link ? ' class="active"' : '';             printf( '
%s
' . "\n", $class, esc_url( get_pagenum_link( $link ) ), $link );         }              /** Link to last page, plus ellipses if necessary */         if ( ! in_array( $max, $links ) ) {             if ( ! in_array( $max - 1, $links ) )                 echo '
…
' . "\n";                  $class = $paged == $max ? ' class="active"' : '';             printf( '
%s
' . "\n", $class, esc_url( get_pagenum_link( $max ) ), $max );         }              echo '

' . "\n";          }      Any help would be greatly appreciated.


Limit comments per user per post

I use this code to limit the comments to 1 for registers users and works fine. The problem is that when i click to "go back" button in the browser i can comment again. Is there any effective way to limit the comments? Thank you!               global $current_user, $post;     $args = array( 'user_id' => $current_user->ID, 'post_id' => $post->ID );     $usercomment = get_comments( $args );     if ( 1 <= count( $usercomment ) ) {         echo 'disabled';     } else {         comment_form();     }


How to close tab automatically if URL has specific word?

help me today. Is it possible to close the tab automatically after loading/few seconds after checking if URL address has specific words? e.g; `http://mysite.com/post.php?deleted=1` Here `?deleted=1` is the word I'd like to check. I'm on wordpress. Thank you.


__() translation function throwing error when used within an associative array

This is what I am trying to do :               $meta_display_data = array(         'azc_publication_date'  => array('placeholder' => __('Date de l\'article', 'azc-publication')),         'azc_publication_title' => array('placeholder' => __('Titre de la revue', 'azc-publication')),         'azc_publication_link'  => array('placeholder' => __('Lien vers l\'article', 'azc-publication')),     );      But on line 2, 3 and 4 (the content of my associative array) Apache returns :               Parse error: syntax error, unexpected '(', expecting ')'      I am not sure why this wouldn't work. Is there a specific way to use the `__()` function to populate an associative array in Wordpress? Outputting the strings directly, the code is working fine, so the parenthesis issue does come from the `__()` function. Thanks a lot for clarifications.


How to add custom taxonomy terms to posts in bulk

I have a taxonomy called Teams. Now I want to assign different teams to posts based on their tags. For example, all posts with tag "LA Lakers" should be assigned the taxonomy term "LA Lakers"


Uploaded Images not re-sized to ( Thumbnail, Medium, and Large ) size

I have a WordPress site that was working perfect before moving to a new server, The problem is when I upload any image it uses the original size in all places in my website ( means no re-size for the image - Thumbnail, Medium, and Large), I use FTP to access the Upload folder and I found the original image only without (Thumbnail, Medium, and Large size). I checked my Media Setting and its okay without any problem, I hope someone could help.


Intergrating agile carousel to wordpress: how to write the ajax_callback function

json is totally new to me how to write an ajax_callback function for agile carousel to work in wordpress? Below is the jason data format that I need to write as php arrays for it could be parsed by $.getJSON() function.                [{           "content": "

",           "content_button": "

 Place Holder
"     }, {           "content": "

",           "content_button": "

 Place Holder
"     }]      Or do I even have to convert the data into php arrays?


Enqueue jQuery UI Tabs In Admin Area

Does anyone know how to enqueue the script "Jquery UI Tabs" in admin area? I want to use it inside my theme options page. Already read the related wordpress documentation but with no results... I have added UI Tabs to the front-end and works fine but I cant add it in the admin area... Thanks in advance.


How can I add (custom) modules to Appearance -> Menus?

Does anyone know how I can add (custom) modules to Appearance -> Menus? (Or has a link with explanation on how to do this) so that when people change their menu in the backend they can choose what to add to their menu (Pages - Post - Links - Categories - Tags - [custom module]) I ask this question because I want to build a one-page theme. I want to be able to add `<section>`s to the templates to separate the different 'pages'.   The (rough) idea I have, is create a function which 'scans' trough the templates, isolates the section ID's of these sections, and add them as a menu module to the backend. That way people would be able to add a menu item to one of these sections to their menus.


Looking up WordPress account information from Host or php files

I recently started working at a company where they would like their webpage to be updated. Unfortuantely, I only have the hosting information and the files that are associated with the FTP manager. The webpage loads and is running, but no one knows the WordPress account that it is linked to. The one they thought it was is not the the right one. It is for this website, http://adventcapitalpartners.com. Their company has a lot of email addresses, and I have tried entering a few different ones into Wordpress to see if they could recover the username/password without any luck. They use a theme purchased from ProPhotoBlogs.com and I do have all the coding files there. Is there a way that I can look up the username or email through the coding files? Or even the MySQL files? Kind of desperate for some ideas here, as nothing seems to be working! lol


Please help me to win the battle with 2 column loop by category

I need help with this code. How can I change the code so that the posts from one category to be arranged like the this scheme. scheme picture                   <?php query_posts('cat=3&showposts=1'); ?>         <?php while(have_posts()) : ?>         <?php         $postcount++;         if( ($postcount % 2) == 0 ) : // skip 'even' posts             $wp_query->next_post();         else :         ?>         <?php the_post(); ?>                                  <?php if ( function_exists( 'get_the_image' ) ) { get_the_image( array( 'custom_key' => array( 'post_thumbnail' ), 'default_size' => 'full','image_class' => 'alignleft', 'width' => '120', 'height' => '120' ) ); } ?>                   <?php endif; ?>         <?php endwhile; ?>         </div>              <?php $postcount = 0; rewind_posts(); ?>              <div class="even-column">         <?php query_posts('cat=3&showposts=2'); ?>         <?php while(have_posts()) : ?>         <?php         $postcount++;         if( ($postcount % 2) != 0 ) : // skip 'odd' posts             $wp_query->next_post();         else :         ?>         <?php the_post(); ?>                                  <?php if ( function_exists( 'get_the_image' ) ) { get_the_image( array( 'custom_key' => array( 'post_thumbnail' ), 'default_size' => 'full', 'image_class' => 'alignleft', 'width' => '60', 'height' => '60' ) ); } ?>              <?php endif; ?>         <?php endwhile; ?>         </div>


Missing tabs in my dashboard

I am a newbie to wordpress and I am trying to create a theme from scratch. Some tabs (e.g Users, Appearance->Widgets) are missing in the dashboard. I have manually added admin user via phpmyAdmin and I have added the following value for `wp_capabilities`               a:1:{s:13:"administrator";s:1:"1";}.       I have also added `wp_user_level` with a meta value of `10` How can I make the tabs to display


List Sub-Categories of a Parent Category

I need to be able to list categories that are the sub-category of a specific category that is a sub-category of a primary category. So something like this: Print Categories where ParentCategory = 'Parent' And ParentCategoriesParent = 'Main Parent' So I guess it's a depth of 2. Kind of a complicated category i'm going for but it will help my users navigate the site much easier.


How to create several Post pages

I have a question regarding the Posts.. When I create a new Post it will display on the Home page and not for ex. in the photogallery page where I want to have it... Is there any way how to define where I want to situate the post? Sorry if this is too easy but I´m beginner with wordpress.. I have bought a theme(site) Photopassion from the themeforrest, we have installed Wordpress and also the theme and it works fine just this is not clear to me.. Could you help please? Thank you in advace Lenka


Querying the DB to get sum of column from custom meta box (only published posts)

I am trying to get the SUM total of a custom meta box, from all published posts, from a custom post type. By using `$wpdb` I am able to get the sum from all of the posts (published and otherwise), but how do I extend my `$wpdb` query to fetch only the published posts?               global $wpdb;     $meta_key = 'rsvp-qty';     $all_guests = $wpdb->get_var( $wpdb->prepare(         "             SELECT sum(meta_value)             FROM $wpdb->postmeta             WHERE meta_key = %s         ",         $meta_key     ) );


Disappearing items in menu

I have problem with disappearing items in menu. I added               php_value max_input_vars 7000     php_value suhosin.post.max_vars 7000     php_value suhosin.request.max_vars 7000      to my .htaccess but it doesn't help. Can you help me?


Hard coded main navigation

Theme twentyeleven Version 1.5 * * * # HELP PLEASE _I have received an answer from @Mayeenul Islam but this has not resolved my question, if I can't make the navigation show active that's not the end of the world but I would really like to resolve the **title** and **name** issue below using what I have coded._ I have tried my hardest to find the answer myself. PHP Novice ;o/ * * * As I can't find a way to style the blogs main navigation to match clients main site I have removed this:
<?php _e( 'Main menu', 'twentyeleven' ); ?>
                 <?php /* Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff. */ ?>
<a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to primary content', 'twentyeleven' ); ?>"><?php _e( 'Skip to primary content', 'twentyeleven' ); ?>

<a class="assistive-text" href="#secondary" title="<?php esc_attr_e( 'Skip to secondary content', 'twentyeleven' ); ?>"><?php _e( 'Skip to secondary content', 'twentyeleven' ); ?>
                 <?php /* Our navigation menu. If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assigned to the primary location is the one used. If one isn't assigned, the menu with the lowest ID is used. */ ?>                 <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>                   and replaced with this:

<a href="<?php echo esc_url( get_permalink( get_page_by_path( 'the-blx' ) ) ); ?>">Home

|

<a href="<?php echo esc_url( get_permalink( get_page_by_path( 'what-the-blx-does' ) ) ); ?>">What The BLX Does

|

<a href="<?php echo get_category_link( get_category_by_slug( 'business-finance' ) ); ?>">Business Finance

|

<a href="<?php echo get_category_link( get_category_by_slug( 'business-general' ) ); ?>">Business General

|

<a href="<?php echo get_category_link( get_category_by_slug( 'blx-news' ) ); ?>">BLX News

|

<a href="<?php echo get_category_link( get_category_by_slug( 'book-of-blx' ) ); ?>">Book of BLX

|

<a href="<?php echo get_category_link( get_category_by_slug( 'johns-rant' ) ); ?>">John’s Rant

                   The BLX is set in the reading settings> A static page> Post page. Now I have three issue: **STYLING** 1) The #access ID in style.css was setting the font as bold when on that page but has stopped working.               #access .current-menu-item > a,     #access .current-menu-ancestor > a,     #access .current_page_item > a,     #access .current_page_ancestor > a {     font-weight: bold;     }      **CODING** For Page and Category - instead of have What The BLX Does (page) or Business (category)                   1) I would like to pass the page title         2) I would like to pass the a href title tag      So it would be something like this.
<a href="<?php echo esc_url( get_permalink( get_page_by_path( 'what-the-blx-does' ) ) ); ?>" title="<?php get_page_by_title( );?>"><?php get_page_by_title( );?>

<a href="<?php echo get_category_link( get_category_by_slug( 'business-general' ) ); ?>"  title="<?php get_category_by_title( );?>"><?php get_category_by_title( );?>
      Any help would be greatly appreciated. Thanks Dave


get_post_meta with WP_query

I know this is a convoluted loop (inherited from someone else), and this must be pretty simple: `the_permalink` and `the_title` display OK, but why doesn't my post meta `eventdatestart` echo?.               <?php     $queryObject = new WP_Query( 'post_type=events&posts_per_page=5' );     if ($queryObject->have_posts()) {     ?>

Events

             <?php         while ($queryObject->have_posts()) {             $queryObject->the_post();             ?>
          <a href="<?php the_permalink(); ?>"><?php the_title(); ?>          <?php echo get_post_meta(get_the_ID(), 'eventdatestart', true );?>
         <?php         }         ?>

         <?php     }     ?>


Hide WooCommerce out of stock product attribute items

I've created an attribute for WooCommerce products: size, it has three items, size1, size2 and size3. I can use `get_terms('pa_size', 'orderby=name&hide_empty=1');` to get size attribute items. Now size3 is out of stock but get_terms function returns it. How can I get only items that are in stock(only size1 and size2)?


Can posts_nav_link show post titles?

I have an index.php page that is only displaying 1 post at a time with a query. (found this code online, but it does work)               $page  = (get_query_var('paged')) ? get_query_var('paged') : 1;          // if we are paging     if ($page == 1) {         query_posts('order=DESC&posts_per_page=1&paged=$page');     } else {         $numposts  = get_option('posts_per_page');          // work out offset     $offset = (($page -1) * $numposts); // i.e. page 2 - 1 = 1 * 10 (10 for the number of posts)          query_posts("&order=DESC&offset=$offset&paged=$page&showposts=$numposts");      } This correctly shows one post per page, and it displays the navigation on the bottom of my template when I put a `<?php posts_nav_link(); ?>` in there. Is there anyway to change the "Next Page" and "Previous Page" links to be the titles of the posts themselves?


Adding upload button in metabox

I want to add upload image button for the images and retrieve url. Can someone pls help me, i have been trying this for quite a few days. I'm using code from this thread Create more Meta Boxes as needed.               add_action( 'add_meta_boxes', 'dynamic_add_custom_box' );          /* Do something with the data entered */     add_action( 'save_post', 'dynamic_save_postdata' );          /* Adds a box to the main column on the Post and Page edit screens */     function dynamic_add_custom_box() {         add_meta_box(             'dynamic_sectionid',             __( 'Client Information', 'myplugin_textdomain' ),             'dynamic_inner_custom_box',             'page');     }          /* Prints the box content */     function dynamic_inner_custom_box() {         global $post;         // Use nonce for verification         wp_nonce_field( plugin_basename( __FILE__ ), 'dynamicMeta_noncename' );         ?>
         <?php              //get the saved meta as an arry         $ourwork = get_post_meta($post->ID,'ourwork',true);              $c = 0;         if ( is_array( $ourwork ) ) {             foreach( $ourwork as  $track ) {                 if ( isset( $track['thumb'] ) || isset( $track['client-img1'] ) || isset( $track['client-img2'] ) || isset( $track['client-img3'] ) || isset( $track['client-img4'] ) || isset( $track['client-desc'] ) ) {                     printf( '
Thumb Image  : <input type="button" name="ourwork[%1$s][thumb]" value="%2$s" size="50" />

Client Image 1 : <input type="button" name="ourwork[%1$s][client-img1]" value="%3$s" size="50" />

                     Client Image 2 : <input type="button" name="ourwork[%1$s][client-img2]" value="%4$s" size="50"/>

                     Client Image 3 : <input type="button" name="ourwork[%1$s][client-img3]" value="%5$s" size="50" />

                     Client Image 4 : <input type="button" name="ourwork[%1$s][client-img4]" value="%6$s" size="50" />

                     Client Link     1 : <input type="text" name="ourwork[%1$s][client-link1]" value="%7$s" size="50" />

                     client Description :
<textarea id="elm1" class="tinymce_data" name="ourwork[%1$s][client-desc]" cols="75" rows="6" >%8$s</textarea>
                     %9$s
', $c, $track['thumb'], $track['client-img1'], $track['client-img2'] , $track['client-img3'], $track['client-img4'], $track['client-link1'], $track['client-desc'],  __( 'Remove Section' ) );                     $c = $c +1;                 }             }         }         ?>          <?php _e('Add Section'); ?>
<?php          }          /* When the post is saved, saves our custom data */     function dynamic_save_postdata( $post_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 $post_id;              // verify this came from the our screen and with proper authorization,         // because save_post can be triggered at other times         if ( !isset( $_POST['dynamicMeta_noncename'] ) )             return;              if ( !wp_verify_nonce( $_POST['dynamicMeta_noncename'], plugin_basename( __FILE__ ) ) )             return;              // OK, we're authenticated: we need to find and save the data              $ourwork = $_POST['ourwork'];              update_post_meta($post_id,'ourwork',$ourwork);     }


Facebook Comment Count

I am a bit of an amateur when it comes to PHP and WordPress but I have rigged up the following code:               function fb_comment_count($url = 'some url here') {     $filecontent = file_get_contents('https://graph.facebook.com/?ids=' . $url);     $json = json_decode($filecontent);     $count = $json->$url->comments;     if ($count == 0 || !isset($count)) {         $count = 0;     }     echo $count;     }      What it does is it retrieves the comment count from the Facebook Graph and displays it on a page. For it to work, I have to manually declare the url for each call. What I'm having a hard time with, is setting it up so that when you call the function in the template, it defaults to the post's permalink. I honestly have tried everything that has come to my mind. get_permalink() doesn't work when you declare the arguments in the function. Any help would be GREATLY appreciated. Thanks!


Get list of all registered post types slugs

I'd like to get a list (array) of all the post types I registered. Precisely I would like to retrieve their slugs. Could someone help me? thanks!


How To Disable Add new users On Subsites In Multisite?

How To Disable "Add new user" On Subsites In WordPress Multisite ? ![enter image description here](http://i.stack.imgur.com/oLINx.png)


Image upload callback in new 3.5 media

I am using new 3.5 media uploader in my theme frontend (base on this example). It is very simple when you want to do something with images after the `'Select'` button is pressed:               file_frame.on('select', function() {         // Get all attachments         var attachments = file_frame.state().get('selection').toJSON();              // Do stuff with attachments     });      But what if I want to do something with attachments just after they were upload? Something like:               file_frame.on('upload', function() {         // Do stuff with attachments     });      I didn't find anything useful in `'wp-includes/js/media-models.js'` or `'wp- includes/js/media-views.js'`. I have tried to attach a lot of events found in those files:               'add', 'url', 'select', 'ready', 'escapeHandler', 'keydown', 'attach', 'open', 'close', 'escape', 'recordTab', 'updateIndex', 'activate', 'dismiss', 'remove', 'reset', 'uploading', 'deactivate', 'create', 'render', 'change:content', 'scan', 'prepare', 'content:render:upload', 'content:render', 'content', 'updateIndex', 'recordTab', 'change:uploading', 'finish', 'done', 'upload', 'uploaded', 'save', 'saved','change:compat', 'compat'      But all these events fires not when I need this. Thanks!


Sorting a specific taxonomy by archive date using URL

OK, so I'm looking for a way to sort a specific taxonomy by archive date using the site URL. Say the custom taxonomy ("sort") value is "fruit" then then you would currently get all the posts marked as fruit with a link like this:               http://mysite.com/sort/fruit/          And to filter by archive date you will use:               http://mysite.com/date/2013/          The question is, is there a way to combine these 2 urls to just get posts marked as fruit in 2013? I tried `/sort/fruit/date/2013` and `/date/2013/sort/fruit/` and in both cases it just gives me an empty page. Any ideas?


Pre Get Posts / Multiple Meta Keys / Orderby Single Key

Tried more than a few variances to enable my `pre_get_posts` callback function to display posts that possess one, or both, of 2 separate meta_keys, upon display to then `orderby` a single meta_key. Here is a pastebin of the various attempts Namely I am able to display correctly via 2 separate keys but am unable to then orderby a single one of them, what am I missing to do this?


Building an email signup form. Where should the information be saved in the DB?

I would like to try build a simple plugin that collects and stores the name and email address of the person who filled in the form. I realize there are probably dozens of plugins out there that do this already but would like to build my own, for practice. If the user enters their name and email address, where should this be stored? Should it be created as a "subscriber" custom post type or a whole new table in the WP database? What are your thoughts? I'd like to eventually export the data to a .csv file if that influences where it should be stored.


Pass custom css class to add_menu_page

My theme currently uses add_menu_page() in order to display the theme options sections on the left hand admin menu. I would like to be able to attach a parent css class to the main menu item in order to selectively show/hide the menus for advanced users. I don't see this documented in the codex so I'm asking here to find out if there is a workaround or undocumented feature that I can utilize. Any help, much appreciated. The basic idea is that I have one main menu item and about 8 submenu items. Currently, all the menu items are displayed in the menu. I would like to use custom css to toggle the visibility of the submenu items, however, there is currently no custom id or class that I can use to target my menus.


use single form to enter multiple profiles

I want to allow users to add a business profile to their accounts. I have setup a form that posts the business profile information into user meta, and displays that info as part of their main profile. The challenge: some users will want to create more than one business profile. How can I use a single form to enter multiple business profiles into the database? I thought about using a counter to increment the user meta key name, but maybe there is a more efficient way?


Why can't I login to my "network sites"?

I have a Multi Site install that looks like this: main.dev.domain.com testsite.dev.domain.com dcdc.dev.domain.com on main.dev.domain.com I can login as admin and do all the regular stuff (like change themes) but then when I go to the dashboards of the other sites, all I get is a login box where NOTHING works. I know in Network Admin I need to add the user to that domain and I've done that and the sites under "users" I see that user is enabled. However, when I go to testsite.dev.domain.com/wp-admin (the way to get to the dashboard of the site) I get a login box where no username and password work (not the one that I made when I setup the new site or admin which I enabled). Is this by design? I finally changed the theme but I had to do it in edit site/setting where there is a long list of options and I just pasted in the theme path in there somewhere.


Wordpress Cron Job Counting Up and Not Down

I'm having a strange problem in which a WP Cron Job is counting "up" and not "down". Thus the job never runs. What I mean exactly should be clear from these outputs: > [19-Sep-2013 23:33:51 UTC] next sync: 0 hours, 0 minutes, 0 seconds   >  [19-Sep-2013 23:34:01 UTC] next sync: 0 hours, 0 minutes, 10 seconds   >  [19-Sep-2013 23:36:35 UTC] next sync: 0 hours, 2 minutes, 44 seconds   >  [19-Sep-2013 23:36:42 UTC] next sync: 0 hours, 2 minutes, 51 seconds   >  [19-Sep-2013 23:37:39 UTC] next sync: 0 hours, 3 minutes, 48 seconds   >  [19-Sep-2013 23:37:40 UTC] next sync: 0 hours, 3 minutes, 49 seconds Here is the code that sets the cron job:               function add_scheduled_interval( $schedules) {         $schedules['minutes_5'] = array('interval'=> 5*60, 'display'=>'Once 5 minutes');         $schedules['minutes_10'] = array('interval'=> 10*60, 'display'=>'Once 10 minutes');          return $schedules;     }     add_filter('cron_schedules', 'add_scheduled_interval');          function podio_plugin_activate() {         // Set up cron jobs for data integration         wp_schedule_event( time(), 'minutes_10', 'podio_plugin_sync' );     }      In the wordpress settings, the timezone is set to UTC+0. I've tried setting it to something else and saving; then setting back and saving again. Then I have deactivated and reactivated the cron job. Same results each time. I've looked around on the web and not been able to find anyone else reporting such a problem. Does anyone have any clues/ideas?


Links on the page, when being printed, have the URL next to them

I'm attempting to create a print.css stylesheet for my site and I'm running into an interesting problem. When I print any page on my site, all the links on the page are printing the URL directly next to it and it's causing all kinds of styling issues. At first I thought it might be my browser or printer, but other sites don't have this issue. Is there some setting in the admin section to remove these? I'm using the Boilerplate theme, which may be causing this issue.


wp_get_object_terms() to get a list of all the terms attached to all the posts in the current query

How can I use wp_get_object_terms() to get a list of all the terms attached to all posts in the current query? For example, for the current query I want to get an array of the terms from the "Alfa" taxonomy that are contained in all the queried posts.               wp_get_object_terms($wp_query, 'alfa');      But that only seems to be returning one item in the array... I am doing this to build an array to cross check one taxonomy with another for a navigation menu, and am currently doing this with the following code but I think there must be a better way. Please help! Thanks!               $queried_terms = array();     if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post();         $postid = $post->ID;               if( has_term( '', 'alfa', $postid) ) {             $terms = get_the_terms( $postid, 'alfa' );             foreach($terms as $term) {                 $queried_terms[] = $term->slug;             }         }          endwhile; endif;     rewind_posts();     wp_reset_query();          $queried_terms = array_unique($queried_terms);


After long time am here,I have one question. I Installed my wordpress in localhost and i moved to live,while i forgot the admin password,so i reset it by phpmyadmin(using md5).now i try to login by using with correct password it's redirect to This page and shows **You do not have sufficient permissions to access this page.** please anyone help me to solve this problem.


Dynamic page outside Wordpress

I have some data that I'm pulling from an XML source and would like to display it in Wordpress. One solution would be to take the static markup that my theme generates and spaghetti-code my page with some PHP that grabs the data from the XML and prints it in the page. Easy enough, but now every time I make a change to the theme I have to re-apply it to this page. Is there a more elegant solution that would allow me to inherit the whole site look n' feel and just append my data to it? Thanks


Why do some core functions get wp_ while others do not? What's the rule?

Is there some guideline or rationale behind why some WP code functions are prefixed with `wp_` ? eg: `wp_insert_post()` vs. `update_post_meta()`


Code in custom widget queries all posts, when it should only query the current post

I have a query in a custom widget (my first one!) which, if it's of custom post type `book`, retrieves the post ID. This then gets used in a WP_QUERY to retrieve data about the page. This works perfectly when in the static sidebar.php, but not in either a dynamic PHP Widget or as a custom widget in functions.php. In those, it retrieves the relevant field from all examples of post type `book`. Here's the offending code.                           <?php              if('book' == get_post_type()) :                  $ww_book_id = $post->ID;                  else :                      $ww_book_id = $default_book; //this is pulled in from the widget admin options form and works perfectly.             endif;                   $testimonial_args = array(                 'post_type' => 'book',                 'p' => $ww_book_id                  );             $main_testimonials = new WP_Query($testimonial_args);             if($main_testimonials->have_posts()) : while($main_testimonials->have_posts()): $main_testimonials->the_post();                    echo the_title(); //I actually do much more stuff than this, but it works for testing purposes.                  endwhile;          wp_reset_postdata();          endif;               ?>      Many thanks!


WP ecommerce - How do I change the product image for each product variation?

I would like to have the functionality for image to change when the user selects a different variation. ie, If I'm selling a T-shirt and have create two variations (Red and White). I would like for the main product image box to the image when the user selects a color. The Red shirt image should be displayed when the Red "Color" variation is selected. On the backend there is an area to add product thumbnails for each variation but that does not correspond with any change to the product image on the frontend.


wpdb->insert multiple record at once

So after I have created the table 'settings-table' i want to add a couple of records to it. This is how I want to do it, not the best way, so I need a better way to do this because I will add more records to the table. EXAMPLE 1                $wpdb->insert('settings-table', array('option_name'   => 'name-1',                                             'option_value'  => 'val-1',                                             'option_created'=> current_time('mysql'),                                            'option_edit'   => current_time('mysql'),                                            'option_user'   => 'user-1'                                             ));          $wpdb->insert('settings-table', array('option_name'   => 'name-2',                                             'option_value'  => 'val-2',                                             'option_created'=> current_time('mysql'),                                            'option_edit'   => current_time('mysql'),                                            'option_user'   => 'user-2'                                             ));      $wpdb->insert('settings-table', array('option_name'   => 'name-1',                                             'option_value'  => 'val-3',                                             'option_created'=> current_time('mysql'),                                            'option_edit'   => current_time('mysql'),                                            'option_user'   => 'user-3'       UPDATE this works(any other better solutions are welcome)               $wpdb->query("INSERT INTO settings-table                 (`option_name`, `option_value`, `option_created`, `option_edit`, `option_user`)                 VALUES                 ('name-1', 'val-1', current_time('mysql'), current_time('mysql'), 'user-1'),                 ('name-2', 'val-2', current_time('mysql'), current_time('mysql'), 'user-2'),                 ('name-3', 'val-3',  current_time('mysql'), current_time('mysql'), 'user-3')")


Custom Postype specific changes in admin panel

I have this small bit of code which does exactly what I need. But I want to limit its use to one Custom Post Type (CPT) only.               add_filter('sanitize_title', 'my_custome_slug');     function my_custome_slug($title) {         return str_replace('-', '', $title);     }      I've tried the following code with no luck:               function my_custome_slug($title){      global $post;         if ( $post->post_type == 'customposttype') {              return str_replace('*', '-', $title);              }         }      add_filter('sanitize_title', 'my_custome_slug');       Any help is appreciated. **EDIT:** Sorry i was not clear in my post. Wordpress is taking "Post Titles" and change them to "post-titles" in urls when we first enter the title in any new posts. My original question was , for a specific custom post type, i need to remove "-" in urls of the posts. So they will be "posttitles" ![enter image description here](http://i.stack.imgur.com/h8wx0.jpg) I thought the problem was using "sanitize_title" because every other example i found for custom post specific content loading in Admin panel works. But once i use sanitize_title in those examples, the result would simply make a blank url under the title field. The first code i've shared is doing this already. I've tried to limit it's function to a specific custom posttype but it simply didnt work. I need this feature and i saw its already possible. I just need to limit it to a specific custom post type. This is rather a backend problem (due to some internal structre) and not a frontend problem. Otherwise i would have tried it with htacess. So our main target is wordpress publish page on admin panel.


Display content from custom post type if match to main post category

I solved the problem of displaying from a custom post type in a post with this solution, however, I want to filter even more and only display the posts from custom post type that match the main post's category (or to be more precise the slug, but there's no difference in solution). I get the slug of the main post by using this:               $category_main = get_the_category();     $cat_slug = $category_main[0]->slug;     echo $cat_slug; // This is just to see if I got the right output      I get the slug from the custom post type in the same way, but it's within a loop that loops through the custom post types.               $category_course = get_the_category();     $cat_slug_course = $category_course[0]->slug;     echo $cat_slug_course;      So, what I want now, is to only display the posts from the custom type that match the slug of the original post. In pseudo-code this would be something like:               If $cat_slug_course is equal to $cat_slug, display all custom type posts with slug $cat_slug_course and none other      This is the loop used to display the custom type posts.               $args = array( 'post_type' => 'Course', 'posts_per_page' => 2 );     $loop = new WP_Query( $args );     while ( $loop->have_posts() ) : $loop->the_post();              $category_course = get_the_category();         $cat_slug_course = $category_course[0]->slug;         echo $cat_slug_course; // This is just to see if I got the right output         echo '
';             the_title();         echo '
';         the_content();         echo '
';     endwhile; ?>


Can somebody explain this mediaelement and audio tags

I'm using this built in audio tag. It works for mp3 but with wma I just get this "Download file" link. I read this: http://wordpress.org/support/topic/wmv-videos-are-not-playing but setting type="audio/vma" does not fix the problem. This is the link to some page that has the same problem as me: http://shastacosta.com/dwight/wp36-wma


Remove 'home' from nav menu

I moved my page navigation from the header to the footer and now I am trying to remove 'home' from the navigation. In functions.php I added this -                   register_nav_menus( array(         'primary' => __( 'Primary Menu', 'web2feel' ),     ) );     function wp_nav_menu_args( $args ) {           $args['show_home'] = false;           return $args;       }      which usually works, but hasn't this time. I couldn't work out how to put everything into JSfiddle, apologies. Here is my site.


Advanced Custom Fields Validation

Is there way to use custom validation on an advanced custom field? For example, I might not want a textfield to have a value that starts with certain prefix, or I might want a number field to have a value greater than 'x'. I might also want to run a regex against a value and return an error if it doesn't match.


Related posts meta_query CPT

i have two post type "Artists" and "Songs", in "Songs" i have a meta box with checkbox list of "Artists" names. i want to show related posts if any post have same value of post meta with artist name:               wp_reset_postdata();     global $post;     $artist_name = get_post_meta(get_the_ID(), "artist_name", true);          $args = array(         'post_type' => array('songs'),         'meta_key' => $artist_name     );          $query = new WP_Query;     return $query;      query should display posts with same value of meta box automatic. this is possible ?! more info: ![post type of artists names:](http://i.stack.imgur.com/iDsFH.jpg) ![Meta box of artists names in Songs post type](http://i.stack.imgur.com/pj1xF.jpg) ![Showing related songs by artists name in single page](http://i.stack.imgur.com/evxoX.jpg)


How to change taxonomy slug?

I have some registered taxonomies like this one:               /********************************* Género *****************************/          function genre_init() {         $labels_genre = array(         'name' => _x( 'Géneros', 'taxonomy general name' ),         'singular_name' => _x( 'Género', 'taxonomy singular name' ),         'search_items' =>  __( 'Buscar Género' ),         'popular_items' => __( 'Géneros Populares' ),         'all_items' => __( 'Todos los Géneros' ),         'edit_item' => __( 'Editar Género' ),         'update_item' => __( 'Update Género' ),         'add_new_item' => __( 'Añadir nuevo Género' ),         'new_item_name' => __( 'Nuevo nombre de Género' ),         'separate_items_with_commas' => __( 'Separa Géneros con comas' ),         'add_or_remove_items' => __( 'Añade o quita Géneros' ),         'choose_from_most_used' => __( 'Elige entre los Géneros más utilizados' )         );              // create a new taxonomy         register_taxonomy(         'Géneros',             'reviews',             array(                 'rewrite' => array( 'slug' => 'genre' ),                 'labels' => $labels_genre             )         );     }     add_action( 'init', 'genre_init' );          /**********************************************************************/      When using a plugin to show the links of each taxonomy value (e.g. "rock", "folk", ...) I saw the accent in the slug (`http://dcodedmagazine/?taxonomy=Géneros&term=rock`), so I tried to change the taxonomy name:               /**********************************************************************/          /********************************* Género *****************************/          function genre_init() {         $labels_genre = array(         'name' => _x( 'Generos', 'taxonomy general name' ),         'singular_name' => _x( 'Genero', 'taxonomy singular name' ),         'search_items' =>  __( 'Buscar Género' ),         'popular_items' => __( 'Géneros Populares' ),         'all_items' => __( 'Todos los Géneros' ),         'edit_item' => __( 'Editar Género' ),         'update_item' => __( 'Update Género' ),         'add_new_item' => __( 'Añadir nuevo Género' ),         'new_item_name' => __( 'Nuevo nombre de Género' ),         'separate_items_with_commas' => __( 'Separa Géneros con comas' ),         'add_or_remove_items' => __( 'Añade o quita Géneros' ),         'choose_from_most_used' => __( 'Elige entre los Géneros más utilizados' )         );              // create a new taxonomy         register_taxonomy(         'Generos',             'reviews',             array(                 'rewrite' => array( 'slug' => 'genre' ),                 'labels' => $labels_genre             )         );     }     add_action( 'init', 'genre_init' );          /**********************************************************************/      and now the in the plugin widget I have to choose "Genero" instead of "Géneros", but I'm still getting the same slug. I don't really understand why I'm not able to change the slug of a custom taxonomy created by me. Any idea of what I'm missing? **Edit:** Indeed, the other taxonomy slugs are: `artistas=alice-in-chains` and not: `taxonomy=artistas&term=alice-in-chains`. **2º Edit:** Debug mode was disabled. Enabling it I can see the next Notice for each "Géneros" field printed: `Notice: Trying to get property of non-object in /home/user/MyServer/project/wp-includes/taxonomy.php on line 3185`


How to change the default url for 'Posts' link?

I would like to change the default url `edit.php` to `edit.php?category_name=photos` when I click on "Articles". Thanks ![enter image description here](http://i.stack.imgur.com/g27fX.jpg)


Why I obtain different visualization when I run the website on my local machine and on remote server?

I am finding a very strange behavior with a WordPress main menu into this custom theme that use BootStrap: http://onofri.org/WP_BootStrap/ As you can see in the horizontal main menu the background of the voice related to the current page is red (ok, this is the right behavior) The problem is that in the local version of the same website (use the same theme, I have uploaded it from my local web server to the previous onine web server) I have a different visualization of the menu (there is no the red brackground), here below I am attaching a picture of the local version: ![enter image description here](http://i.stack.imgur.com/Znlof.png) This is the code that generate this main menu:

                         <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">                             Toggle navigation                                                                                </button>                              <a class="navbar-brand" href="<?php echo home_url(); ?>">                             <?php bloginfo('name'); ?>
                     <?php                         wp_nav_menu(array(                             'menu' => 'primary',                              'theme_location' => 'primary',                              'depth' => 2,                             'container' => 'div',                              /*'container_class' => 'navbar navbar-default',*/                             'menu_class' => 'nav navbar-nav',                              'fallback_cb' => 'wp_bootstrap_navwalker::fallback',                              'walker' => new wp_bootstrap_navwalker())                         );                     ?>
                                What could be the problem? the theme is the same.


Is it possible to query all posts that don't have an attachment?

I want to get a list of all posts that don't have an attachment and delete them. This question takes about getting all posts that _have_ an attachment, but I want the reverse of it. The brute force way to do it is to get all posts and then loop through them individually and then check if they have attachement or not. But I want to avoid it if possible.


excerpt not showing up

I have a custom template for homepage and in it, i want to display excerpt from some category. but not even the simple `the_excerpt()` isn't working. i tried `the_title` and `the_content`, but only title display not content. The following is my code,am i missing something?                <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>            <?php the_excerpt();?>          <?php endwhile;?>            <?php endif; ?>


Hide images from anonymous user?

I'd like to set my WordPress (self-hosted) site up so that you can only view images if you're logged in. I want it to be impossible to view the images without being authorized as a user of the site. This plugin is exactly what I need, but it's been abandoned and no longer works. What I want is:   * All logged in users can view all images   * All anonymous visitors can view no images Something a bit more granular than the above would be nice (for example, authorizing a few specific images for public viewing,) but that's the baseline. In essence, I want the Visibility editor, which is available for Posts and Pages:   ![Post/Page Visibility](http://i.stack.imgur.com/Cpc2e.png)   ..to be available for Files as well.   I want the user to be able to view a post without the images if he's not logged in. Is there a plugin or modification that does this? Google returned nothing.


Why orderbyb meta_value_num won't affect the generated SQL Query order?

I've exhausted myself with this and I couldn't figure out why when I do this               $myposts = new WP_Query( array('numberposts' => 5,     'offset' => '0',     'post_type' => 'noticias',     'orderby' => 'meta_value_num',     'order' => 'DESC',     'post_status' => 'publish',     'meta_key' => '_countview'     ));      wordpress queries the db with the following SQL:               SELECT SQL_CALC_FOUND_ROWS wp_posts.ID      FROM wp_posts INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id)      WHERE 1=1       AND wp_posts.post_type = 'noticias'       AND (wp_posts.post_status = 'publish')       AND (wp_postmeta.meta_key = '_countview' )      GROUP BY wp_posts.ID ORDER BY wp_posts.post_date ASC LIMIT 0, 5      did something change for 3.4 and i'm missing the syntax?


Schedule Page/CPT Revisions

I'm currently working on a wordpress installation that (ab-)uses wordpress Pages with extensive ammounts of custom fields to allow for simple handling of landingpages etc. Our users now asked for a simple solution that allows them to schedule changes to published wordpress for specific dates in the future. is there any plugin or wordpress functionality that enables this kind of behavior? thank you in advance!


Remove commas between tags

So I have been googling for quite some time now and I can't seem to solve this. A lot of sources refer to a file called `the_tags.php` but it's nowhere to be found. Can anyone point me in the right direction? Thanks.


Query_posts using two custom taxonomies not returning posts

If I remove `'relation'` and one of the taxonomy arrays the corresponding posts are returned for each taxonomy but when I add the `'relation' = 'AND'` no posts are returned. Is there a problem in my `$args`?               $queried_object = get_queried_object();      $taxonomy = $queried_object->taxonomy;     $term_id = $queried_object->term_id;     $term_slug = $queried_object->term_slug;     $term_name = $queried_object->term_name;          $args = array(         'post_type' => 'listing',         'posts_per_page' => '10',         'post_status' => 'publish',         'tax_query' => array(             'relation' => 'AND',             array(                 'taxonomy' => $taxonomy,                 'field'    => 'id',                 'terms'    => array($term_id),                 'operator' => 'IN'             ),             array(                 'taxonomy' => 'listings_categories',                 'field'    => 'slug',                 'terms'    => array('mortgage-loans'),                 'operator' => 'IN'             )         )         //'orderby' => 'meta_value',         //'meta_key' => 'listing_is_featured',     );          query_posts($args);


Get images uploaded to this post in popup on editor screen

I'm using the ZillaSortcodes plugin and add some functionality to build a shortcode to use the images uploaded to the post/page for an image grid. In the shortcode.class.php of ZillaShortcodes I use this code to retrieve all images uploaded to the post               $referer = parse_url($_SERVER['HTTP_REFERER']);     preg_match('/post=(\d+)&/', $referer['query'], $referedID);     $actual_post = $referedID[1];          $attachments = get_posts( array(         'post_parent'      => $actual_post,         'post_type'        => 'attachment',         'numberposts'      => -1,         'post_status'      => 'any',         'post_mime_type'   => 'image',         'order'            => 'ASC',         'orderby'          => 'menu_order',     ));      To get the post ID I have to be a little bit tricky and getting the ID from the URL. This works fine if the post/page is already saved and the shortcode popup looks like this. But this only works if the post is saved and there is a ID within the URL. Similar to the WordPress Media Manager where I can select "Uploaded to this post" I'm looking for a solution to get this to work even if this is a new post. Thanks for any tips


Exclude some authors from query

This script list users with their last post. How to exclude some authors from guery ?               <?php              //List of users sorted descending by date of lastest post written by user         $uc=array();         $blogusers = get_users_of_blog();              if ($blogusers)          {             foreach ($blogusers as $bloguser)              {                 $user = new WP_User( $bloguser->user_id );                 if ( !empty( $user->roles ) && is_array( $user->roles ) )                 {                     $userpost = get_posts('showposts=1&author='.$bloguser->user_id);                     $uc[$bloguser->user_id] = '';                     if ($userpost)                      {                         $uc[$bloguser->user_id]=$userpost[0]->post_date;                     }                 }             }             arsort($uc);             $i = 0;             foreach ($uc as $key => $value)              {                 $user = get_userdata($key);                 $post_count = count_user_posts($user->ID);                 if ($post_count && $i < 10)                  {                     $author_posts_url = get_author_posts_url($key);                          //preparing query for titles                     $args=array(                     'author' => $user->ID ,                     'post_type' => 'post',                     'post_status' => 'publish',                     'posts_per_page' => 1,                     'ignore_sticky_posts'=> 1,                     );                     $my_query = null;                     $my_query = new WP_Query($args);                          if( $my_query->have_posts() )                      {                         //echo 'List of Posts for ' . user->user_firstname . ' ' . $user->user_lastname;                         while ($my_query->have_posts()) : $my_query->the_post();           ?>


Wordpress loop for multiple custom post types

I want to loop through 3 custom post types + posts and display the latest post from each. This is what I have so far. This only takes the four most recent posts but not one only from each post type. Many thanks in advance               <?php $args = array(           'post_type' =>.  array('post','mixes','artists','releases'),           'posts_per_page' => '4',             );          query_posts( $args );     while ( have_posts() ) : the_post(); ?>            do stuff here                   <?php   endwhile; ?>


Custom Query Arguments

I want to run a query base on the following $args. My question that how to pass variable number of arrays to tax_query as currently i have two arrays within tax_query it can be 1 , 3 or 5 and so on. Is there any possibility ?               $args = array (                 'posts_per_page' => 10,                 'tax_query' => array(                     'relation' => 'OR',                     array(                         'taxonomy' => $Tax[0],                         'field' => 'slug',                         'terms' => array( $Tag )                     ),                     array(                         'taxonomy' => $Tax[1],                         'field' => 'slug',                         'terms' => array( $Tag )                          )                 ),                 'order' => 'DESC'                  );


Passing current cookies in wp_remote_get to get Draft Post Preview

I want pass current user cookies in wp_remote_get function to get a Draft Post Preview page content. I check already the questions:   * What URL do you pass to wp_remote_get to load the body of the current post's preview?   * How can I call "preview post" from wp_remote_get with authentication? But in either of them appears how I can get the cookies to the pass it to wp_remote_get function. I assume I can do what I want passing the cookies to wp_remote_get function, here in WordPress documentation mention how WordPress stores the cookies but how can I get them taking in care they use a hash value in the cookie name? What I want to do is given a Post ID get the content of the WordPress Post view page and analyse it. For the already published Posts all works fine, but for Draft Posts I get that the page doesn't exist. Here is the code simplified:               (...)     $post_permalink = get_permalink($post_id);     $response = wp_remote_get($post_permalink);     $whole_post_page = $response['body'];     (...)      This code is executed when the owner of the Post is editing it, so the user is already authenticated and the request is for a local Post. How I can accomplish that wp_remote_get returns me the Post Preview page content? as WordPress does when I go to the preview link in my browser. Thanks in advanced.


How to get 'Products' on home page?

I am using query post in loop.php               query_posts( array('post_type'=>array('product','post'),'paged'=>$paged ) );      So that the custom post 'product' (woocommerce product) can be displayed on home page. I am able to see 'product' & 'post' in home page of theme1 but not in theme2, what might be the problem?, suggest me place where I should check; What should I check?


How does WP handle multiple matching rewrite rules?

Here is my url to a custom type :               http://host/movie/my-slug      When I go to this link, I'm redirected to               http://host/movie/my-slug/?post_type=movie      which results in a 404 error. I use Rewrite Rule Inspector wordpress plugin for listing the matching rewrite rules. It appears that my url matches three rules : (regex new-url source)   * movie/([^/]+)(/[0-9]+)?/?$ index.php?post_type=movie&name=$matches[1]&page=$matches[2] movie   * (.?.+?)(/[0-9]+)?/?$ index.php?pagename=$matches[1]&page=$matches[2] page   * [^/]+/([^/]+)/?$ index.php?attachment=$matches[1] post Witch one Wordpress will choose for resolving my url ? Why do I have a 404 error ?


How To Find Out Wordpress Category Table in MYSQL?

I know WordPress stores all post data in `'wp_posts'` table. But here WordPress not define any category id or reference related with it. Please let me know, how 'wp_posts' table find out exact category? Please explain me in details.


409 error (Conflict) when trying to insert an image into a post

I've uploaded a Wordpress site to the live server and I get this error whenever I try to insert an image into a post: > **Conflict**   >  The server encountered an internal error or misconfiguration and was unable > to complete your request.   >  Please contact the server administrator, root@localhost and inform them of > the time the error occurred, and anything you might have done that may have > caused the error.   >  More information about this error may be available in the server error log.   >  Apache/2.2.0 (Fedora) Server at www.sitename.com Port 80 Just to be clear - the error appears only when i try to **insert** the image into the page. I can upload it to Media just fine. Also, it happens with external images as well as local ones. It seems enough to have an IMG tag with something in the SRC attribute for this to happen. It's very weird, I've installed Wordpress on many servers and never had this happen before.


Does post_meta data need to be unserialzed?

Is it possible to unserialize data in the mysql query at the run time? i don't want to use unserialize() function of php. I need to fetch the value "mathematics" from the below serialized value saved in wp_postmeta table using mysql query.               a:4:{s:39:"wpcf-fields-checkboxes-option-223412915";s:7:"science";s:39:"wpcf-fields-checkboxes-option-499894518";s:10:"technology";s:40:"wpcf-fields-checkboxes-option-1474335177";s:11:"engineering";s:40:"wpcf-fields-checkboxes-option-1018405300";s:11:"mathematics";}          Array     (     [wpcf-fields-checkboxes-option-223412915] => science     [wpcf-fields-checkboxes-option-499894518] => technology     [wpcf-fields-checkboxes-option-1474335177] => engineering     [wpcf-fields-checkboxes-option-1018405300] => mathematics     )


Download Manager in a Multisite setup

I'm currently running a Wordpress Multisite (Network) and need a solution for a download manager. The specific requirement is that there should only be one file repository/db table that is used by all sites. So whenever a user adds a download in one of the subsites it should be available in all all the other sites as well. "Available" meaning it should be entered into a post by shortcode. Additionally, uploaded files should only be available for registered users. I have looked into a couple of available plugins (Download Monitor, CM Download Manger,WP Download Manger). They all offer "Multisite Support" but as far as I have seen only by providing an individual repository for each site that is separated from the other sites. Anybody already running a setup like this?


Get user role by using user_id in buddypress

I need to classify the user according to their role, so I need to find the user role by using the user_id alone (not only for logged in users but for all the BP users). Something like this `$user_role=role($user_id);`


Wordpress media uploader button is not working

I'm developing my own plugin. for that i need to upload logo images. since i'm a newbie in wordpress i searched so many tutorials. the code i used is pasted below. the problem is when i clicks on the upload button nothing happens. but the demo plugin which i used as a reference performs well. can't figure out what may be the mistake. can anyone plz help me to sort this out. part of my plugin's code:               function ckt_admin_scripts()      {     if (isset($_GET['page']) && $_GET['page'] == 'my_custom_submenu_page')      {                          wp_enqueue_media();            wp_register_script('my-admin-js',CKT_RESULT_PLUGIN_URL.'my-admin.js', array('jquery'));            wp_enqueue_script('my-admin-js');      }      }      add_action('admin_enqueue_scripts', 'ckt_admin_scripts');               function my_custom_submenu_page() {            echo '

';         echo '
Add New Matches

';                 echo '<form id="form-options" action="" type="post" enctype="multipart/form-data">';                 echo 'Enter the Match title: '.'<input type="text" id="mname" name="mname"/>
';                 echo '
Enter Team1 details (First Batting)

';                 echo 'Name: '.'<input type="text" id="t1name" name="t1name"/>

';                 echo 'Logo:'.'<input type="text" id="upload_image"  value="" size="40" /><input type="button" id="upload_image_button" value="Upload Image" />';                 echo '

';                 echo '<input name="submit" id="submit_option" type="submit" class="button button-primary" value="Save Settings"/>';                 echo '</form>';     echo '
';              }      The Js file code:               jQuery(document).ready(function($){               var custom_uploader;               $('#upload_image_button').click(function(e) {              e.preventDefault();              //If the uploader object has already been created, reopen the dialog         if (custom_uploader) {             custom_uploader.open();             return;         }              //Extend the wp.media object         custom_uploader = wp.media.frames.file_frame = wp.media({             title: 'Choose Image',             button: {                 text: 'Choose Image'             },             multiple: false         });                   custom_uploader.on('select', function() {             attachment = custom_uploader.state().get('selection').first().toJSON();             $('#upload_image').val(attachment.url);         });              custom_uploader.open();            });               });


Single.php back button to parent category

I want to add a back button that goes to the parent category of the actual single post that the user is viewing. How can I do that?
Return
      Thank you.


Programmmatically adding a Custom Post

I've added a custom post type, on the 'init' action, like so:               // Setup the 'Classifieds' Post Type         $labels = array(             'name' =>                   _x('Classifieds', 'post type general name'),             'singular_name' =>          _x('Classifieds', 'post type singular name'),             'add_new' =>                _x('Add New', 'classifieds'),             'add_new_item' =>           __('Add Classifieds Item'),             'edit_item' =>              __('Edit Classifieds'),             'new_item' =>               __('New Classifieds Item'),             'view_item' =>              __('View Classifieds'),             'search_items' =>           __('Search Classifieds'),             'not_found' =>              __('No classifieds found'),             'not_found_in_trash' =>     __('No classifieds found in Trash'),              'parent_item_colon' =>      '',             'menu_name' =>              'Classifieds'         );              // Configure the 'Classifieds' post type         $args = array(             'labels' =>                 $labels,             'public' =>                 true,             'publicly_queryable' =>     true,             'show_ui' =>                true,             'show_in_menu' =>           true,              'query_var' =>              true,             'rewrite' =>                array("slug" => "classifieds"),             'capability_type' =>        'post',             'has_archive' =>            true,              'hierarchical' =>           true,             'menu_position' =>          5,                                                           'supports' =>               array('title',                                             'editor',                                             'author',                                             'thumbnail',                                             'excerpt',                                             'trackbacks',                                             'custom-fields',                                             'revisions',                                             'comments',                                             add_theme_support( 'post-formats',                                                                  array('aside', 'gallery')                                                             )                                         ),             'taxonomies' => array('category', 'post_tag')         );         // Add the 'Classifieds' post type         register_post_type('classifieds', $args);      My problem is when I want to insert a custom post programatically, like so:               $cat_ID = get_cat_ID( 'calendar' );                      $data = array(                     'post_content' => stripslashes($output),                     'post_title' => stripslashes($title),                     'post_date' => date('Y-m-d H:i:s'),                     'post_category' => array($cat_ID),                     'post_status' => $statusPost,                     'post_author' => $post_author                 );                 $post_id = wp_insert_post($data);      The custom post is displayed under the Admin's generic 'Post' type post, not under the custom post type of 'Classifieds' which I created above. Does anyone have any suggestions?


TinyMCE Autoresize

Looking for a way to make the TinyMCE editor always relative to it's content so that the height of the editor changes accordingly to how much text/images it contains. There seem to be plugins for TinyMCE for this already, but I'm not sure on how to apply it for the Wordpress version: http://www.tinymce.com/wiki.php/Plugin:autoresize               function init_tinymce_autoresize($initArray){        $initArray['plugins'] = "autoresize";        return $initArray;     }     add_filter('tiny_mce_before_init', 'init_tinymce_autoresize');      Does not work. Ideas?


Order posts by ID in the given order

In the back-office of my theme, the users can choose which posts to display in the front page, and they can also choose **in which order the selected posts should appear**. I have tried like this:               $aPostsIDs = array(1,3,2); // Note the 3 should appear before the 2     query_posts(array('post_type' => 'page',                        'post__in' => $aPostsIDs,                       'order_by' => 'FIELD(ID, '.implode(',',$aPostsIDs).')'));      But as expected it doesn't work. The right way to do it according to the codex is:               add_filter('posts_orderby', 'edit_posts_orderby');     function edit_posts_orderby($orderby_statement) {         global $aPostsIDs;         $orderby_statement = 'FIELD(ID, '.implode(',',$aPostsIDs).')';         return $orderby_statement;     }      But that still doesn't work! The posts are ordered by ID (1, 2, 3) instead of the given order (1, 3, 2). Where should I look? Thanks


Blog page won't show Blog template

I set my "Blog" page to a Blog template I created in Pages (in the dashboard). Also, in Settings > Reading, I set my Home page (home template) as my Front page and my Blog page as my Posts page. However, when I navigate to my Blog page, it shows the home template. Yet, the body class of the Blog page is `blog logged-in`. I am confused. How can I make my Blog page show my Blog template? I pasted my Blog template here for reference: http://pastebin.com/6ML30D7N


What is a good member directory plugin?

I'm working on a site for a local homeschool group, and they'd like to have a page(s) with a member directory on the site. Any suggestions? Something like the Business Directory plugin would probably be great, just more focused on listing individuals. Edit: I actually want a plugin that lets me create listings manually, as opposed to using the existing user/member list in WordPress. That will work better in this case.


Do stuff when editing or writing a certain custom post type?

I would like to add extra js file to a backend when editing or creating a custom post type. I found pretty good answer to it but it has a flaw, it wont work when editing the custom post type, only on create and archive view. Thank you :)


How to search for users based on added user metadata

I have added several new fields to the user profile (areacode, company, affiliate, etc) and I would like to present a way to search on these fields. Please point me in the right direction.


Fatal error: Allowed memory size of bytes exhausted (tried to allocate 36 bytes)

I' fetching some information from my website e.g `category_name`, `category_id` etc. with wordpress codex and encode them with json. I'm using them in my android application, but today, suddenly, it gave Fatal error, I can't get any data now. Error : > Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to > allocate 45 bytes) in C:\WT-NMP\WWW\wp-includes\wp-db.php on line 1565 Here are the codes (it is giving error) :               if(isset($_GET['ana_kategori'])){              $rules=array(             'parent'=>0,         );              $categories = get_categories($rules);              if($categories){                  foreach($categories as $category) {                 if((($category->term_id)!=1)) {                     $postsrules = array(                         'posts_per_page' => -1,                         'category' => $category->cat_ID,                         'post_status'=> 'publish'                         );                          foreach ( $myposts as $post ) {                              $videoimg=get_post_meta( $post->ID);                         if($videoimg['small_icon']!=null) {                             $videoimg=$videoimg["small_icon"];                             break;                         }                     }                          $output[]=array(                         'Category_Name'=>$category->name,                         'Term_ID' => $category->term_id,                         'Image' => $videoimg[0],                         );                      $videoimg[0]=null;                 } // if             } // foreach                  echo json_encode($output);              } // first if     }      I changed the `memory_limit` in php.ini to `512M` but it didn't work. So I've changed again, `8096M`, still the same. I'm using the same algorithms as it. They are working great, but this is not working. Any suggestions to what my problem might be?


Can't get permalinks working!

I can't get WordPress pretty permalinks to work on my Fedora LAMP server. If I set them and click a page/post link I'll get a ""Oops! This link appears to be broken."   * The .htaccess file is writable and being updated,    * mod_rewrite module seems to be loaded in my httpd.conf (See below)   * The errors in my apache log say simply "Document not found". I'm at the end of my rope! Here's the **httpd.conf** :               ### Section 1: Global Environment          # start the rewrite engine (I ADDED THIS)     RewriteEngine on           ServerTokens OS          ServerRoot "/etc/httpd"          PidFile run/httpd.pid          Timeout 120          KeepAlive Off          MaxKeepAliveRequests 100          KeepAliveTimeout 15          <IfModule prefork.c>     StartServers       8     MinSpareServers    5     MaxSpareServers   20     ServerLimit      256     MaxClients       256     MaxRequestsPerChild  4000     </IfModule>               <IfModule worker.c>     StartServers         2     MaxClients         150     MinSpareThreads     25     MaxSpareThreads     75      ThreadsPerChild     25     MaxRequestsPerChild  0     </IfModule>          #     # Listen: Allows you to bind Apache to specific IP addresses and/or     # ports, in addition to the default. See also the <VirtualHost>     # directive.     #     # Change this to Listen on specific IP addresses as shown below to      # prevent Apache from glomming onto all bound IP addresses (0.0.0.0)     #     #Listen 12.34.56.78:80     Listen 80          LoadModule auth_basic_module modules/mod_auth_basic.so     LoadModule auth_digest_module modules/mod_auth_digest.so     LoadModule authn_file_module modules/mod_authn_file.so     LoadModule authn_alias_module modules/mod_authn_alias.so     LoadModule authn_anon_module modules/mod_authn_anon.so     LoadModule authn_dbm_module modules/mod_authn_dbm.so     LoadModule authn_default_module modules/mod_authn_default.so     LoadModule authz_host_module modules/mod_authz_host.so     LoadModule authz_user_module modules/mod_authz_user.so     LoadModule authz_owner_module modules/mod_authz_owner.so     LoadModule authz_groupfile_module modules/mod_authz_groupfile.so     LoadModule authz_dbm_module modules/mod_authz_dbm.so     LoadModule authz_default_module modules/mod_authz_default.so     LoadModule ldap_module modules/mod_ldap.so     LoadModule authnz_ldap_module modules/mod_authnz_ldap.so     LoadModule include_module modules/mod_include.so     LoadModule log_config_module modules/mod_log_config.so     LoadModule logio_module modules/mod_logio.so     LoadModule env_module modules/mod_env.so     LoadModule ext_filter_module modules/mod_ext_filter.so     LoadModule mime_magic_module modules/mod_mime_magic.so     LoadModule expires_module modules/mod_expires.so     LoadModule deflate_module modules/mod_deflate.so     LoadModule headers_module modules/mod_headers.so     LoadModule usertrack_module modules/mod_usertrack.so     LoadModule setenvif_module modules/mod_setenvif.so     LoadModule mime_module modules/mod_mime.so     LoadModule dav_module modules/mod_dav.so     LoadModule status_module modules/mod_status.so     LoadModule autoindex_module modules/mod_autoindex.so     LoadModule info_module modules/mod_info.so     LoadModule dav_fs_module modules/mod_dav_fs.so     LoadModule vhost_alias_module modules/mod_vhost_alias.so     LoadModule negotiation_module modules/mod_negotiation.so     LoadModule dir_module modules/mod_dir.so     LoadModule actions_module modules/mod_actions.so     LoadModule speling_module modules/mod_speling.so     LoadModule userdir_module modules/mod_userdir.so     LoadModule alias_module modules/mod_alias.so     LoadModule rewrite_module modules/mod_rewrite.so     LoadModule proxy_module modules/mod_proxy.so     LoadModule proxy_balancer_module modules/mod_proxy_balancer.so     LoadModule proxy_ftp_module modules/mod_proxy_ftp.so     LoadModule proxy_http_module modules/mod_proxy_http.so     LoadModule proxy_connect_module modules/mod_proxy_connect.so     LoadModule cache_module modules/mod_cache.so     LoadModule suexec_module modules/mod_suexec.so     LoadModule disk_cache_module modules/mod_disk_cache.so     LoadModule cgi_module modules/mod_cgi.so          #     # The following modules are not loaded by default:     #     #LoadModule cern_meta_module modules/mod_cern_meta.so     #LoadModule asis_module modules/mod_asis.so          Include conf.d/*.conf          User apache     Group apache          ### Section 2: 'Main' server configuration               ServerAdmin root@localhost          UseCanonicalName Off          DocumentRoot "/var/www/html"          <Directory />         Options FollowSymLinks         AllowOverride None     </Directory>          <Directory "/var/www/html">                   Options Indexes FollowSymLinks                   AllowOverride None                   Order allow,deny         Allow from all          </Directory>               <IfModule mod_userdir.c>              UserDir disabled          </IfModule>               DirectoryIndex index.html index.html.var          #     # AccessFileName: The name of the file to look for in each directory     # for additional configuration directives.  See also the AllowOverride     # directive.     #     AccessFileName .htaccess          <Files ~ "^\.ht">         Order allow,deny         Deny from all     </Files>          TypesConfig /etc/mime.types          DefaultType text/plain          <IfModule mod_mime_magic.c>     #   MIMEMagicFile /usr/share/magic.mime         MIMEMagicFile conf/magic     </IfModule>          HostnameLookups Off          ErrorLog logs/error_log          CustomLog logs/access_log combined          ServerSignature On          Alias /icons/ "/var/www/icons/"          <Directory "/var/www/icons">         Options Indexes MultiViews FollowSymLinks         AllowOverride None         Order allow,deny         Allow from all     </Directory>          <IfModule mod_dav_fs.c>         # Location of the WebDAV lock database.         DAVLockDB /var/lib/dav/lockdb     </IfModule>          ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"          <Directory "/var/www/cgi-bin">         AllowOverride None         Options None         Order allow,deny         Allow from all     </Directory>               IndexOptions FancyIndexing VersionSort NameWidth=* HTMLTable Charset=UTF-8          ReadmeName README.html     HeaderName HEADER.html          IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t          AddDefaultCharset UTF-8          AddType application/x-compress .Z     AddType application/x-gzip .gz .tgz          AddType application/x-x509-ca-cert .crt     AddType application/x-pkcs7-crl    .crl          AddHandler type-map var          AddType text/html .shtml     AddOutputFilter INCLUDES .shtml               Alias /error/ "/var/www/error/"          <IfModule mod_negotiation.c>     <IfModule mod_include.c>         <Directory "/var/www/error">             AllowOverride None             Options IncludesNoExec             AddOutputFilter Includes html             AddHandler type-map var             Order allow,deny             Allow from all             LanguagePriority en es de fr             ForceLanguagePriority Prefer Fallback         </Directory>               </IfModule>     </IfModule>               #     # Proxy Server directives. Uncomment the following lines to     # enable the proxy server:     #     #<IfModule mod_proxy.c>     #ProxyRequests On     #     #<Proxy *>     #    Order deny,allow     #    Deny from all     #    Allow from .example.com     #</Proxy>          #     # Enable/disable the handling of HTTP/1.1 "Via:" headers.     # ("Full" adds the server version; "Block" removes all outgoing Via: headers)     # Set to one of: Off | On | Full | Block     #     #ProxyVia On               NameVirtualHost *:80               <VirtualHost *:80>      # start the rewrite engine      RewriteEngine on      ServerName www.example.com      DocumentRoot /var/www/html/com_example_www     </VirtualHost>


SyntaxHighlighter Evolved not showing vertical and horizontal scrollbars

When I use SyntaxHighlighter Evolved I cannot see the horizontal and vertical code scroll bars (I use Google Chrome browser). Do you know how to fix this? Any other code snippets to suggest for WordPress? Thanks!


Make separate text boxes for separate WordPress Custom Fields

I am trying to make usability of WordPress custom fields admin easier in my theme. I saw it in ElegantThemes' eStore theme. Only I couldn't figure out how to do it in my custom theme because I couldn't find the code in eStore theme files. I use custom fields for my featured images and it's small thumbnail version. I have to upload both those pictures and from up above on the page, right below the title, copy the link and then choose the right custom key in custom fields below and paste it and the add it. Then repeat the process for another image. ![enter image description here](http://i.stack.imgur.com/VDDjN.png) I wanna make it simple. Make two text boxes and place the upload image button in front of them. As in the image below. ![enter image description here](http://i.stack.imgur.com/4PH9t.png) If possible I even wanna automate the copy and paste process. i.e.: The image link for the full size image automatically shows up in the text box on upload. Even elegant themes doesn't do that, but I would love to. Any ideas on how I can do this. This will make the posting just a bit faster and more importantly make explaining the process to writers much much easier. I am still looking into the code if I can find it. Any help would be greatly appreciated. Thanks in advance.


Is there any way to ftp into wordpress if I paid for my own domain? I want to set up google analytics

I am quite confused. I have my own host for wordpress that I paid for, and I want to be able to ftp into my files to manually edit them. I know wordpress does not support or allow ftp, but I see a lot of people doing it on privately hosted domains: Here is an example that assumes you can ftp in I am trying to use FireFTP to do this, but I have been unsuccessful. Please let me know if this is possible, I really want google analytics :) Thanks, tylerthemiler


How to order custom posts type by number of facebook likes

I have a custom post type called "quotes" and I want to order these posts by facebook likes in the category page. How can I do this? Thanks.


WP_Error not displaying errors

I am trying to utilize WP_Error for my plugin, but nothing happens. Is this too late for WP_Error? Too early? Or am I doing something else wrong?               function cpt_pre_post_publish(){         return new WP_Error('error', __('Error!' ));     }          add_action('pre_get_posts', 'cpt_pre_post_publish');


Improved WordPress search functionality and search form plugin

I want to make the default WordPress behave better. For instance, if I add categories such as: "best products", "good products" and more then the search should be able to account for those and return them higher in the results. I know there are some plugins which can improve the search query like to be able to search through tags, custom taxonomies like "Search everything". In short what I need is to be able to get tags from custom post types or blog posts to act like categories for the search form, perhaps an advanced search with a drop down list with some tags. Do you know a plugin which can help me do this?


How to query for posts (in hierarchical custom post type) that have children?

I'm trying to figure out how to query for posts in my hierarchical custom post type, presumably using WP_Query that have child posts. I can get all pages that don't have children by setting `'post_parent' => 0` in my WP_Query args, but that returns all posts that are not children. I need only posts that have child posts.


Setting Variable Path to Template Directory inside Script

I have **HTML5 Template** with 5 pages. I am converting it to a **WordPress Theme**. I have a contact page. This page includes 'forms.js' script to send contact form data to 'MailHandler.php' file. Inside the 'forms.js' script there is a variable I want to change,               mailHandlerURL:'bat/MailHandler.php'      How do I change this to something like the following?               mailHandlerURL:<?php echo get_template_directory_uri(); ?>'/bat/MailHandler.php'      The PHP is not working inside this script. Please help.


Related posts by searching post tags of single post as terms

I want to have a related loop of posts on single post pages and to do this I want to search the tags of the post. My first question is can you use the search in query posts for multiple terms and what is correct way to do this. This is what I've been trying that is not working.               global $post;     $tags = wp_get_post_tags($post->ID);     $tag_ids = array();     foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;     $args = array('cat' => '8', 'posts_per_page' => 8, 's' => $tag_ids,);     $my_search = new WP_Query($args);     if ($my_search->have_posts()) : while ($my_search->have_posts()) : $my_search-  >the_post(); ?>


Checking for published posts in a certain post type

I run a website for a company with a careers section, with each vacancy posted as a custom post type. When vacancies are available, ie a post type of "vacancy" is published, we want to display a ribbon in the top corner, directing people to the careers page. To check for published posts obviously I could get_posts for that post type, but that seems a bit inefficient as I'll be battering the database on every page load to check. Is there any more DB efficient way of doing this, kind of like a have_posts( 'post_type=vacancy' ) ?


Search not working. Appending a "<?" to the search

I entered this code in my footer widget, and the search box finally showed up:               <form method="get" id="searchform" action="<?php bloginfo('home'); ?>/">     <div>     <input type=”text” value="<?php the_search_query(); ?>" name="s" id="s" />     <input type="submit" id="searchsubmit" value="Search" />     </div>     </form>      But when I run a search, a `<?` gets appended to the query, resulting in a page not found error. Even removing the `<?` doesn't bring me to a results page. To me, the php code appears ok. I doublechecked and have searchform.php in the same folder as the rest of my page templates. This is on http://dsiinfo.webfactional.com I've done several searches and have spent a couple of hours and this but can't figure out what's causing the problem. Thanks!


How to put enctype="multipart/form-data" in categories form?

I had success putting the code below to include enctype (for images) in custom post type forms, but I'm not able to use it in categories form... is this possible? Thanks.               add_action( 'post_edit_form_tag' , 'post_edit_form_tag' );          function post_edit_form_tag( ) {         echo ' enctype="multipart/form-data"';     }