How to order by just the Time Field in Advanced Custom Fields

I'm using Advanced Custom Fields to create a class schedule. I need to get the time field to sort correctly to display the class schedule in the correct order. Currently it is not, and I don't understand what I need to do to get it sorting correctly. Here is the live link: http://studio34yoga.com/yoga-movement/class-schedule/ You can see on Monday that the classes are not in the correct order. "start_time" is my time picker field that I am hoping to sort on. What follows is an abridged version of my PHP code. Any help is appreciated.               <?php          $args = array( 'post_type' => 'Classes', 'posts_per_page' => 70, 'meta_key' => 'start_time', 'orderby' => 'meta_value_num', 'order'=>'ASC' );            $loop = new WP_Query( $args );               while ( $loop->have_posts() ) : $loop->the_post();          if(get_field('day') == "2monday") :          {         echo '
';         echo get_field('start_time');         echo ' - ';         echo get_field('end_time');         echo '
';     }          endif;          endwhile;          ?>


Count post views in loop

I'm trying to show the post views for every post on a blog page (so in a loop). I tried it with the following code in the functions.php:                 // function to count views.     function setAndViewPostViews($postID) {         $count_key = 'views';         $count = get_post_meta($postID, $count_key, true);         if($count==''){             $count = 0;             delete_post_meta($postID, $count_key);             add_post_meta($postID, $count_key, '0');         }else{             $count++;             update_post_meta($postID, $count_key, $count);         }         return $count; /* so you can show it */     }      Then in the loop function I used this code:               <?php echo setAndViewPostViews(get_the_ID());  ?>      However, every post gets a count added every time the blog page is reloaded, strange thing is that the id is different for every post. How can I make this it will only count the every posts? And, if possible, how would I make it so that it only counts every individual views? Thanks in advance! Btw. I know there are a lot of plugins that do this, it's not my intention to use one, so please don't suggest a plugin.


Data validation

I find Data Validation page on Codex a bit confusing. It highlights what all functions do but not how one differs from another and which one should be the right choice in a particular use case. Like earlier, Rarst created an awesome chart to show the difference between `WP_Query`, `query_posts()`, `get_posts()` and it was so much easy to understand the difference among them & I could point anyone to that chart to make them understand the difference. Examples of different validation functions will help developers understand them better and not leave them confusing to an extent. Having it sounds like a good idea?


Membership & Event Registration/Management plus-ins for non-profit

I maintain the website for a non-profit organization for historians/archivists. I'm migrating a static HTML site to WP. One of the main reasons for the transition is to utilize plugins for membership mgmt. and event registration. The free plugins in both these areas have not been all that user-friendly, so I'm looking for recommendations for plugins that achieve these goals. I need PayPal integration, not so sure about credit card transactions. One main problem I have in selecting a free/premium membership plugin is that I'm not trying to create premium content or a firewall. Our members haven't expressed in features such as: forums, member directories, etc.), so I'm really looking for a plugin(s) which let me and event planners facilitate event registration & mgmt., and creation/renewal of memberships & paying dues. I've looked at Event Espresso, S2Member, WP-Member, Magic Members, and played with all the free plugins. If I'm going to write a request for funds to purchase premium plugins to make these tasks easier, what plugins have any of you had success with? Thanks a lot for any advice.


Responsive dropdown menu with smaller screen sizes

Working on a theme template and trying to make the menu responsive, so that it will change from a horizontal layout into a block format at a certain screen resolution. I have tried one tutorial which I couldn't get to work, lack of experience on my behalf but also a little unsure how to implement in to WordPress as the menu is generated dynamically, and the tutorial was based on a fixed HTML structure menu. Now attempting a second but hitting a wall at the moment, hence my question. The tutorial I am following is located below, the author has been helpful but I don't want to push his patience. I have some comments on his blog, which explains a little but will reiterate all below. http://www.justinwhall.com/responsive-drop-down-menu-with-css-media-queries- jquery/#comment-8391 I have copied his Java script into a file called mobile-menu.js then registered and enqueued this in the correct way within functions.php I am using a test website http://www.simples.net23.net The CSS I am using is as follows:               /*=========== helper classes =====================*/     p.mobile-nav {       display: none;       margin-bottom: .5em;       font-size: 1.4em !important; }     p.mobile-nav span {       font-size: 1.3em; }     .mobile li {       display: block;       width: 43%;       border-bottom: 1px solid #ccc;       float: left;       padding: 10px 0;       font-size: 1.2em;     }     @media only screen     and (max-width : 768px) {       p.mobile-nav {       display: block; }     }      I haven't placed all the Java code here as it's about 30 lines, and is possibly better read on his blog. Below is some of the code from my `header.php` file, regarding the menu:
                Menu +     <?php   /* Adding the menu called 'main' to the header, within HTML5 tag */     wp_nav_menu( array( 'theme_location' => 'main' ) );     ?>
                I think my issue lies with my HTML and CSS, and using the correct selectors so the Java script can work it's magic. I have looked at the generated menu with Firebug, but as it's generated by WordPress having a bit of an issue understanding the structure, and then the correct selectors to use. Cheers, Ant


Change media URL (images)

Similar questions have been posted, but none have been resolved. I'm looking to, programmatically on upload, change the URL of a media file to its URL on a CDN. I.e. modify site.com/wp-content/uploads/file.jpg to be cdn.site.com/wp- content/uploads/file.jpg. Essentially what I'm asking is: which hook should I tie into? If anybody has more code help, that's great, but I think hook is the big question. People before seem to have been wondering this, so I think it'll be helpful to resolve. Note also: I'm aware that W3 Total Cache and other plugins do this; I'd actually like it changed in the database (not just filtered on post render/output), and need to use some of my own logic, so I need to code snippet in my code. Many thanks.


How to to stop html editor from addig <p> tags to shortcodes, images, etc

I know this this is covered as individual topics but What I am looking for is a single function that stops `<p>` tags from being wrapped around via the Wordpress editor to shortcodes and images and also removes empty `<p>` tages, for example:   * remove `<p>` tags that get wrapped around shortcodes, i.e., `<p>[shortcode]</p>`   * remove empty `<p></p>` tags   * remove `<p>` tags with whitespace, i.e., `<p> </p>` or `<p> </p>` etc.   * remove `<p>` tags that get wrapped around `<img>` tags, i.e., `<p><img blabla /></p>` I have been using a few different functions that take `$content` and strips out the `<p>` tags via `preg_replace()` but I can not figure out how to get all four requirements to work in a single function. Its seems like too much overhead to run `$content` through four different functions before `$content` is displayed. Also can you recommend a good source to learn how to use all the agreements for preg_replace()?


Hook into the rendering of a WordPress Template

I have to use WordPress as some meta templating system and include some `JSP` snipptes which will be evaluated later with Tomcat after rendering the page statically. But naturally the `JSP` Code could not be interpreted by the php parser. This results in plain text strings mixed with the interpreted template parts. **Is there any way to hook into the (pre) rendering of a WordPress Template?** I need way get access the rendered template so i can strip out the `JSP`-Tags. Maybe wrapped between some unique tags or something else. But this ist not part of this question. ## Example               <?php get_header(); ?>          <render:jsp>         <%= request.getParameter("title") %>     </render:jsp>          <?php get_footer(); ?>


problem saving/ retrieving custom meta with wp alchemy metabox

I am using WPalchemy metabox class to add a extra meta field to the pages editor which will allow me to attach galleries to pages. I use the class:               $gallery_metabox = new WPAlchemy_MetaBox(array(         'id' => '_gallery_meta',         'title' => 'Gallery',         'template' => STYLESHEETPATH . '/inc/custom/gallery_meta.php',         'types' => array('post', 'page', 'events'),         'priority' => 'high',             'lock' => WPALCHEMY_LOCK_AFTER_POST_TITLE     ));      Here's my gallery_meta.php:               <div class="my_meta_control">      <?php $metabox->the_field('attachedGallery'); ?>         <label>Attached gallery </label>         <p>                  <select name="<?php $metabox->the_name(); ?>">             <option value="0">select gallery</option>                    <?php             //global $post;             $selected = 'selected="selected"';             $args = array( 'post_type' => 'galleries', 'posts_per_page' => 999, 'orderby' => 'title', 'order' => 'ASC' );             $loop = new WP_Query( $args );             while ( $loop->have_posts() ) : $loop->the_post();?>                 <option value="<?php the_ID(); ?>" <?php echo $mb->is_value(get_the_ID())? $selected :''; ?>><?php the_title(); ?></option>             <?php endwhile; wp_reset_query(); ?>             </select>         </p>          </div>      The input field appears in the WP admin for posts/ pages and events. When I save the value it seems it doesn't save. I checked the mysql db and for this particular page I am testing there is a row with: meta_key `_gallery_meta` meta_value `a:1:{s:16:"attached-gallery";s:3:"109";}` I can't retrieve the value of the $gallery_metabox or make the select element mark the option as selected though. Can anyone help?


What is wrong with this dbDelta syntax?

I know there's a million questions about this, but I've searched a bunch and haven't found any solutions that fix my problem. This is the function which I hook upon plugin activation:               global $wpdb;     $src = $wpdb->prefix . "source";     $via = $wpdb->prefix . "via";     require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );     $query = "CREATE TABLE " . $src . "(             source_index bigint NOT NULL AUTO_INCREMENT,                         post_id bigint,                         source_id int,                         source varchar(100),                         source_title varchar(100),                         PRIMARY KEY  (source_index)                 );";         dbDelta($query);     $query = "CREATE TABLE " . $via . "(             via_index bigint NOT NULL AUTO_INCREMENT,                         post_id bigint,                         via_id int,                         via varchar(100),                         via_title varchar(100),                         PRIMARY KEY  (via_index)                 );";         dbDelta($query);      It does nothing at all, and I don't understand why. I thought for certain that I'd corrected all issues. Any assistance would be appreciated.


Wordpress Native Function To Show Publish Box, Select Categories Form etc On Plugin Page

![enter image description here](http://i.stack.imgur.com/ttsZU.jpg) The picture above showing the default forms those are available on metabox of wordpress post/page editor screen. Is there a wordpress native function to show those forms on a custom plugin page outside of metabox? Best Regards


Why I can't load my JavaScripts using an hook inside my functions.php file?

I am pretty new in WP (I came from Joomla) and I have the following problem: I am carrying this pure HTML theme (that use BootStrap CSS framework) into a WordPress theme. This is the original pure HTML demo theme (I have the entire source code because it is a downlodable example): http://www.html.it/guide/img/bootstrap/demo/home.html And this is my personal WP theme on wich I am working on: http://onofri.org/WP_BootStrap/ As you can see the only difference from the original demo website and my personal WP theme is that in the second one the JavaScript is not loaded (so the upper horizontal main menu can't work well and the header SlideShow is fixed on a single immage) I have do the following operations: 1) In my **footer.php** file I have disabled the JavaScript loading commenting them, in this way:                       <!--             <script src="http://code.jquery.com/jquery.js"></script>             <script src="/wordpress/wp-content/themes/AsperTheme/assets/bootstrap/js/bootstrap.min.js"></script>             <script src="/wordpress/wp-content/themes/AsperTheme/assets/plugins/flexslider/jquery.flexslider.js"></script>             <script src="/wordpress/wp-content/themes/AsperTheme/assets/plugins/fancybox/jquery.fancybox.pack.js"></script>             <script src="/wordpress/wp-content/themes/AsperTheme/assets/js/scripts.js"></script>             -->      2)I have insert the following code into my **functions.php** file to load all the previous JavaScript using the WP standard way:               /* Function automatically executed by the hook 'load_java_scripts':      * 1) Load all my JavaScripts      */     function load_java_scripts() {              // Load JQuery:         wp_enqueue_script('jquery');         // Load bootstrap.min.js:         wp_enqueue_script('bootstrap.min-js', get_template_directory_uri() . '/assets/bootstrap/js/bootstrap.min.js', array(), 'v3.0.3', true);         // Load FlexSlider JavaScript         wp_enqueue_script('flexSlider-js', get_template_directory_uri() . '/assets/plugins/flexslider/jquery.flexslider.js', array(), 'v2.1', true);         // Load FancyBox:         wp_enqueue_script('fancy-js', get_template_directory_uri() . '/assets/plugins/fancybox/jquery.fancybox.pack.js', array(), 'v2.1.5', true);         // Load scripts.js:         wp_enqueue_script('myScripts-js', get_template_directory_uri() . '/assets/js/scripts.js', array(), '1.0', true);         // Load Modernizer:         wp_enqueue_script('myodernizer-js', get_template_directory_uri() . '/assets/js/modernizr.custom.js', array(), '2.6.2', true);          }     add_action('wp_enqueue_scripts', 'load_java_scripts');      But as you can see seem that the JavaScript is not loaded and can't work. If I enamble the JavaScript loading inside my **footer.php** file (deleting the comments) it work well but I think that in WP this is not a good way to use. What am I missing? What is it wrong?


Unregistering custom tinymce plugin?

I want to unregister a custom tinymce plugin in one of my child themes. The custom tinymce plugin uses basically: http://codex.wordpress.org/Plugin_API/Filter_Reference/mce_external_plugins excerpt:               add_filter( "mce_external_plugins", "foo_add_buttons" );     add_filter( 'mce_buttons', 'foo_register_buttons' );      What is the best way to remove this such that performance is the best? The two options I came up with are:   1. remove_filter("mce_external_plugins"); & remove_filter( 'mce_buttons', 'foo_register_buttons' );?   2. add_filter('tiny_mce_before_init', 'disable_mce_buttons'); and simply remove the buttons that the parent theme adds?


Hide custom metabox value from custom fields

Before I ask the question, I tried to added _ to the custom field, but it's not working, at least with my code. I just want to hide the value of my meta box from appearing in the custom fields. When I added _ to the code, the metabox stopped working. Here's the code:               //Creating a MetaBox for Posts to enter audio Code.     add_action('add_meta_boxes','audio_meta_box');     function audio_meta_box(){         add_meta_box('audio_box_id', 'Enter Audio ' , 'audio_box_cb','post','normal','default');     }     function audio_box_cb($post){         $value = get_post_meta($post->ID,'_audio_box',true);              echo '<textarea rows="1" style="width: 98%;" id="audio_box", name="audio_box">';             echo $value;         echo '</textarea>';     }          add_action('save_post','save_audio_box');     function save_audio_box($post_id){         $box_data = $_POST['audio_box'];         update_post_meta($post_id,'_audio_box',$box_data, true);     }


Possible to hide parts of the slug from get_template_directory_uri and bloginfo('template_directory')

At the moment i am running and building a wp site on a local install with mamp. Additionally i have moved the wp files from the root directory to a folder. i've included files then e.g. with               <?php $url = get_template_directory_uri(); ?>      or               <link rel="apple-touch-icon" href="http://localhost:8888/myhomepage/vHGNd37wDb/wp-content/themes/mytheme/touchicon.png">      but if i take a look at the resulting html source of the latter i get               <link rel="apple-touch-icon" href="http://localhost:8888/myhomepage/vHGNd37wDb/wp-content/themes/mytheme/touchicon.png">      somehow i hoped the wp-content wouldn't show up and also the move of the wp files from the root to the vHGNd37wDb folder seems useless if that directory name is visible to everybody. :/ Is the latter cuz i am on a local install right now? So would it be possible to prevent both from showing up? best regards ralf


Change display wp post type to wp custom post type

i have this code below to display wp post based on category but what i want to display wp custom post called 'wiki' based on its category. CPT wiki is from plugin, so i think already defined.               class Pyre_Homepage_1col_Widget extends WP_Widget {          function Pyre_Homepage_1col_Widget()          {         $widget_ops = array('classname' => 'pyre_homepage_1col', 'description' => 'Homepage 1-column recent posts widget.');         $control_ops = array('id_base' => 'pyre_homepage_1col-widget');         $this->WP_Widget('pyre_homepage_1col-widget', 'Avenue Theme: Home 1-column', $widget_ops, $control_ops);     }          function widget($args, $instance)          {         extract($args);         $title = $instance['title'];         $post_type = 'all';         $categories = $instance['categories'];         $posts = $instance['posts'];         $images = true;         $rating = true;         $show_excerpt = isset($instance['show_excerpt']) ? 'true' : 'false';              echo $before_widget;         ?>         <?php         $post_types = get_post_types();         unset($post_types['page'], $post_types['attachment'], $post_types['revision'], $post_types['nav_menu_item']);         if($post_type == 'all') {             $post_type_array = $post_types;         } else {             $post_type_array = $post_type;         }              ?>

<a href="<?php echo get_category_link($categories); ?>"><?php echo $title; ?> »
             <?php             $recent_posts = new WP_Query(array(                 'showposts' => $posts,                 'cat' => $categories,             ));             ?>             <?php             $big_count = round($posts / 9);             if(!$big_count) { $big_count = 1; }             ?>                  <?php $counter = 1; while($recent_posts->have_posts()): $recent_posts->the_post(); ?>             <?php             if(has_post_format('video') || has_post_format('audio') || has_post_format('gallery')) {                 $icon = 'ID) . '-icon">';             } else {                 $icon = '';             }             ?>                  <?php if($counter <= $big_count): ?>             <?php if($counter == $big_count) { $last = 'block-item-big-last'; } else { $last = ''; }?>                  <div class="block-item-big <?php echo $last; ?>">                 <?php if($images && has_post_thumbnail()): ?>                 <?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'widget-image'); ?>
<a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'><img src="<?php echo $image[0]; ?>" alt="<?php the_title(); ?>" width='290' height='160' /><?php echo $icon; ?>
                 <?php else: ?>
<a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'><img src="<?php bloginfo('template_directory'); ?>/timthumb.php?src=<?php bloginfo('template_directory'); ?>/images/thumbnail.png&w=290&h=160" alt="<?php the_title(); ?>" width='290' height='160' /><?php echo $icon; ?>
                 <?php endif; ?>
<a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'><?php the_title(); ?>

<?php echo ' - ' ?><?php the_time('F j, Y'); ?>
                 <?php if($show_excerpt == 'true'): ?>
<?php echo string_limit_words(get_the_excerpt(), 15); ?><a href='<?php the_permalink(); ?>'> [...]
<?php endif; ?>
                  <?php else: ?>

<?php echo the_time('d/n'); ?><?php echo ' - ' ?><a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'><?php the_title(); ?>

                  <?php endif; ?>                  <?php $counter++; endwhile; ?>
              <?php         echo $after_widget;     }          function update($new_instance, $old_instance)     {         $instance = $old_instance;         $instance['title'] = $new_instance['title'];         $instance['post_type'] = 'all';         $instance['categories'] = $new_instance['categories'];         $instance['posts'] = $new_instance['posts'];         $instance['show_images'] = true;         $instance['show_rating'] = true;         $instance['show_excerpt'] = $new_instance['show_excerpt'];              return $instance;     }          function form($instance)     {         $defaults = array('title' => 'Recent Posts', 'post_type' => 'all', 'categories' => 'all', 'posts' => 4, 'show_excerpt' => null);         $instance = wp_parse_args((array) $instance, $defaults); ?>
             <label for="<?php echo $this->get_field_id('title'); ?>">Title:             <input class="widefat" style="width: 216px;" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $instance['title']; ?>" />

             <label for="<?php echo $this->get_field_id('categories'); ?>">Filter by Category:              <select id="<?php echo $this->get_field_id('categories'); ?>" name="<?php echo $this->get_field_name('categories'); ?>" class="widefat categories" style="width:100%;">                 <option value='all' <?php if ('all' == $instance['categories']) echo 'selected="selected"'; ?>>all categories</option>                 <?php $categories = get_categories('hide_empty=0&depth=1&type=post'); ?>                 <?php foreach($categories as $category) { ?>                 <option value='<?php echo $category->term_id; ?>' <?php if ($category->term_id == $instance['categories']) echo 'selected="selected"'; ?>><?php echo $category->cat_name; ?></option>                 <?php } ?>             </select>

             <label for="<?php echo $this->get_field_id('posts'); ?>">Number of posts:             <input class="widefat" style="width: 30px;" id="<?php echo $this->get_field_id('posts'); ?>" name="<?php echo $this->get_field_name('posts'); ?>" value="<?php echo $instance['posts']; ?>" />

             <input class="checkbox" type="checkbox" <?php checked($instance['show_excerpt'], 'on'); ?> id="<?php echo $this->get_field_id('show_excerpt'); ?>" name="<?php echo $this->get_field_name('show_excerpt'); ?>" />              <label for="<?php echo $this->get_field_id('show_excerpt'); ?>">Show excerpt
     <?php }}


display URL or permalink instead of page title in dashboard

Is there a way to display the page url or permalink instead of the page title on               example.com/wp-admin/edit.php?post_type=page      I am doing some A/B testing and some pages have the same title, but a different URL. Also I may experiment from time to time with a different title. I know all my pages by URL and would prefer to see this in the list of pages.


How can I sort the order of multiple custom field values in a custom post type?

Here's the website: KunzlerIP At the bottom of the website, you see a slider using Fancybox. Each thumbnail pops up some content from an individual custom post type post. For this custom post type, I've enabled the following:                   function post_type_lawyers() {         register_post_type( 'lawyers',             array(                  'label' => __('Lawyers'),                 'public' => true,                 'show_ui' => true,                 'hierarchical' => true,                 'supports' => array(                     'title',                     'thumbnail',                     'page-attributes',                     'post-thumbnails',                     'custom-fields',                     'revisions',                     )             )         ); //end register_post_type         register_taxonomy( 'lawyer', 'lawyers', array( 'hierarchical' => true, 'label' => __('Rank') ) );     }     add_action('init', 'post_type_lawyers');      The info for each pop-up is a custom field value and key. Currently, there are 4 values per individual post. What I would like to do is order these custom field values in the following order:   * Height   * Fueled By   * Favorite Quote   * Areas of Expertise If you go through these pop-ups, you'll see that a couple of them don't follow the same order for some reason and I can't figure out how to control how they display. To call this slider, here's the query:
         <?php query_posts('post_type=lawyers&orderby=date&order=DESC&posts_per_page=-1'); while (have_posts()): the_post(); ?>
                 <a href="#<?php the_ID(); ?>" class="fancybox"><?php the_title(); echo the_category(); if ( has_post_thumbnail() ) { the_post_thumbnail(); } ?>                 <div id="<?php the_ID(); ?>" class="profile"><?php if ( has_post_thumbnail() ) { the_post_thumbnail('large', array('class' => 'baseball')); } ?>
<?php the_title(); ?>
<?php echo(the_meta()); ?>

         <?php endwhile; ?>
      Does it have something to do with `the_meta()`?


Why won't my preg_replace work with content_save_pre?

I've written a filter function to replace all image URLs in a post with URL from the Uploads directory of my site. However, when using the `content_save_pre`, filter it won't actually work - but if I use the `content_edit_pre` filter, it works. Here is my code:               $oldPostContent = $post->post_content; // pass old content into function as argument     function get_the_post_imgs($oldPostContent) {         global $post;         $newPostContent = $oldPostContent;         $newPostContent = preg_replace_callback(             ￼"/<img.*src=[\"']([^\"']*)[\"'].*>/i", // pattern to match to (i.e the contents of an <img src="..." /> tag)             function ($match) {                 return "hello world"; // obviously it's a lot more complicated than this but for your sake i've massively simplified it so the src="..." content is just replaced with "hello world" for now             },             $oldPostContent         );              return $newPostContent; // return new manipulated content     }          add_filter('content_save_pre', 'get_the_post_imgs'); // this doesn't work on the content, but if I use content_edit_pre, it does work      I've added some comments along the way to help you out. I'm pretty sure it's not a problem with the regex (http://regex101.com/r/aP4fU9) so it's something to do with my code not working the way `content_save_pre` needs it to work. Thanks for any help :)


Renaming or Moving WP-Content Pros/Cons

I'm still learning WP. Previously I had done a 1-click installation of WP. Everything worked fine. But now, I'm planning to install it manually. What are the Pros/Cons of these? 1 Renaming wp-content   (I have heard some plugins won't work. Could I maybe just rename wp-content in the plugin code?) 2 Moving wp-content or wp-uploads Any harm in doing this? Thanks.


When to check if a function exists

I've just started developing a WP plugin, and i've been reading some code from other plugins as a way to get started. I've seen a couple of plugins that wrap all or some of their functions in the following code:               if(!function_exists('my_function')) {         function my_function() {             // a cool function         }     }      Is it considered good practice to wrap all functions in this code to avoid naming conflicts with other plugins? Thanks


How can I highlight specific pieces of text within a blog post?

I have searched for a simple method to allow a user to highlight a specific piece of text with a user chosen color but have not found one readily apparent. I have found a few methods related to syntax / code highlighting. I am not trying to highlight code but merely text within a blog post. Preferably I would like a simple method that provides a UI button within the editor itself as some users that post articles are not technically savvy and may have issues with short codes. I am currently running Wordpress version 3.5.1.


wp_handle_upload error "Specified file failed upload test" but still creates attachment?

Having a bit of trouble with an image upload custom meta box. What happens is the uploaded image is created as an attachment but the wp_handle_upload seems to kick back the error "Specified file failed upload test" rather than updating my post meta? Seem odd though that the attachment is created without issues? Heres the code:               // Make the forms multipart     add_action('post_edit_form_tag', 'post_edit_form_tag');     function post_edit_form_tag() {        echo ' enctype="multipart/form-data"';     }          /* Setup custom meta boxes for posts */     $new_meta_boxes =         array(         "xxxx_kw1" => array(             "name" => "xxxx_kw1",             "std" => "",             "title" => "Keyword 1",             "type" => "text"             ),         "xxxx_url1" => array(             "name" => "xxxx_url1",             "std" => "",             "title" => "URL 1",             "type" => "text"             ),         "xxxx_kw2" => array(             "name" => "xxxx_kw2",             "std" => "",             "title" => "Keyword 2",             "type" => "text"             ),         "xxxx_url2" => array(             "name" => "xxxx_url2",             "std" => "",             "title" => "URL 2",             "type" => "text"             ),         "xxxx_kw3" => array(             "name" => "xxxx_kw3",             "std" => "",             "title" => "Keyword 3",             "type" => "text"             ),         "xxxx_url3" => array(             "name" => "xxxx_url3",             "std" => "",             "title" => "URL 3",             "type" => "text"             ),         "xxxx_image" => array(             "name" => "xxxx_image",             "std" => "",             "title" => "Image Upload",             "type" => "file"             )          );          function new_meta_boxes() {          global $post, $new_meta_boxes;              foreach($new_meta_boxes as $meta_box) {             $meta_box_value = get_post_meta($post->ID, $meta_box['name'], true);                  if($meta_box['type'] == 'file') { $meta_box_value = get_post_meta($post->ID,'xxxx_attached_image', true); }                  if($meta_box_value == "")             $meta_box_value = $meta_box['std'];                   echo'<input type="hidden" name="'.$meta_box['name'].'_noncename" id="'.$meta_box['name'].'_noncename" value="'.wp_create_nonce( plugin_basename(__FILE__) ).'" />';                  echo'
'.$meta_box['title'].'
';                  echo'<input type="'.$meta_box['type'].'" name="'.$meta_box['name'].'" value="'.$meta_box_value.'" size="55" />';         }     }          function create_meta_box() {         global $theme_name;         if ( function_exists('add_meta_box') ) {             add_meta_box( 'new-meta-boxes', 'PR xxxx Paid Information', 'new_meta_boxes', 'post', 'normal', 'high' );         }     }          function save_postdata( $post_id ) {         global $post, $new_meta_boxes;              $_POST = array_map('mysql_real_escape_string', $_POST);              foreach($new_meta_boxes as $meta_box) {             // Verify             if ( !wp_verify_nonce( $_POST[$meta_box['name'].'_noncename'], plugin_basename(__FILE__) )) {                 return $post_id;             }                  if ( !current_user_can( 'edit_post', $post_id ))                 return $post_id;                  if($meta_box['type'] == 'file') : // if data is a file we'll need to treat if differently...                      $data = $_FILES[$meta_box['name']];                      // If the upload field has a file in it                 if(isset($data) && ($data['size'] > 0)) {                          // Get the type of the uploaded file. This is returned as "type/extension"                     $arr_file_type = wp_check_filetype(basename($data['name']));                     $uploaded_file_type = $arr_file_type['type'];                          // Set an array containing a list of acceptable formats                     $allowed_file_types = array('image/jpg','image/jpeg','image/gif','image/png');                          // If the uploaded file is the right format                     if(in_array($uploaded_file_type, $allowed_file_types)) {                              // Options array for the wp_handle_upload function. 'test_upload' => false                         $upload_overrides = array( 'test_form' => false );                               // Handle the upload using WP's wp_handle_upload function. Takes the posted file and an options array                         $uploaded_file = wp_handle_upload($data, $upload_overrides);                              // If the wp_handle_upload call returned a local path for the image                         if(isset($uploaded_file['file'])) {                                  // The wp_insert_attachment function needs the literal system path, which was passed back from wp_handle_upload                             $location = $uploaded_file['file'];                                  // Generate a title for the image that'll be used in the media library                             $file_title = $uploaded_file['file'];                                  // Set up options array to add this file as an attachment                             $attachment = array(                                 'post_mime_type' => $uploaded_file_type,                                 'post_title' => preg_replace('/\.[^.]+$/', '', basename($file_title)),                                 'post_content' => '',                                 'post_status' => 'inherit',                                 'post_parent' => $post_id,                                 'guid' => $uploaded_file['url']                             );                                  // Run the wp_insert_attachment function. This adds the file to the media library and generates the thumbnails. If you wanted to attach this image to a post, you could pass the post id as a third param and it'd magically happen.                             $attach_id = wp_insert_attachment( $attachment, $location, $post_id );                             require_once(ABSPATH . "wp-admin" . '/includes/image.php');                             $attach_data = wp_generate_attachment_metadata( $attach_id, $location );                             wp_update_attachment_metadata($attach_id,  $attach_data);                                  // Before we update the post meta, trash any previously uploaded image for this post.                             // You might not want this behavior, depending on how you're using the uploaded images.                             $existing_uploaded_image = (int) get_post_meta($post_id,'xxxx_attached_image', true);                             if(is_numeric($existing_uploaded_image)) {                                 wp_delete_attachment($existing_uploaded_image);                             }                                  // Now, update the post meta to associate the new image with the post                             update_post_meta($post_id,'xxxx_attached_image',$attach_id);                                  // Set the feedback flag to false, since the upload was successful                             $upload_feedback = false;                                   } else { // wp_handle_upload returned some kind of error. the return does contain error details, so you can use it here if you want.                                  $upload_feedback = 'There was a problem with your upload: '.$uploaded_file['error'];                             update_post_meta($post_id,'xxxx_attached_image',$attach_id);                              }                          } else { // wrong file type                              $upload_feedback = 'Please upload only image files (jpg, gif or png).';                         update_post_meta($post_id,'xxxx_attached_image',$attach_id);                          }                      } else { // No file was passed                          $upload_feedback = false;                      }                      // Update the post meta with any feedback                 update_post_meta($post_id,'xxxx_attached_image_upload_feedback',$upload_feedback);                  else : // valid the input as normal                      $data = $_POST[$meta_box['name']];                      if(get_post_meta($post_id, $meta_box['name']) == "")                     add_post_meta($post_id, $meta_box['name'], $data, true);                 elseif($data != get_post_meta($post_id, $meta_box['name'], true))                     update_post_meta($post_id, $meta_box['name'], $data);                 elseif($data == "")                     delete_post_meta($post_id, $meta_box['name'], get_post_meta($post_id, $meta_box['name'], true));                  endif;              }     }          add_action('admin_menu', 'create_meta_box');     add_action('save_post', 'save_postdata');      If anyone can help I'd send a virtual thumbs up and a beer! :-) Cheers, Dave


How to show only Standard Format post in my custom taxonomy page -wordpress 3.8.1

I want to exclude photo and video categories (ID's 1 and 2 respectively) from my custom taxonomy page. Any suggestions on how can I exclude these two categories from the loop?               <?php     /**      * Locations taxonomy archive      */     get_header();     $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );     ?>

<?php echo apply_filters( 'the_title', $term->name ); ?> News
                  <?php if ( !empty( $term->description ) ): ?>
                 <?php echo esc_html($term->description); ?>
             <?php endif; ?>                  <?php if ( have_posts() ): while ( have_posts() ): the_post(); ?>                  <div id="post-<?php the_ID(); ?>" <?php post_class('post clearfix'); ?>>
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?>

<?php the_time(get_option('date_format')); ?> by <?php the_author_posts_link(); ?>

                         <?php the_content( __('Full story…') ); ?>

                  <?php endwhile; ?>

<?php next_posts_link('« Previous Entries') ?>

<?php previous_posts_link('Next Entries »') ?>

                  <?php else: ?>
No News in <?php echo apply_filters( 'the_title', $term->name ); ?>

It seems there isn't anything happening in <?php echo apply_filters( 'the_title', $term->name ); ?> right now. Check back later, something is bound to happen soon.

                  <?php endif; ?>

             <?php get_sidebar(); ?>
          <?php get_footer(); ?>


Child theme template value for style.css for parent in different folder

I am making a child theme in the `.../wp-content/themes/` folder however the parent theme that I am building on is in the `.../wp-content/plugins/` directory. I am able to import the parent `style.css` file using a directory path but when I try to do the same for the Template value, it does not work. Similarly, the simple name of the parent theme folder does not work either, presumably because the parent theme is in a different directory. Any ideas on how to fix this?


How to use the WordPress header as the global header for apps across a site?

I am running Wordpress as the main site, and a few other php CMS apps for other specific purposes (let me call it subsites for the purpose of this question). Now when designing templates for subsites, is there a way to call the WordPress header and menu, making it the global header across my entire site?


Using Customizer Options in a Plugin

I am fooling around with the Customizer code for the first time. The end goal will be to add some options to a plugin. I am off to a bad start because even adding the most basic code is throwing an error (Sorry I am new user here and I tried about 100 times to add the code below properly but it didn't work???)...               Fatal error: Call to a member function add_setting() on a non-object in... (my path)      Here is the basic code I am using (keeping in mind this is a plugin and not a theme)               function mb_wp_logo_customize_register ($wp_customize) {         //Settings, Sections, and Controls are defined here     }     add_action( 'customize_register', 'mb_wp_logo_customize_register' );               $wp_customize->add_setting( 'link_color' , array(         'default'           => 'FF00FF',         'type'              => 'option',         'transport'         => 'refresh',         'sanitize_callback' => 'sanitize_hex_color_no_hash',     ));          $wp_customize->add_section( 'customizer_content_customizations' , array(         'title'           => __('Content Customizations', 'wplogocustomizer'),         'description'     => __('Customize the colors', 'wplogocustomizer'),         'priority'        => 30,     ));


Change custom featured image size in twentythirteen child theme

I need to change the post thumbnail size in my child theme. I have read several answers on how to do this in twenty twelve, which is very similar, but nothing is happening when I use similar code for my 2013 child theme. This is the only code I have in my functions.php file:                   function watercolor_setup() {                     set_post_thumbnail_size( 604, 310, false );             }              add_action('after_setup_theme', 'watercolor_setup', 20);      I deleted the old images, regenerated the old images, but the new ones being created are using the 2013 size parameters and not the new ones set in my child theme. I also tried this code - not to mention a few others - with and without the false:               if ( ! function_exists( 'watercolor_setup' ) ):            function watercolor_setup() {         if ( function_exists( 'add_theme_support' ) ) {             add_theme_support( 'post-thumbnails' );             set_post_thumbnail_size( 604, 310, false );         }       }     endif;          add_action('after_setup_theme', 'watercolor_setup', 20);      But, nothing is having any effect. What am I missing?


How to use Iris color picker on front-end?

I am trying to use new Iris color picker on the front-end. I succeed in using it on back-end: while using it on theme options I just enqueued the color picker like this …               wp_enqueue_script( 'wp-color-picker' );     wp_enqueue_style( 'wp-color-picker' );      … and hooked it to `admin_enqueue_scripts`. It worked. However, I don't think the same process will work on the front-end by just hooking to `wp_enqueue_scripts`. Should I have to include the core file of new Iris color picker myself, or there is some way I can enqueue the color picker from front-end as I have done in my theme option code?


Get the category from an ID of a product?

I have the `ID` from a product (`1345`) how can i get the category name of that specific product? I try               $post_categories = wp_get_post_categories( $post->ID );     print_r( $post_categories );      but it outputs:               Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( ) Array ( )      What those it means ? Thanks


WordPress index page is returning 404 and admin page requires /index.php in url

My WordPress installation is in a different folder from my main site: `/var/www/html/wordpress` <= WP installation `/var/www/html/main-site` <= main site I would like to have WP display when someone visits /blog from my main site: http://www.main-site.com/blog (Note: main-site is used as a generic placeholder for the real site because it is not launched yet) I have set up an alias in my httpd conf file:               Alias /blog /var/www/html/wordpress      <Directory /var/www/html/main-site>         DirectoryIndex index.php         Options -MultiViews         AllowOverride All         order allow,deny         allow from all      </Directory>      I have the following as my .htaccess file for WP:               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /blog     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /blog/index.php [L]     </IfModule>      I get a 404 when I visit http://www.main-site.com/blog but when I visit http://www.main-site.com/wp-admin/index.php, it works (but I get a 404 if I visit /admin). Visiting the sample blog post and sample page also works for me. http://www.main-site.com/blog/hello-world/ http://www.main-site.com/blog/sample-page/ It looks like rewrite is working but my /blog index page doesn't work. Any suggestions would be greatly appreciated. Thanks, Allen


Problem with custom menus

On the menu, I'm talking about custom menus, I have a footer with several columns, each column will have a list of items, each column menus needs to be updatable from the menus option on wp admin, so I created the section on functions.php that calls the menus and also added each menu on the footer.php document, something like:               <?php wp_nav_menu( array('menu' => 'f-1', 'menu_class' => '', 'container' => 'nav' )); ?>     <?php wp_nav_menu( array('menu' => 'f-2', 'menu_class' => '', 'container' => 'nav' )); ?>     <?php wp_nav_menu( array('menu' => 'f-3', 'menu_class' => '', 'container' => 'nav' )); ?>     <?php wp_nav_menu( array('menu' => 'f-4', 'menu_class' => '', 'container' => 'nav' )); ?>      This is how I call the menus:               add_theme_support('nav-menus'); if ( function_exists('register_nav_menus')) {     register_nav_menus( array(     'main' => 'Main Nav',     'footer-noticias-financieras' => 'Footer Noticias Financieras',     'footer-otras-publicaciones' => 'Footer Otras Publicaciones',     'footer-foro' => 'Footer Foro'     ) );     }      The thing is, when I place the menus using the theme menus area it prints automatically on my footer the column with 2 options, home and about, the "Automatically add new top-level pages" is not selected so not sure what's going on, anybody with the same problem? Thanks so much! A.-


add_filter doesn't work

I'm developing a plugin to replace a character for some user agents in titles, posts and comments but the filter doesn't work. Here is the plugin:               <?php     /*     Plugin Name: WP-HalfSpace     Description: نمایش فاصله به‌جای نیم‌فاصله برای گوگل برای خراب‌نشدن نوشته در نتایج جست‌وجوی گوگل     Version: 1.0.0     Author: ahmadalli     Author URI: http://2barnamenevis.com     */     function HalfSpace_filter($content)     {              $u_agent = $_SERVER['HTTP_USER_AGENT'];         echo "hi";         if(($u_agent=="Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" )         || ($u_agent=="Googlebot/2.1 (+http://www.googlebot.com/bot.html)")         || ($u_agent=="Googlebot/2.1 (+http://www.google.com/bot.html)")         || ($u_agent=="Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)")         )         {              echo "aaaaaaaaa";             $content=str_ireplace(""," ",$content); //"" is not empty. it's a persian character names halfspace.         }         return $content;     }          register_activation_hook( __FILE__, 'HalfSpacePlugin_activate' );          function HalfSpacePlugin_activate()     {         add_filter('the_title','HalfSpace_filter',1,1);         add_filter('the_content','HalfSpace_filter',1,1);         add_filter('comment_text','HalfSpace_filter',1,1);     }                    register_deactivation_hook( __FILE__, 'HalfSpacePlugin_deactivate' );          function HalfSpacePlugin_deactivate()     {         remove_filter('the_title','HalfSpace_filter');         remove_filter('the_content','HalfSpace_filter');         remove_filter('comment_text','HalfSpace_filter');     }     ?>      The filter doesn't work at all because `echo "hi";` in `HalfSpace_filter` doesn't do it's job! Can anybody help me?


Include a specific post to the query_posts and remove it if it is already in the returned list

Bare with me. Firstly, here is my whole script for my featured slider articles:               <div id="featured" class="<?php if ( $responsive ) echo 'flexslider' . $featured_auto_class; else echo 'et_cycle'; ?>">     <?php esc_html_e('Previous','Aggregate'); ?>     <?php esc_html_e('Next','Aggregate'); ?>          <?php if ( $responsive ) { ?>
     <?php } else { ?>
     <?php } ?>     <?php global $ids;     $ids = array();     $arr = array();     $i=0;          $featured_cat = get_option('aggregate_feat_cat');     $featured_num = (int) get_option('aggregate_featured_num');          if (get_option('aggregate_use_pages') == 'false') query_posts("showposts=$featured_num&top=billboard"); // set which slug in custom taxonomy TOP it should filter     else {         global $pages_number;              if (get_option('aggregate_feat_pages') <> '') $featured_num = count(get_option('aggregate_feat_pages'));         else $featured_num = $pages_number;              query_posts(array         ('post_type' => 'page',             'orderby' => 'menu_order',             'order' => 'ASC',             'post__in' => (array) get_option('aggregate_feat_pages'),             'showposts' => (int) $featured_num         ));     } ?>     <?php if (have_posts()) : while (have_posts()) :         global $post;         if (!$first_time) // START custom first post         {             $post_id = 105; // This is the ID of the first post to be displayed on slider             $post = get_post($post_id);             $first_time = 1;         }         else the_post(); // END custom first post         ?>         <?php if ( $responsive ) { ?>
             <?php } else { ?>
             <?php } ?>         <?php         $width = $responsive ? 960 : 958;         $height = 340;         $small_width = 95;         $small_height = 54;         $titletext = get_the_title();              $thumbnail = get_thumbnail($width,$height,'',$titletext,$titletext,false,'Featured');              $arr[$i]['thumbnail'] = get_thumbnail($small_width,$small_height,'',$titletext,$titletext,false,'Small');         $arr[$i]['titletext'] = $titletext;              $thumb = $thumbnail["thumb"];         print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, ''); ?>

         <div class="featured-bottom-shadow feat<?php $category = get_the_category(); echo $category[0]->category_nicename; ?>">

<a href="<?php the_permalink(); ?>"><?php the_title(); ?>

<?php $excerpt = get_the_excerpt(); echo string_limit_words($excerpt,20); ?>

          <?php if ( $responsive ) { ?>
          <?php } else { ?>
          <?php } ?>         <?php $ids[] = $post->ID; $i++; endwhile; endif; wp_reset_query(); ?>     <?php if ( $responsive ) { ?>
      <?php } else { ?>
      <?php } ?>
       It `query_posts` a set amount of posts from the custom taxonomy `top=billboard`. The following part of the code:               <?php if (have_posts()) : while (have_posts()) :         global $post;         if (!$first_time) // START custom first post         {             $post_id = 105; // This is the ID of the first post to be displayed on slider             $post = get_post($post_id);             $first_time = 1;         }         else the_post(); // END custom first post         ?>      Adds the post ID `105` to the first post of the returned list. This allows me to control which post is displayed first. **The problem is** : If post ID `105` is already included in the custom taxonomy `top=billboard`, then it will appear twice in the list... so once because it was added in the above `custom first post` script, and once because it was added in the custom taxonomy `top=billboard`. How do I adjust my code so that if post ID `105` exists in custom taxonomy `top=billboard`, then it should **not** appear twice (only as the first post).


How to show custom static content at top of each category page?

I want to display custom static content, essentially an image and a small description, at the top of each category page (different for each category and sub category), displayed above a list of titles of the category posts with excerpts. Is there an automated solution/plugin available for this? I need an automated way to insert text/image too because I want to pass this to my content writer and he will take care of the new categories. A rich text editor where I can insert image and text, which will be assigned to a category and can be shown on top of the category page.


Is there a way to remove the option to modify the Slug in post.php

I am trying to remove the option to edit the **Permalink**. I know how to hide it with CSS and I have. But a hacker could simply just go to Inspect Element and change `display: none;` to `display: block;` and then be able to modify the Permalink. So is there a way to block that option? Or can I check if the user submits to verify that the permalink was not modify?


Custom search with meta fields

I made a custom search form with text fields and dropdown. Now, my form is in its own template file - sidebar-search.php. I have also made the searchform.php which should get the data from sidebar and then display results. I'm using this method for the query. **My problem** is this: When I put the "action" to "bloginfo('home')" - nothing happens.   When I put the "action" to "TEMPLATEPATH . 'searchform.php'" - shows a blank page. (this is now updated - see last lines) Here is the code from searchform.php. Here is the sidebar-search (removed links, check update at the bottom) Thanks! **UPDATE**   I now placed my code in search.php, and here is how it looks like: link It still just reloads the page and no results are shown.   My action is now like this: `action="<?php echo get_bloginfo('home') ?>"`


Tools for styling code snippet in a web page

I'm a software developer and I've started my first blog on Information Technology. Since I'm using wordpress (hosted free plan) as blogging platform, I'm wondering if there's a fast and useful way for styling code snippet in my posts.


How to debug failed changes to posts?

I just rebuilt my server with Ubuntu 14.04, Nginx 1.6.0, PHP 5.5.9 and Wordpress 3.9. I am able to complete the Wordpress install and login to the Wordpress dashboard, however, I can't make any changes. If I try and delete a post, Wordpress says the action is completed, but when I hit the Posts menu again, the post comes back. If I try and create a post, Wordpress says the action is complete, but when I hit the Posts menu option, it disappears from the table. What's even more weird is if I wait a couple seconds and press the Posts menu option again (to refresh the Posts table) my changes will be there - but it doesn't always happen. This problem exists all throughout the Dashboard and I'm starting to wonder if there's an issue with Wordpress and PHP 5.5.9 since it looks like the PHP team incorporated some caching capability. My same setup works on Ubuntu 13.04, Nginx 1.4.6, PHP 5.4.9 and Wordpress 3.9. I haven't made changes to the default php.ini file and I installed php using               sudo apt-get install php5-cli php5-cgi psmisc spawn-fcgi      I'm using MySQL as the database and I connected PHP to MySQL using               sudo apt-get install php5-mysql      My database user has all permissions on the appropriate database. I'm also wondering if there's something in my Nginx Virtual Hosts file for the site that would cause this issue.


Create a author subpage

I want to create a author subpage, that looks like this `www.example.com/author/user/subpage` I read the Wordpess codex about how to create subpages. You can link a page with another page in the page panel. But my author page isn't listed in the page panel. So do i need to create a code for that in author.php or author-template.php, to get this done?


How to create a link to a user's profile page

I've created a user list for all the customers who registered on my website. When a outside user (or guest) browse my website and want to view the profile of a specific user, they should be able to click on the user's name and then should be redirected to the profile page of that user. I've managed to set everything up but the link points me to an author page and should point me to the PROFILE page of the user. Code inside `functions.php`:               function userlist() {         global $wpdb;              $users = $wpdb->get_results("SELECT ID, user_nicename from $wpdb->users WHERE display_name <> 'admin' ORDER BY display_name");              foreach ($users as $user ) {                  echo "
";             // GETTING USER AVATAR             echo "ID);             echo "/\">";             echo get_avatar($user->ID);             echo "";             // DISPLAY USER-NAME         echo '
';         echo "ID); // points to wishlist url -> seems like it searches for name          echo "/\">";         the_author_meta('user_lastname', $user->ID); // display name         echo "";      I've changed the `// DISPLAY USERNAME` part a bit. When I hover over the username, the link displayed reads: wordpress/user-list/username but when I click on the username it redirects me to the user's wedding registry page which is: `http://example.com/wishlist/romualdo-and-heidis-wishlist/` The good new is it point somewhere but it needs to go to the user's public profile page. What am I missing in the code to redirect it to profile instead of the wishlist page? The `functions.php` part where I use query var so that WP catches my custom `/user/username` url:               add_filter( 'query_vars', 'wpleet_rewrite_add_var' );     function wpleet_rewrite_add_var( $vars )     {         $vars[] = 'user';         return $vars;     }          add_rewrite_tag( '%user%', '([^&]+)' );     add_rewrite_rule(         '^user/([^/]*)/?',         'index.php?user=$matches[1]',         'top'     );          add_action( 'template_redirect', 'wpleet_rewrite_catch' );     function wpleet_rewrite_catch()     {         global $wp_query;              if ( array_key_exists( 'user', $wp_query->query_vars ) ) {             include (TEMPLATEPATH . '/UserList.php');             exit;         }     }


how to test a theme upgrade

Is there a way to test run a theme through the automatic updater? We have a theme where a version will introduce new functionality which might break existing themes. I would like to check previous theme version upon upgrade and include some upgrade-specific code if the upgrade is between two certain versions. I first thought I could use `after_theme_switch` hook, but the theme is mainly used as parent theme and will probably be upgraded while not being the active theme. I have looked into using `upgrader_pre_install` and `upgrader_post_install` hooks, but how to I test these? The ultimate would be to have it as a unit test, but any other way to mock- upgrade would be great. Uploading a zip file is treated as an install and not upgrade. Is this even possible from within a theme, our should I look into writing a mock-upgrade plugin?


posts_nav_link(); not showing up on static pages

I've got two different loops. The default on the homepage, but a secondary loop on the archive page. It grabs all the content, like so:               <?php // WP_Query arguments     $args = array (         'posts_per_page'         => '3'     );     // The Query     $archiveQuery = new WP_Query( $args );          // The Loop     if ( $archiveQuery->have_posts() ) {         while ( $archiveQuery->have_posts() ) {             $archiveQuery->the_post(); ?>
     <a href="<?php the_permalink() ?>">         <?php  first_item(); ?>       However, when I include `posts_nav_link();`, it does not show up. Is this because it is a static page? I am using this for an infinite scroll.


Performance on WPMS

my WPMS site is hosted on 8 cores/32mb RAM server but the response time is very high. We have about 1000 blogs (35,000+ tables on single db) and 70,000 pageviews per mounth. I think that i can down the response time moving blogs that have more pageviews into separeted DB and spliting all blogs into 100 blogs per db with hyper-db plugin. What do you think?


W3 Total Cache Plugin with WP 3 MultiUser

I'm having some strange behavior with my W3 Total Cache solution working on my multi-user Wordpress 3 installation. The multi-user is setup to use sub directories, and I'm using all types of caching in W3. My suspicion is that my problem has something to do with the .htaccess file. Periodically (but not consistently) navigating to certain parts of the site will end up redirecting to the wrong place. For example if I goto /corporate/ which is one of the subsite directories, it will redirect to /directives/corporate-training/ which is a single post of a different sub- site. This only happens occasionally, sometimes it is not a problem (which is why I think it is somehow related to page caching) The behavior suggests that somewhere in the redirect rules, it occasionally forgets to check for other sub-sites, and instead tries to match /corporate/ to the closest post slug in a different site. Looking for any guidance on where to look for the problem.


Priority of Meta Box for Custom Post Type

I'm having a small issue with the custom post type entry screen. I'd like to bump up my metabox right under the content box, but I'm not sure if that's even possible (as the metaboxes in between are "defaults", i.e.; Excerpt, Discussion & Author). I'm applying the standard code:               function ctp_admin(){     add_meta_box('cpt_meta', 'Meta Box', 'cpt_meta', 'cpt_function', 'normal', 'high');     }      Thank you! Noel


Google Analytics event tracking code being stripped out of links in Author box - WordPress site

I am using Yoast's Google Analytics plugin on my WordPress site. I have enabled Event Tracking for outbound links and have successfully manually added event tracking for some other internal links. It all works fine EXCEPT for in the 'Author Box'. Under each post I created an author box which pulls "the_author_description" from the user profile. This seems to strip out the GA event tracking code. I have an outbound link in there which should automatically be tracked by the plugin but the code is not there. If I try and manually add the code to any of the links in the user profile, they also get stripped out. Any ideas on how to fix this?


How to auto-accept a friend-request in buddypress based on user meta

I’m still getting my head around buddypress, so far so good but I’ve hit a snag where I want certain users who are flagged as an ‘expert’ to automatically accept any friend requests people make. I’ve found a couple of functions related to this but I think I’m missing something that would make this simpler such as setting a constant or overriding part of the $bp global… What I have so far is the following:               function bp_auto_accept_friend_request( $friendship_id, $friendship_initiator_id, $friendship_friend_id ) {         if ( is_user_expert( $friendship_friend_id ) ) {             // force add             friends_accept_friendship( $friendship_id );             friends_add_friend( $friendship_initiator_id, $friendship_friend_id, true );         }     }     add_action('friends_friendship_requested', 'bp_auto_accept_friend_request', 200, 3);      Can anyone tell me where I should be looking to make this nice and seamless just as if the main settings were set to bypass the request process please?


How can I save an array from a random post sequence for later use?

I'm building a random workout generator on Wordpress to help with my fitness, and am stuck at saving random post arrays for later reference. I'll explain. The generator should work in two main stages:   1. You choose how hard you want the workout to be, and how long it should take.  These values are passed to a new page via the a URL String. This creates a random workout (code at bottom of question) by displaying random posts based on the parameters from the string and code on a dynamic page ('/your- workout/')   2. If you like the workout, I want you to be able to save this random array of posts to use it again later.     1. The ID's of the post displayed in this random sequence are saved to an array.     2. When a user wants to save a workout to use again later, this array of Post IDs is used to create a new Wordpress Page, with content populated by those specific posts in that specific order. This would be a child page of ('/your-workout/') created by 'saving' a workout. Step 2 is specifically where I am stuck. **How can I save the post IDs of a random array and use them to create a new child page which displays this specific sequence?** _Relevant Code for Step 1:_                       <?php global $post;             if (isset($_GET['dm'])) { //Check DM is set             $mode = $_GET['dm'];      //Get DM Value - will define CPT's taxonomy             }             if (isset($_GET['e'])) {  //Check E is set             $posts = $_GET['e'];      //Get E value - will define how many posts are shown             }             $my_query = new WP_Query( "post_type=bw-exercise&orderby=rand&difficulty-mode=$mode&showposts=$posts");?> //Define query using pre-set and URL String values                  <?php   if ( $my_query->have_posts() ) {              while ( $my_query->have_posts() ) {                     $my_query->the_post();?>

<?php echo get_post_meta(get_the_id(), "wpcf-reps", true);?>

<?php the_title('
', '
');?>
<?php the_content();?>

<a href="<?php the_permalink();?>" target="_blank"><img src="<?php bloginfo('template_url');?>/custom/images/i.jpg">

             <?php                    }                }             ?>             <?php   wp_reset_postdata();?>      If I can be any clearer, please let me know. Thanks! R :)


Why I can't add a CSS style in this WordPress theme?

I am trying to add a CSS style to a WordPress theme that I am developing as is shown in this tutorial: http://www.wpbeginner.com/wp-tutorials/how-to- properly-add-javascripts-and-styles-in-wordpress/ but seems don't work and I cant' understand why. So this is the **head.php** file of my personal theme:               <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">     <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>          <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />     <title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> » Blog Archive <?php } ?> <?php wp_title(); ?></title>     <meta name="generator" content="WordPress <?php bloginfo('version'); ?>" />                <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />                         <?php wp_head(); ?>

<a href="<?php echo get_settings('home'); ?>"><?php bloginfo('name'); ?>

<?php bloginfo('description'); ?>

      And in my **functions.php** file I have put the following code:               <?php     function wpb_adding_styles() {         wp_register_script('my_stylesheet', plugins_url('style.css', __FILE__));         wp_enqueue_script('my_stylesheet');     }          add_action('wp_enqueue_scripts', 'wpb_adding_styles');     ?>      But the file **style.css** is not loaded. Why? What am I missing? In particular the thing that I can't understand in the previous tutorial is how and hwere the **wpb_adding_styles()** is called because in the header.php file it is never called. Someone can help me? Tnx Andrea


How to always rewrite author archive page URL even if the author does not have a post

My understanding about author archive page URL rewriting is that as long as the author has atleast one post/page the URL for the archive page ofthe author will be re-written to:               http://mysite.com/author/%authorname%      However, if the author does not have any post/page then the URL for the archive page will be of the form               http://mysite.com/?author=id      How can we force wordpress to always rewrite the URL to /author-base/%author% even if the author does not possess any post/page.


My default search is not working

I am using a fucntion to search my `post_meta` which i store with every post, But the problem is that when i search `title`, `tags`, content then the search not work. I think my new `function` just override the default search of wordpress. Here is my code               function custom_search_query( $query ) {         $custom_fields = array(             // put all the meta fields you want to search for here             "post_state",             "post_region",             "post_country"             );         $searchterm = $query->query_vars['s'];         // we have to remove the "s" parameter from the query, because it will prevent the posts from being found         $query->query_vars['s'] = "";         if ($searchterm != "") {             $meta_query = array('relation' => 'OR');             foreach($custom_fields as $cf) {                 array_push($meta_query, array(                     'key' => $cf,                     'value' => $searchterm,                     'compare' => 'LIKE'                     ));             }             $query->set("meta_query", $meta_query);         }     }     add_filter( "pre_get_posts", "custom_search_query");      So where is i am wrong. Any idea how can i search every thing. My custom `post_meta`,`title`,`tags`,`categories`,`content`.


Two columns in homepage each with one category

I modifying a wordpress template to be left with two columns on the main page with the following structure: ![enter image description here](http://i.stack.imgur.com/BjgbD.png) The first 4 are of a category and the last 4 of another The index code is: http://pastebin.com/dMC0saBN The page is (Columns are made, but all they do is repeat the post. They haven't order or filter)


Child-theme breaks site

So, I have a child-theme with nothing but the required CSS file in it. Once I activated this child-theme my entire site is down. I end up with 2 questions:   1. How can activating a child-theme with nothing but a CSS in it break my site?   2. How can I revert to my original theme? These are the errors the site gives me: > **Warning:** `require_once(/wp-content/themes/interio_child/admin/options- > framework.php) [function.require-once]:` failed to open stream: No such file > or directory in `/wp-content/themes/interio/functions.php` on line 54 > > **Fatal error:** `require_once() [function.require]:` Failed opening > required `'/wp-content/themes/interio_child/admin/options-framework.php' > (include_path='.:/usr/lib/php:/usr/local/lib/php')` in `/wp- > content/themes/interio/functions.php` on line 54


Make Show Notes for Individual Podcast Episodes Easy to Find (multiple URL's?)

My show notes for a podcast will be entered as a new post (like a blog post) in Wordpress (.org - hosted through bluehost, domain registration at godaddy). The site is www.michellefit.com, but the URL specific to a page (and very long and complicated) and does not include my actual web address within it (not sure if this is an issue for what I'm trying to achieve). Now, I want to be able to say in the podcast, "for the show notes on this episode, go to www.michellefit.com/6" (for a direct link to Episode 6 of the podcast, rather than the other two options 1) giving out the ENTIRE URL or 2) telling them to go my site, then to the Podcast tab, THEN scroll down the list of shows to find this particular one). NEED: A step-by-step process to make this happen :-) And I am NOT a techie. I have been researching this online for more than a month and have not yet been able to pinpoint an answer. Thanks for reading this post, and I hope you can help! :-)


Custom time field won't sort regardless of format

I'm using a custom fields plugin for WordPress (Advanced Custom Fields) and am using a time picker field set to format: "h:mm tt". Using a typical WP query, I'm attempting to sort by "start time" in ascending order, but the returned lists of posts seems to sort on ascending numerical value (i.e. 12:00 PM would appear after 6:00 PM). I checked the custom field data and it's definitely being saved as a UNIX timestamp (start time of '1383224400' for example). I've passed a few combinations of arguments to query_posts but nothing I've tried has worked. Here is the query I'm using:               <?php $args = array(         'post_type' => 'friday_event',         'orderby' => 'meta_value_num',         'meta_key' => 'start_time',         'order' => 'ASC',         'nopaging' => true     );     query_posts( $args );     while ( have_posts() ) : the_post(); ?>      Any ideas what I might be doing wrong? I've tried using a custom 'meta_query' where I set 'meta_value' to a variable and do a custom compare, but I still can't get the posts to sort correctly. Any help is very much appreciated!


Should I escape the attributes when using get_month_link?

I am not sure should I use `esc_attr()` with `get_month_link()` like this:               <a href="<?php echo esc_attr( get_month_link( get_the_time('Y'), get_the_time('m') ) ); ?>">     <?php the_time( get_option( 'date_format' )  ); ?>      Or should I code it like this (without escaping):               <a href="<?php echo get_month_link( get_the_time('Y'), get_the_time('m') ) ; ?>">     <?php the_time( get_option( 'date_format' )  ); ?>      So security wise which is the best option? Thank you.


create page for listing custom post type comments

I have a custom post type and I want to create a page which will automatically list all the comments posted under my **single-{my-post-type}.php**. What is the best practice for creating something like ? Should I create a custom page called let's say single-my-post-type- comments.php and put there the neccesarry code ? Is this possible in wordpress? Thank you !


Combining external feed into post loop

I don't even know where to start on this. I would like to combine an external JSON or XML feed into the post loop and sort it by date. The page will need to auto-load the next posts and have the ability to filter by category. I'm not sure if the best way to do this is to create a custom post type for this external feed and create a post for each item.


I have no images in an activated wp theme

With this line everything works fine - (as a **Non-Wordpress** index.php):               <link href="style.css" rel="stylesheet" type="text/css"/>       When I activate the file as a wp theme and replace above line with:               <link href="<?php bloginfo('stylesheet_url');?>" rel="stylesheet" type="text/css"/>      everything is ok, except - there are no images. For example - a div with an image:

      **images** folder is inside theme's folder.


How to show more post at a given category?

I need to show more post at the category `state` (with `tag_ID=21`), for example, I set the number of post show at homepage is 6, but I want 10 post when archive `state`, is there any way to add a filter in `functions.php`? Maybe `posts_per_page` and `wp count posts` is helpful. ---Edit--- My Code in `functions.php` is:               function change_numberposts( $query ) {         // Only modify the main query         if( $query->is_main_query() ){             // Category 21             if ( $query->is_category( array( 21, 'shuoshuo', '说说' )  ) ) {                 $query->set( 'posts_per_page', 10 );             } else {             $query->set( 'posts_per_page', 6 );                  }         }     }          add_action( 'pre_get_posts', 'change_numberposts' );      I also tried               is_category( 21 )     is_category('21')     is_category('shuoshuo')      The only work case is               is_category()      which will output 10 posts in each category. I also noted that `is_category( 21 )` is work for the permalinks set to be numeric. Since my permalinks is self-defined: `/%year%/%monthnum%/%day%/%postname%.html`, how to make the above code behaved as expected?


Update all posts at once

I have added a custom taxonomy to my posts, that will get a value by iteself on post_update action. What will be the SQL query to update all my posts at once so that the taxonomy value is added to each of them. Also will updating from SQL call the update_post action of wordpress?


Best way to modify content from index.php to single.php?

My blog has simple posts including a youtube videos. For example:                     and index.php will echo content ( ) I want that the permanent link of this post ( single.php ) displays:                     .. it's the same video but with different width and height. What will be the best and easy way? ( should i use and try to work the excerpt and content someway? ) That also leaves to another question: how to show some content in the index.php and different content in the single.php page ? Many thanks, Pedro


WooCommerce permalinks

I got the following question: When I go to a WooCommerce category, the link displays like this:               **http://www.example.com/product-category/** category/ Where the bold text is the link like it is and the rest is the product category that needs to be shown. When i go into WooCommerce settings and I go to the pages tab, I got an option to change productcategory slugs. If I fill the following in this textfield: `%product_cat%` the links shows as follows:               **http://www.example.com/** category/category/ What I want to show in my links is:               **http://www.example.com/** category/subcategory/product Is there any way to do this?


Sub domain redirection to taxonomy

Hi all I want to use sub domain for my taxonomy like that : http://taxonomy.domain.com/apple map to http://www.domain.com/taxonomy/apple I add this to my vhost                   RewriteCond %{HTTP_HOST}    ^taxonomy\.domain\.com [NC]         RewriteRule ^/(.*)$        http://www.domain.com/taxonomy/$1 [L]      And add a wildcard to my dns configuration. The redirection works but I want to use only rewrite but not redirection. So I want to use the target page but still have the subdomain url. So taxonomy.domain.com/apple is map but not redirect to the taxonomy url Any help? thanks in advance


How to internationalize the sub menu name "categories" in Custom post type?

I'm trying for translation. I made a plugin with custom post type everything is okay. Only one thing i can't able to translate which is `categories` sub menu menu in custom post type.               $args = array(             'labels' => $labels,             'public' => true,             'menu_position' => 4,             'has_archive' => false,             'taxonomies' => array('category','mypost')     );      for the `$labels` i translated easily but here for the category i can't able to translate. If i do __() in the array of taxonomies then the category is not at all coming because that might be translate so the wordpress can't able to recognize the argument. How to translate categories sub menu in my custom post type menu? Is there any way to rename it? Because from the rename i guess i can translate


Is it possible to Schedule Attachments in Wordpress?

As it's fairly well known, it is possible to schedule Posts in Wordpress for publishing. Also Attachments are actually Posts (in the more internal, technical meaning). So the question that bothers me right now is: Is it possible to schedule attachments as well? Like for example that a Photo-Gallery grows over time?


Is it possible to have different header style blog titles in different categories?

For my category titled 'mindset' I would like to use the following style on my post header:               background: none repeat scroll 0 0 grey;     border-bottom: 5px solid #83990A;      However for my 'news' category I would like to use the following style:               background: none repeat scroll 0 0 grey;      Any ideas of the coding I could use? Thanks.


Ordering users of a specific role by last name

I'm trying to display a list of authors by their last name. I can get the list to display but as yet I don't seem to be able to order the list by last name. Any help would be greatly appreciated. Josh               <?php         $args  = array(         // search only for Authors role         // order results by display_name         'orderby' => 'meta_value',         'meta_key ' => 'last_name',         'role' => 'guest-teacher'                        // check for two meta_values         );         // Create the WP_User_Query object         $wp_user_query = new WP_User_Query($args);         // Get the results         $authors = $wp_user_query->get_results();         // Check for results         if (!empty($authors))         {             echo '
';             // loop trough each author             foreach ($authors as $author)             {                 // get all the user's data                 $author_info = get_userdata($author->ID);                 $url = get_author_posts_url($author->ID);                ?>
<a href="<?php echo $url; ?>"><?php echo $author_info->last_name; ?>
                      <?php             }             echo '
';         } else {              }         ?>


How do I make a custom taxonomy for a CPT appear inbetween title and editor boxes?

This may be a duplicate of this question - Changing the priority of a custom taxonomy's metabox but I can't work out how to apply that answer. I'm unsure what my custom taxonomy div label would be and how to get it to apply to only a custom post type. I have a custom taxonomy, created with register_taxonomy and I would like to make the taxonomy box appear inbetween the post title field and the editor field in the wp-admin add/edit post area, for a set custom post type. Usually you can change CPT order in the admin menus with a priority field, but I don't think there is one for taxonomies... Thanks


Users can't upload images on frontend if they haven't got access to the wp backend

I let users create posts and upload/attach images to that post via the **frontend**. This works fine. However, when I restrict the access to the Wordpress backend (/wp-admin/) via a code snippet like this one               function wpse_11244_restrict_admin() {         if ( ! current_user_can( 'manage_options' ) ) {             wp_die( __('You are not allowed to access this part of the site') );         }     }     add_action( 'admin_init', 'wpse_11244_restrict_admin', 1 );      or (EDIT) with a redirect code               function redirect_non_admin_users() {         if ( ! current_user_can( 'manage_options' ) && '/wp-admin/admin-ajax.php' != $_SERVER['PHP_SELF'] ) {             wp_redirect( home_url() );             exit;         }     }     add_action( 'admin_init', 'redirect_non_admin_users' );      the Media Upload does not work anymore ("Error" Message). This problem has been discussed elsewhere: > I figured out that if the role didn't have that access [to the backend], it > also killed their ability to upload files on the front end. Is there a way to prevent users to access the backend without killing their ability to upload images on the frontend? Thank you!


How to show different categories in different pages?

I have this webpage with blog and a page with latest news. Right now both pages are showing the same category. How do I separate them? so that one page show category 1 and the other show category 2? code for category_blog.php                              <?php if ( is_active_sidebar( 'category-sidebar-widget-left' ) && is_active_sidebar( 'category-sidebar-widget-right' ) ) { ?>
          <?php } elseif ( is_active_sidebar( 'category-sidebar-widget-left' ) ) { ?>
          <?php } elseif ( is_active_sidebar( 'category-sidebar-widget-right' ) ) { ?>
          <?php } else { ?>
          <?php } ?>

                                   <?php echo single_cat_title( '', false ); ?>

                  <?php if ( have_posts() ) : ?>                                       <?php while ( have_posts() ) : the_post(); ?>                 <div <?php post_class(); ?>>
                             <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>">                                 <h1 class="tmpost-<?php the_ID(); ?>">                                 <?php $tit = the_title('','',FALSE); echo substr($tit, 0, 150); if (strlen($tit) > 150) echo " ..."; ?>

                         <div class="tmpost-<?php the_ID(); ?>-item">
                                                           <?php _e('By', 'tm_myid_text'); ?> <?php the_author(); ?>

                                                           <?php _e('In', 'tm_myid_text'); ?> <?php $category = get_the_category(); echo $category[0]->cat_name; ?>

                                                          <?php the_time('M jS, Y') ?>

                                                           <?php comments_number(__('0 Comments', 'tm_myid_text'), __('1 Comment', 'tm_myid_text'), __( '% Comments', 'tm_myid_text') );?>

                                                           <?php echo tm_viewcounter_display(get_the_ID()); ?>

                     <?php if (has_post_thumbnail()) { ?>                         <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">                         <?php the_post_thumbnail( 'full' ); ?>                                              <?php } else { ?>                     <?php } ?>

                         <?php echo excerpt(300); ?>

                                 <a href="<?php the_permalink() ?>">                                                                           <?php _e('Read More', 'tm_myid_text'); ?>

                 <?php endwhile; ?>

             <?php echo tm_pagination_nav(); ?>

                           <?php else : ?>             <?php endif; ?>
           this is the index code:               <?php      /* Template Name: Home 5 */     ?>          <?php get_header(); ?>

                                    Recent Posts

                  <?php if ( have_posts() ) : ?>                                       <?php $wp_query = new WP_Query( array(                                                      "cat" => "",                                                      "posts_per_page" => "",                                                      "post_type" => "post",                                                     "paged" => get_query_var('paged') ? get_query_var('paged') : 1                                                     )                                                                                );                 while( $wp_query->have_posts() ) : $wp_query->the_post(); ?>                      <div <?php post_class(); ?>>
                             <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>">                                 <h1 class="tmpost-<?php the_ID(); ?>">                                 <?php $tit = the_title('','',FALSE); echo substr($tit, 0, 150); if (strlen($tit) > 150) echo " ..."; ?>

                         <div class="tmpost-<?php the_ID(); ?>-item">
                                                           <?php _e('By', 'tm_myid_text'); ?> <?php the_author(); ?>

                                                           In <?php $category = get_the_category(); echo $category[0]->cat_name; ?>

                                                          <?php the_time('M jS, Y') ?>

                                                           <?php comments_number(__('0 Comments', 'tm_myid_text'), __('1 Comment', 'tm_myid_text'), __( '% Comments', 'tm_myid_text') );?>

                                                           /*<?php echo tm_viewcounter_display(get_the_ID()); ?>/*

                     <?php if (has_post_thumbnail()) { ?>                         <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">                         <?php the_post_thumbnail( 'Full' ); ?>                                              <?php } else { ?>                     <?php } ?>

                         <?php the_content(); ?>

                                 <a href="<?php the_permalink() ?>">                                                                            <?php comments_number(__('(0) Kommentarer ', 'tm_myid_text'), __('(1) Kommentar', 'tm_myid_text'), __( '(%) Kommentarer', 'tm_myid_text') );?>

                      <?php endwhile; ?>

             <?php echo tm_pagination_nav(); ?>

                           <?php else : ?>             <?php endif; ?>
               <?php get_template_part( 'sidebar_left' ); ?>                    <?php get_footer(); ?>


Shortcodes Ultimate pulse my widget in sidebar

I have create my website with sidebar is good for along time. In the recent day, I activate shortcodes Ultimate plugin with my website. I love this shortcodes but It effect with widget in sidebar. It had pulse an image in wedget. example : http://www.trattown.com/th/hotels/%E0%B8%A3%E0%B8%B2%E0%B8%A1%E0%B8%B2%E0%B8%A2%E0%B8%B2%E0%B8%99%E0%B8%B2-%E0%B8%A3%E0%B8%B5%E0%B8%AA%E0%B8%AD%E0%B8%A3%E0%B9%8C%E0%B8%97-%E0%B9%80%E0%B8%81%E0%B8%B2%E0%B8%B0%E0%B8%8A%E0%B9%89%E0%B8%B2/ How to fix it? Why I know that Shortcodes Ultimate is Trouble cause when I deactivate it. My website is ok.


How to set permalink structure via functions.php

I'm setting up a Wordpress Network and wanted all new sites to have the same permalink structure (i.e. "/%year%/%monthnum%/%postname%/"). I'm wondering if this is possible to do via hooks or hacks in functions.php, without having to rely on users to choose that structure.


date.php shows all posts. how to fix it?

I am using the following function for **category.php**. It's working fine.               function cat_page_list(){     /*     post : returns the post for category page     */           $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;         $cat1 = get_query_var('cat');         $cat_name = get_category($cat1)->name;         $args = array('cat'=> $cat1, 'posts_per_page' => 3, 'paged' => $paged );                 query_posts( $args);          if(have_posts()) :             print ('
');                  while (have_posts()) : the_post();                     $excerpt = get_the_excerpt();                        $date = explode(",", get_the_time("F,j,Y", "", "", false));                     print('

');                                      print('
                                                                              ' . $date[1] . '
' . substr($date[0], 0, 3) . '
');                         print ('
');                                 the_title('
', '
');                         print ('
');                                                            print ('
');                         print ('

');                             if (strlen(get_the_content()) > 100) {                                 $content = get_the_content();                                 echo str_replace(' ', '

', substr($content, 0, 300)). "....";                                    echo '
Read More';                             }                             else { the_content(); echo "
"; }                             print ('

');                              print('

');                 endwhile;                 if (function_exists("pagination")) {                     pagination();                 }             print ('
');         endif;           }      it's working fine and showing the 3 posts per for peroper categories. Eg: if click the **category 1** and it shows post under **category 1** and if click the **category 2** and it shows post under **category 2** Now I want to do the same design on my **date.php**. so I created the function named               date_page_list();          and changed the following codes only.          $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;         $cat1 = get_query_var('cat');         $cat_name = get_category($cat1)->name;         $args = array('cat'=> $cat1, 'posts_per_page' => 3, 'paged' => $paged );        TO                   $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;         $args = array('posts_per_page' => 3, 'paged' => $paged );       now the problem is when I call the `date_page_list();` it shows all the post from the blog. How can I fix this.?? Any help will be very much appreciated. the following code works properly and giving the proper post for the proper dates. but I need to do the same style as my **category.php**               <?php      $date1 = get_query_var($query_string.'date');     get_posts( array ('posts_per_page' => 10 ) );     while ( have_posts() ) : the_post(); ?>
     <?php the_time( get_option( 'date_format' ) ); ?>
     <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?>

     <?php endwhile;     wp_reset_query();?>


Disqus plugin issue

I have a problem with the Disqus plugin: comments don't load. But, when I resize the window of Google Chrome or Firefox, comments load and display correctly. This is very strange. You can test here. You see that comments don't load and when you resize the window, comments load. Do you have a solution for this problem?


Custom list of categories that is sortable by count

So I am attempting to use bootstrap with wordpress. Inside my left column my design called for a large box and then 4 smaller ones below. Those boxes would hold information about a category. There would be an image, then below that the title of the category and then the count of post within that category. I would like to be able to sort it dynamically and have the category with the most related posts show up in the larger box. Where I am stuck at is calling the individual objects (title, img, count) for each category. Is this possible or do I need to forget about the sorting by count and just call individual objects by the category id? The site is located at datalitigationblog.com Thanks in advance.


Where to populate custom terms in custom taxonomy in plugin?

I have a plugin that successfully creates a custom taxonomy for a custom post type. What I'd like to do, is on activation (or wherever works), create a default set of terms for the custom taxonomy. I've successfully done this before by using `wp_insert_category` in a function called upon plugin activation. That same function isn't working for the custom taxonomy, though. My guess is that it is because the custom taxonomy isn't registered yet when the function gets fired. I can't seem to find out where to hook the function so that it works with a custom taxonomy. I've tried calling the function from `wp_loaded` also and I curiously get `Call to undefined function wp_insert_category()` That puzzles be as well because I thought that hook meant all of Wordpress was loaded. Any advice would be greatly appreciated. Thanks.


Can I just copy and duplicate a WordPress installation?

I have a virtual server at Strato with Plesk 11 installed. There I got offered to install WordPress and created a blog. All fine. It has created a "/wordpress" folder on my server's `httpdocs` directory. Say, I wanted to have a second installation of WordPress on the same server, running a different blog. Can I just go and duplicate the WordPress subdirectory? Is everything that is needed for WordPress inside that folder?


How to Add Custom CSS to the Media Thickbox?

I've added a couple of custom fields to the Edit Media screen, but when these are displayed in the WP Media Thickbox (when adding images from the Edit Post screen, for example), the styling is gone. Is there a hook to add my custom CSS to the Thickbox Iframe when it loads?


Query Custom Post Type and sort by year

How do I create a page template were I can query all the posts from the Custom Post Type - let's say - "project" and order the results by year, displaying the year value at the beginning of each group .


Usage of custom post types in a custom admin menu

This question is a little hard to explain but i will try to be as clear as i can: I have a custom theme that i am presently working on, within this theme i have added a top level menu in wp-admin with 5 submenus below it. In one of these submenus i wish to add custom post types where admin user can create and edit posts and not have to go through the default WP process of Posts >> Add New. The reason i want to do it this way is that the custom post types will contain hooks to include certain calls to an API (user tokens, keys, xml etc) and i want to avoid the confusion of the end user creating posts away from what are to be core functions of my theme. At present i have no code worked out, (im not asking for it either) as you may understand googling on the lines of "custom post types admin menu" etc just throws back all sorts of irrelevance, do any of you gurus have a pointer where i can get a heads up on how to implement this?. Regards Martin


Wordpress subdomain wp-admin redirects to main domain

we have a wordpress installation running on address www.example.com. We wanted to have a development site for it as a subdomain, so we created a subdomain dev.example.com on cpanel. Created a duplicate of its database and replicated the files to the directory root of dev.example.com. Then modified wp- config.php to point to the duplicate db. Now the problem is, when we try to access dev.example.com/wp-admin, it redirects to https://www.example.com/wp- login.php?redirect_to=https%3A%2F%2Fdev.example.com%2Fwp-admin%2F&reauth=1 Anybody can help me with this?


Make page tab link to pdf

I'm sure this is ridiculously simple, and I'm just missing something very basic. I have a CV as a pdf. I'd like to have the tab that says CV open up that CV as a pdf. I do not want to embed it as a Google Doc or anything. **EDIT:** Including link to my site. http://adamgoodkind.com/. I'd like the "CV" tab to bring up the pdf.