How to use pagination in category list?

Use pagination in function ?                function get_posts_for_cat_ordered( $cats = array(), $posts_per_cat = 2 ) {           if ( empty($cats) ) return false;           $q = new WP_Query( array('posts_per_page' => 99, 'category__in' => $cats) );           $posts_ordered = array();           $done = 0;           while ( $q->have_posts() ) : $q->the_post();             global $post;             $cats = get_the_category();             $cat = array_shift( $cats );             if ( ! isset($posts_ordered[$cat->slug]) )               $posts_ordered[$cat->slug] = array('term' => $cat);             if ( ! isset($posts_ordered[$cat->slug]['posts']) )               $posts_ordered[$cat->slug]['posts'] = array();             if ( count($posts_ordered[$cat->slug]['posts']) == $posts_per_cat ) {                $done++;                if ( $done == count($cats) ) return $posts_ordered;                continue;             }             $posts_ordered[$cat->slug]['posts'][] = $post;           endwhile;           wp_reset_postdata();           return $posts_ordered;         }      use               $cats = array(12, 13, 14);     $posts_per_category = 2;     $posts_ordered = get_posts_for_cat_ordered( $cats, $posts_per_category );          if ( ! empty($posts_ordered) ) { foreach ( $posts_ordered as $loop_data) {          // Example category heading       echo '
' . $loop_data['term']->name . '
';       global $post;       foreach ( $loop_data['posts'] as $post) {         setup_postdata($post);     ?>                   <?php the_title(); ?>
       <?php the_content(); ?>
          <?php       }       wp_reset_postdata();          } }


Widget checkbox array empty on update function

I have a widget that is not passing checkbox state to $new_instance, specifically $instance[ 'posts' ]; if I dump $new_instance in the update function it is empty? All the other instance variables are fine and as expected?                 /**          * Ouputs the options form on admin          *          * @param array $instance The widget options          */         public function form( $instance ) {                  if ( isset( $instance[ 'type' ] ) ) {                 $type = $instance[ 'type' ];             }             else {                 $type = __( 'Select Type', 'text_domain' );             }                  if ( isset( $instance[ 'icon' ] ) ) {                 $icon = $instance[ 'icon' ];             } else {                 $icon = __( 'Select Icon', 'text_domain' );             }                  if ( isset( $instance[ 'title' ] ) ) {                 $title = $instance[ 'title' ];             } else {                 $title = __( 'New title', 'text_domain' );             }                  if ( isset( $instance[ 'posts' ] ) ) {                 $theposts['posts'] = $instance[ 'posts' ];             }                  ?>
             <label for="<?php echo $this->get_field_id( 'type' ); ?>"><?php _e( 'Type:' ); ?>              <select id="<?php echo $this->get_field_id('type'); ?>" name="<?php echo $this->get_field_name('type'); ?>" class="widefat" style="width:100%;">                 <?php                $types = array('Select Type', 'rental' => 'Rental', 'cloud' => 'Cloud', 'konnect' => 'Connect', 'support' => 'Support');                 foreach($types as $type => $v) { ?>                      <?php if ( isset( $instance[ 'type' ] ) ) { ?>                     <option <?php if ( $instance['type'] == $type ) echo 'selected="selected"'; ?> value="<?php echo $type; ?>"><?php echo $v; ?></option>                 <?php } else { ?>                     <option  value="<?php echo $type; ?>"><?php echo $v; ?></option>                 <?php } ?>                  <?php } ?>                   </select>

             <label for="<?php echo $this->get_field_id( 'icon' ); ?>"><?php _e( 'icon:' ); ?>              <select id="<?php echo $this->get_field_id('icon'); ?>" name="<?php echo $this->get_field_name('icon'); ?>" class="widefat" style="width:100%;">                 <?php             $icons = array('Select Icon', 'monitor', 'users', 'switch', 'cloud', 'arrows-ccw', 'user', 'user-add', 'link', 'lock', 'thumbs-up', 'upload-cloud','login','database','install','lifebuoy','signal','network');                 foreach($icons as $ico) { ?>                      <?php if ( isset( $instance[ 'icon' ] ) ) { ?>                     <option <?php if ( $instance['icon'] == $ico ) echo 'selected="selected"'; ?> value="<?php echo $ico; ?>"><?php echo $ico; ?></option>                 <?php } else { ?>                     <option  value="<?php echo $ico; ?>"><?php echo $ico; ?></option>                 <?php } ?>                      <?php } ?>                   </select>

             <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?>              <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />

                 <label for="<?php echo $this->get_field_id( 'posts' ); ?>"><?php _e( 'Post to show:' ); ?>
                      <?php                 if ($instance ['type'] == 'konnect') {$instance ['type'] == 'konect';}                 $newargs = array('posts_per_page' => -1, 'post_type' => $instance[ 'type' ], 'post_parent' => 0,);                 $specificposts = get_posts( $newargs ); ?>                      <?php foreach($specificposts as $name => $specificpost) {  ?>                               <?php if ( in_array( $specificpost->ID, $instance[ 'posts' ] ) ) { ?>                         <p class="<?php echo $specificpost->ID; ?>"><input type="checkbox" name="<?php echo $instance[ 'posts' ][$specificpost->ID]; ?>" value="<?php echo $specificpost->ID; ?>" checked="checked" /> <?php echo $specificpost->post_title; ?>
                     <?php  } else { ?>                         <p class="<?php echo $specificpost->ID; ?>"><input type="checkbox" name="<?php echo $this->get_field_name('posts'). '['.$specificpost->ID.']'; ?>" value="<?php echo $specificpost->ID; ?>" /> <?php echo $specificpost->post_title; ?>
                     <?php }  ?>               <?php } ?>
                          <?php }


A include_template Question

Right now I am building virtual pages on a wordpress install. I use the include_template hook to add some logic that checks for a 404 page & some regex to look for a specific pattern. This seems horribly inefficient. If my plugin is doing this, and other plugins are doing this, arn't we all just adding tons of code to be parsed every single time a page loads on the website? What happens when my plugins grows enormously. This system of hooks is terrible. Am I doing this right?


I'm loading some posts using this argument:               $args = array(      'category__in' => $catID,      'category__not_in' => 1,      'posts_per_page'=>10,      'date_query' => array( array( 'before' => get_the_date() ) )     );      The problem I'm having is that I want to include the actual post I'm on, this carries on after the current post. I've tried adding `'offset'=>-1` but that doesn't seem to work. How can I load posts starting from, and including, the current post? **Edit: I've tried using`inclusive` but it didn't seem to work.**               <? php     $args = array(         'category__in' = > $catID,         'category__not_in' = > 1,         'posts_per_page' = > 10,         'date_query' = > array('before' = > get_the_date(), 'inclusive' = > true));     $loop = new WP_Query($args);     while ($loop - > have_posts()) {         $loop - > the_post();         get_template_part('sidebar-posts-template');     }     wp_reset_postdata(); ?>


How d0 i get the number of attachments in the post

Is there a function that allows me to get the number of photo's attached to a post and that also grabs the url of the first attachment to go to the attachment page for each post? Here is an example of what i want to accomplish, that i did in photoshop ![enter image description here](http://i.stack.imgur.com/nP6PI.jpg) Do you see the number sixteen next to the thumbnails, thats what i want to accomplish, a code that allows the users to know how many photo's are attached to the current post they are reading and also have the number work as a link. I want the link to grab the first photo attachment url. My attachment are set up like this > /year-month-day/post-title/attachment Is this even possible?


Restoring from a Backup after Update

I recently updated a WP site from 3.0.1 to 3.3.1. The site has been having a lot of problems since the update. I want to restore the site to a version I backed up right before updating. I used the EZPZ OCB plugin to backup the site. Is restoring it as simple as deleting the current server files and then uploading the backup via FTP? Thanks


qTranslate slows down my website

When the qTranslate plugin is activated, my website is very slow. If the plugin is deactivated, the website opens faster. How can I speed up the website with the plugin activated?


what's the best way to add a class to the div with a class of post every 4 seconds using jquery?

Headline News Part 2

testing new content

Headline News Part 2

testing new content

Headline News Part 2

testing new content

      so i want the first to have a class of "display" then after 4 seconds, i want to remove the class on that one and add it to the second one. and then after 4 more seconds, remove it from the second and add it to the third. when it gets to the end it loops back around.


Permalink Structure not updating .htaccess

I am trying to update the permalink structure using the back-end and Settings -> Permalinks. The `.htaccess` file is not updating. I have given `.htaccess` full access with `chmod -R 777 .htaccess` and still, Wordpress says that the permalinks are updating, yet they aren't coming through. When I click, I'm still getting 404s from `apache2`.


Trying to only display 1 category using get_posts

I'm trying to only display posts from a certain category in a widget. I've tried it in a few different ways but it is still showing posts from all categories. Here's my code at the moment:               $posts = get_posts(array ('category'=>6, 'numberposts'=>$number, 'order'=>'DESC', 'orderby'=>'date'));             foreach ($posts as $post){                 setup_postdata($post);....      Thanks.


wordpress get_post_meta / the_meta to output custom field value

What I'm trying to do is quite simple: I want to add a custom field named 'Button' to each post that will show a button (image) on the page with the value as its link. It's basically a button that will show on every post, the link that the button points to will be entered in the value field of the custom field. This is the code I used in single.php:
       <a href="<?php get_post_meta($post->ID, 'Button', true); ?>">         <img src="<?php echo get_template_directory_uri() . '/images/button.png'; ?>" alt="link" />
       The problem is that the output of the value field doesn't appear. The link that supposed to be on the button image is not in place. Instead the button links to the post. This is the website in question: http://digitalmediaboard.com


Selecting a post in Dashboard

How to make in the admin's dashboard a <select> with the list of all posts of specified post type? I need this in order to save a post ID with `set_option()` call. How to do this?


How can I create a "Read More" link using the_excerpt() on a static front page?

I'm working on a website that uses a static front page. It also shows the single most recent blog post. This was achieved by creating a page and using a custom page template. Sometimes, the blog post is too long, so I want to use the_excerpt to automatically shorten it without the need for a more tag. So far so good. But, the_excerpt doesn't actually create a "read more" link. This is a pretty common problem, so I added:               <?php     function new_excerpt_more($more) {         global $post;         return '... ID) . '">continue reading.';     }     add_filter('excerpt_more', 'new_excerpt_more');     ?>      to my functions.php file. I've actually used this code without issue on another site, but for whatever reason, it's not working in this case. My initial guess was that it was because it's being called on a static page. The website is http://stuandjessproductions.com. The theme is Central by QODE, and I'm using a custom child theme. **EDIT** Adding code from the template page, as per request. This isn't the whole page, but rather just the relevant bit for the news post:               <?php $query = "showposts=1&orderby='date'"; query_posts($query);?>     <?php if(have_posts()) : while ( have_posts() ) : the_post(); ?>         <a href="<?php the_permalink();?>"><?php the_post_thumbnail('home'); ?>
Latest News

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


Email notification of new post includes code

One of my subscribers gets the following words at the beginning of the email of my latest post. Then part way through the post there is another string of code and further along there is another string of code. I signed up also via the link on my blog to get email notification of my own new posts and my email doesn't show this code??? > **The Company Header**   >  by Company Owner >   >   >     Normal >     0 >     false >     false >     false >     EN-CA >     X-NONE >     X-NONE >     /* Style Definitions */ >     table.MsoNormalTable >     {mso-style-name:"Table Normal"; >     mso-tstyle-rowband-size:0; >     mso-tstyle-colband-size:0; >     mso-style-noshow:yes; >     mso-style-priority:99; >     mso-style-qformat:yes; >     mso-style-parent:""; >     mso-padding-alt:0cm 5.4pt 0cm 5.4pt; >     mso-para-margin:0cm; >     mso-para-margin-bottom:.0001pt; >     mso-pagination:widow-orphan; >     font-size:11.0pt; >     font-family:"Calibri","sans-serif"; >     mso-ascii-font-family:Calibri; >     mso-ascii-theme-font:minor-latin; >     mso-fareast-font-family:"Times New Roman"; >     mso-fareast-theme-font:minor-fareast; >     mso-hansi-font-family:Calibri; >     mso-hansi-theme-font:minor-latin; >     mso-bidi-font-family:"Times New Roman"; >     mso-bidi-theme-font:minor-bidi;}


anchor tag in header not working on other pages except the home page

I have a anchor tag that wraps around my logo image that takes you back to the home page using the following `<a href="<?php bloginfo('url'); ?>"><img src="<?php bloginfo('template_directory'); ?>/images/logo.png" alt="Good Morning Moon"/></a>` It is inside my header.php file. On my home page which is a staid page set to custom template with the following code it works               <?php     /*     Template Name:Home Page     */     ?>     <?php get_header(); ?>          <?php get_footer(); ?>      However on any of my other pages which are using the default template which I assume is the index.php file I have setup based on looking at the http://codex.wordpress.org/Template_Hierarchy the anchor tag does not show up, my index.php file looks like so               <?php get_header(); ?>     <?php get_footer(); ?>      What could be causing this?


wp_update_post not working

I have the following code in a single script to be run one time to fix post names which are empty.               // WP_Query arguments     $args = array (             'post_type'              => 'books',             'name'                                   => '',             'post_status'            => 'publish',             'posts_per_page'                 => -1,     );     add_filter( 'posts_where', 'custom_posts_where' );     echo "1";     // The Query     $query = new WP_Query( $args );     echo "2";     $germanizer = new Germanizer();     // The Loop     if ( $query->have_posts() ) {             while ( $query->have_posts() ) {                     $query->the_post();                     // do something                     $seo_slug   = seo_slugs( $germanizer->sanitize_title_filter( $post->post_title ) );                     // check the slug and run an update if necessary                     if ( $post->post_name != $seo_slug ) {                             wp_update_post(                             array (                                     'ID'        => $post->ID,                                     'post_name' => $seo_slug                             )                             );                     }             }     }          function custom_posts_where( $where ) {         remove_filter( current_filter(), __FUNCTION__ );         if( FALSE === strpos( $where, 'post_name' ) ) {             $where .= sprintf( " AND %s.post_name = '' ", $GLOBALS['wpdb']->posts );         }         return $where;     }          // Restore original Post Data     wp_reset_postdata();      I have included `wp-config.php` so that is not the problem. In fact the script executes without any error on my local development environment (MAMP) and prints `2` but does not update the `post_name`. But on my test env, it echoes only `1` without any error and it naturally does not update the `post_name`. The total number of posts on my test env is around 5k, so I wonder if that is the reason. This code uses Germanix Plugin by @toscho and might be relevant information.


Shortcode attributes don't appear?

I'm working on my first shortcode, examples in Shortcode API are not suitable for starters, so I'm almost sure I'm doing it wrong! My shortcode:               function hello( $atts ) {             extract( shortcode_atts( array(             'foo' => 'something',             'bar' => 'something else',             ), $atts ) );                 return 'Hello, World!';            return $foo;        }          add_shortcode('hw', 'hello');      And I want [hw foo=HEHEHE] to output: Hello, World! HEHEHE. But it displays only Hello, World! How to access & echo shortcode attributes and eventually how to set the default value (I guess I've already set the default values to "something" and "something else" but I'm not sure since I have no idea how to output them.


Forcing Wordpress Administration onto a separate SSL Host

I've inherited a half-dozen or so wordpress sites. In a perfect world I would just put every one of them behind SSL throughout but I don't quite have enough IP addresses to go around and SNI will cut off windows XP users which is a non-starter. The next best thing would be to at least centralize the admin functions behind a SSL-only site. So, what I'd like to do is something like:   * front-end site is http://www.example.com   * back-end sites end up at https://ssl.example-secured.com/wordpress/$SITE There is a plugin which would let you force https for admin (http://wordpress.org/plugins/wordpress-https/) but it seems to require you stay in the same URL depth which won't work as I want to do this for a half- dozen or more wordpress sites and they can't all be at https://ssl.example.com/wp-admin Any ideas how to make this happen? I'll add we are moderately comfortable with hacking things in PHP, including the wordpress core, if need be. And we've got kooky CI / versioning schemes going on that make said hacks less painful. While I understand the general "wp-way" would be to use multi-site here we really don't want to go down that path. Is there a way to do this that does not involve multi-site?


Moving blog and maintaining current permalinks

I currently have a blog at http://thinkfuture.com/cfs . Its running WP 3.1 on IIS on a dedicated Windows 2003 server. I have the domain freedombunker.com redirecting to the blog at that URL. According to my SEO company, I would like to move my blog so that: 1. You can reach the home page if you use http://freedombunker.com 2. The permalinks which pointed to thinkfuture.com/cfs continue to work For example, a post at this current permalink http ://thinkfuture.com/cfs/index.php/2011/02/23/obama-welcomes-high-gas- prices/ should remain available as well as at the new permalink http ://freedombunker.com/index.php/2011/02/23/obama-welcomes-high-gas-prices/ so either permalink can work. Is this doable? Possible? A pipe dream? Can you run the same blog at two different permalinks with no pain and suffering? Can I just create a new virtual server on the Windows box and point to the wp directory on the first server? Thanks...Chris


Custom Widget function in Plugin not working?

I took a code straight out of one of my themes I created, and it's a list of all 50 states in an unordered list packed into a widget you can just drag and drop on the sidebar. The problem is, when I try using this code in a PLUGIN file, I get the following error: `Fatal error: Call to a member function register() on a non-object in C:\xampp\htdocs\wordpress\wp-includes\widgets.php on line 431` Why would it work in the theme, but not in the plugin? By the way, the active theme is NOT the theme I took the code out of. Here's my code: http://pastebin.com/ZeRWW3yb Thanks.


Wordpress Custom Post Type Filter not Working

I am pretty new to Wordpress and I have a problem with a filter in custom Post types.. See screenshot here of what I mean: ![enter image description here](http://i.stack.imgur.com/SvE1P.png) Here is the code I am using for the filter               public function jobs_by_codes( $show_counts = 1, $hierarchical = 1, $show_uncategorized = 1, $orderby = '' ) {         global $typenow, $wp_query,$wpdb;              if ( $typenow != 'job_listing')             return;              $r = array();         $r['pad_counts']    = 1;         $r['hierarchical'] = $hierarchical;         $r['hide_empty']    = 1;         $r['show_count']    = $show_counts;         $r['selected']     = ( isset( $wp_query->query['job_code'] ) ) ? $wp_query->query['job_code'] : '';              $r['menu_order'] = false;              if ( $orderby == 'order' )             $r['menu_order'] = 'asc';         elseif ( $orderby )             $r['orderby'] = $orderby;              $terms = get_terms( 'job_code', $r );              if ( ! $terms )             return;              $output  = "<input type='text' name='job_code' id='input_job_code' value='' placeholder='Jobk Code'/>";              echo $output;     }      Please is there anything I can doing wrong?


Users uploaded image and matching an id or taxonomy

I have many posts with a unique reference for a custom field [123456], over time I would like an administrator to upload a single image that matches the custom field ie > 123456.jpg I would then like to use a condition in the loop that says if file exists (123456.jpg) that matches the custom field (123456) then use that image for all posts with that custom field... I cant use the Media library because the folder structure is chronological, is there another way?


Content not showing up when using custom template + sidebar

I am working on a user dashboard for my site using wp user front end and Mingle. I decided the best way to integrate this is by creating a custom sidebar and using that in a new template, which I did. However.. None of my content is showing up and it's driving me nuts. sidebar-dashboard.php * * *               <?php     /*** The Sidebar containing the dashboard links **/     ?>          <?php     if ( is_active_sidebar( 'dashboard-sidebar' ) ) : ?>

                    <?php dynamic_sidebar( 'dashboard-sidebar' ); ?>

     <?php endif; ?>      * * * dashboard.php * * *               <?php     /*     Template Name: User Dashboard     */     ?>               <?php get_header(); ?>

                    <?php get_sidebar( 'dashboard' );?>     <?php get_footer(); ?>      * * * functions.php... * * *                   // Area 7, the sidebar for the dashboard panel     register_sidebar( array(         'name' => __( 'Dashboard Sidebar', 'twentyten' ),         'id' => 'dashboard-sidebar',         'description' => __( 'The dashboard sidebar', 'twentyten' ),         'before_widget' => '
',         'after_widget' => '
',         'before_title' => '
',         'after_title' => '
',     ) );      * * * So then I go and make all the dashboard pages have the "User Dashboard" template expecting that the sidebar would be on the left and the content would be on the right, but that's not the case. The sidebar shows up but no content whatsoever. What am I doing wrong? * * * Edit: Also, if someone knows any PHP hooks for Mingle that I can use in template pages that would be great, I can't find any documentation on it and they haven't answered me. It's not really a fix to the core issue, but it's a cheap way around it. For WP User Frontend I can just use the do_shortcode function, but Mingle doesn't even seem to have any shortcodes.


Query_posts works when appending via AJAX call wp_query doesn't?

I'm appending some posts on a click event to a twentyeleven child theme. For some reason though it only works when I use the query_posts loop and not a wp_query loop. For instance here's my wp_query loop:               $args = array('year' => $year,'monthnum' => $month);     $loop = new WP_Query($args);     if($loop->have_posts()) {      while($loop->have_posts()) {      the_post();     echo get_template_part( 'content');     }      } wp_reset_query(); //doesn't work      Then here's the query_posts:               query_posts(array(            'year' => $year,            'monthnum' => $month     ));          // our loop     if (have_posts()) {     while (have_posts()){     the_post();     get_template_part( 'content');            }     }     wp_reset_query();      I've been told to avoid query posts like the plague so I'd rather use wp_query. Any thoughts on why this is happening?


How can I create an "excerpt" with text that won't be displayed in the post itself?

I'm currently creating a new theme for my blog and I intend to make it in a magazine style manner. So, to clarify the question in the title: what I want to do is to create a text assigned to the post, but not displayed in the post itself. Lets say that the user Tom writes a review of the movie Black Swan - what I want to be able to do is summarize that review in a sentence or two - and use that text as an "excerpt" on the front page. Any ideas? It's probably a lot harder than I think it is.


Custom field values repeating

I'm at a loss. I've got a custom meta box with the 'multicheck' code that Jan created. It's working great. My issue now is getting the data to return properly. Scenario: there are 5 possible values, each with the same meta_key. What I am trying to do is display specific content if a value is stored with one of the 5 possible values. What is happening is that the content is repeating. Current site: http://dev.andrewnorcross.com/yoga/locations/tampa/ Current code:                   <?php         global $post;     $offerings = get_post_meta($post->ID, "evol_offerings_select", false);     if ($offerings[0]=="") { ?>                    <?php } else { ?>

offerings:
                 <?php                  foreach ($offerings as $offering) {                     if ($offering["hot"]==true) {                         echo "
";                         echo "
Hot 90
";                         echo "
temp: 105°   time: 90 min
";                         echo '
';                     }                     if ($offering["flow"]==true) {                     echo "
";                     echo "
Flow 75
";                     echo "
temp: 80°   time: 75 min
";                     echo '
';                     }                     if ($offering["warm"]==true) {                     echo "
";                     echo "
Warm 60
";                     echo "
temp: 90°   time: 60 min
";                     echo '
';                     }                     if ($offering["chill"]==true) {                     echo "
";                     echo "
Chill 30
";                     echo "
temp: 75-80°   time: 30 min
";                                         echo '
';                     }                     if ($offering["kids"]==true) {                     echo "
";                     echo "
Kids Class
";                     echo "
temp: comfy   time: 60 min
";                     echo '
';                     }                     } ?>


Custom permalink structure for custom post type

I´m using the following code to create a new post type:               /* Create custom post type: "Tilbud" */     register_post_type('tilbud', array(     'label' => __('Tilbud'),     'public' => true,     'show_ui' => true,     'capability_type' => 'post',     'hierarchical' => false,     'rewrite' => array('slug' => '???'),     'query_var' => false,     'taxonomies' => array('post_tag','category'),     'supports' => array('title'),     'register_meta_box_cb' => 'add_tilbud_metaboxes',     ));      I would like the premalink of these custom posts to contain the custom post type name followed by the post category: .../custom-post-type-name/post-category/post-title/ I´m aware that I use the rewrite argument to add a slug, but I don´t know what to write in order to insert the post type name and category name dynamically. Any ideas? Thanks!


Making pages also serve as taxonomies? Or give full pages to taxonomies?

I run a video game news blog. When my staff writes a news article or a review, I would like them to be able to "assign" that post to a game (if applicable), so then I could have the single.php template call information on that game (title, boxart, publisher, release date, etc.) and display it in the sidebar. I thought this might involve a custom taxonomy so that it could be assigned to a post just like tags are. But then I realized I also wanted those games to have full pages loaded with information. I initially thought to create a custom post type for pages, and using custom fields, I could call the game's box art, show its release date, display any posts or reviews on that game and displaying them with brief excerpts, and using custom taxonomies to display the game's publisher, developer, etc... And THEN I realized I also wanted those publishers and developers to have their own pages as well. Description, location, links to articles involving them, lists of any games attributed to them... and so on. None of these can be child pages of the other, since developers aren't always permanently tied to any particular publisher, games are sometimes co-developed by multiple parties, etc. I'm in a pickle, and can't figure out how to re-organize my site. I really want to use all the new toys in WordPress to make the site I want, rather than WP limiting what I can do. Any suggestions? I've been brainstorming for days trying to figure something out. Any suggestions would be appreciated.


Custom comment type based on thread level

I'd like to create a custom comment type based by thread level. The initial comment on a given post (top tier comment) would require the commenter to enter a title (I assume this would be a new database field since comments don't typically have titles) and then enter the comment in the typical comment body field. However, f someone were to reply directly to this comment (2nd tier comment) then they would be presented with the standard comment box that does not require a title. Would something like this be possible in WP via creating a custom plugin, etc? Much appreciated. Eddie


Custom post types with custom directories

I'd like to run a WordPress install with open registration so that anyone can sign up and post to a custom post type that would live at... domain.com/open/date/the-post-title I'd also like to run a blog on the same WP install that only I can post to that would live at... domain.com/blog/date/the-post-title Is something like this possible without running MultiSite (which I believe would force the blog to live at blog.domain.com)? Thanks. Eddie


How to verify this checkbox is checked?

Actually I want to include a file if the checkbox is checked               <?php     $checked = get_option('automatic') ? "checked='checked'" : "";     echo "<input type='checkbox' name='automatic' $checked />";     ?>          if(get_option('automatic') == 'checked')) ( require_once 'myfile.php'; )      This form is in a plugin option page


MultiPostThumbnail and the_post_thumbnail

I am using `built-in` Wordpress function to add (small) thumbnails to each post. In addition to the post thumbnail I am using **MultiPostThumbnail plugin** to add custom category (large) image. Since not all posts have thumbnails or "secondary image" (as it is called by MultiPostThumbnail plugin) I would like to display thumbnails (either large or small) in this order:   1. If I a post has large (MultiPostThumbnails) thumbnail and ( **small** ) thumbnail display only ( **large** ) thumbnail.   2. If a post doesn't have a ( **large** ) thumbnail display the ( **small** ) thumbnail. I hope now it makes more sense. It's a simple if statement but I can't get it to work. Here is a "pseudo-code".               <?php if (class_exists('MultiPostThumbnails')        && MultiPostThumbnails::has_post_thumbnail('post', 'secondary-image')) :           MultiPostThumbnails::the_post_thumbnail('post', 'secondary-image', NULL,  'post-secondary-image-thumbnail');     else {        the_post_thumbnail();     }     ?>


Try to run a function only on Home

I'm trying to run disable auto p filter on only my home page. In my functions.php file, I added this snippet:               function removeP(){         if ( is_page( 4 ) ) {             remove_filter('the_content', 'wpautop');         }     }          add_action( 'after_setup_theme', 'removeP' );      It does not remove the filter on the homepage.


Custom taxonomy or custom page templates?

I'm trying to decide whether it would be more appropriate to create two new custom taxonomies or if custom page templates would be easier. Here's the scenario:   * I have 2 custom posts types: "Cocktail Recipes" and "Distilleries"   * I have roughly 10 terms in the custom taxonomy "Alcohol Spirits Types" and both custom post types use this taxonomy. The number of these terms is unlikely to grow.   * I need 3 archive pages for each Alcohol Spirit Type term. One that displays results from both custom post types, one that displays results only from Cocktail Recipes and one that displays results only from Distilleries (e.g. Whiskey, Whiskey Cocktail Recipes and Whiskey Distilleries). Should I: 1. Create two new custom taxonomies. One would be specific to Cocktail Recipes and the other specific to Distilleries, but both would have identical terms to the already created Alcohol Spirit Types taxonomy. I could then use the taxonomy-custom_taxonomy_name.php template to create the pages. Or... 2. Create two custom page templates (one for Alcohol Spirits in Cocktail Recipes and the other for Alcohol Spirits in Distilleries) and two pages for each Spirit Type (roughly 20 pages total). To me, option 2 makes more sense because then I'm not duplicating terms in three different taxonomies. Also, a post editor would only need to tag a post twice. If the number of terms were larger this solution would be a huge task initially, but creating only 20 pages seems reasonable. What do you think? Is there an easier way I'm not thinking of?


Redirect URL Containing åäö

I'm moving my blog from Typepad to Wordpress but have a big problem. Among the urls that are exported from Typepad, many containing åäö. When they are imported WordPress changes all URLs and instead contains aao. I need help with how to redirect all urls that contains åäö to the new urls. It's a total of about 1300 urls. I am not a "hacker" and need a detailed description how I should do :)


Custom loop by url

So currently I have this working for 'search' ie: if I do www.domain.com/search/query, it returns everything it finds on the word 'query'. I would like to utilize that loop/template I created within that search.php but change it to posts. Then query a specific post category if possible ie: www.domain.com/posts/category1 I'm think it all stems off changing               <?php get_template_part('loop', 'search'); ?>      Fairly new to wordpress so any help or suggestions is greatly appreciated!


Where is dynamic_sidebar content defined?

A friend has asked me to edit a WordPress site that someone else has made for them. Part of it contains the following code:               dynamic_sidebar('footer4')      Which spews out a contact form. What I want to know is, is there an easy way for me to find out where the function that returns the HTML this contact form is defined? For example, if there was actually a function called 'footer4', I could do this:               // I've tried this and it doesn't exist;)     $reflFunc = new ReflectionFunction('footer4');     print $reflFunc->getFileName() . ':' . $reflFunc->getStartLine();      I've looked through all the template files and couldn't see anything. Any advice appreciated.


how to restrict posts_request filter to the main query only

I'm trying to run custom sql for search results, and I'm having trouble limiting the filter to the main query without running a redundant query. I'm successfully getting results via the following:               add_filter( 'posts_request', 'my_request_filter' );          function my_request_filter($sql) {         if(is_search()) {             $sql = 'some custom sql query'         }         return $sql;     }      The problem here is that this is affecting other things on the page running queries, like the recent posts widget. I can prevent this by adding 'suppress_filters' => true to the other queries, but that seems a bit backwards, and I'm not going to hack core to add that. the 'pre_get_posts' filter seems more appropriate, in that I can check for is_main_query, but I'm limited in how I can modify the query with this filter - I can't figure out how to entirely replace the query object with one created by a custom sql statement. The least ideal solution would be to simply ignore the main query, and run another one entirely; but the whole point of this exercise was to replace the main query with one optimized for this context.


Creating a full business website

I have a webservice and I want to sell it and allow the customer to set it up through a website. I'm thinking to use WordPress to make this website, but don't know if it is possible or how to do it. Basically, my webservice needs some information from the customer to work. I mean, after buying our service, the customer will have access to a page and he/she will input some information and submit them (to our server, that will set up the service for that customer). I need the WordPress to save these input information and display them later, whenever the customer access and log-in my website. In other words, I need any user can:   * Buy my service (public area) and then log-in to set it up (private area)   * Save, update and delete input personal information (that only he/she can see/create/update/delete) Can I do this through WordPress? Any idea on how?


mp3 audio metadata upload integration: can I autopopulate title, caption, description from id3 tags?

I'm using the native Wordpress.org Upload New Media subsystem pretty routinely to upload MP3 files. The MP3 file workflow we use populates the ID3 tags with some important user-friendly metadata. It would be good if the Upload New Media subsystem could populate the title, caption, and description fields for the file in the Media Library automatically. Has anyone created a Wordpress plugin for that specific purpose? If so, which one? If not, is it possible? Any suggestions on how I can proceed to do this?


Get newest created custom category (get_term_by and variables) (outside Loop)

I am wondering if there is any reason why the following code would not work? My situation: I have a custom category set up called 'Issue'. What I want to do is get the most newly created category (which is 'Volume 2 Issue 1') and get its ID so that I can run the plugin function `z_taxonomy_image_url($currentID);` which outputs a URL based on the category identified by `$currentID` I have a very hacky solution at the moment, but if anyone can figure out why the last 3 lines of the following bit of code doesn't work, it would be fantastic. Alternative and cleaner solutions would also be appreciated.               $taxonomy=wp_list_categories('taxonomy=issue&echo=0&number=1&orderby=ID&order=DESC&show_count=0&style=none&title_li=');     $tax = strip_tags($taxonomy);     $newtax = "'".trim($tax)."'";     $getID = get_term_by('name', $newtax, 'issue');     $currentID = $getID->term_id;      Doing a `var_dump` on `$getID` only results in `bool(false)` The interesting thing is that this code works (but I cannot use it because it would require manually changing the code each time I create a new category).               $getID = get_term_by('name', 'Volume 2 Issue 1', 'issue');     $currentID = $getID->term_id;      Is there something with `get_term_by` that it rejects using `$newtax` but accepts `'Volume 2 Issue 1'` ? If yes, is there a workaround or do I need to look for some other way of doing this? I am not very well versed in PHP and WP codes. I am not afraid of tinkering, but my knowledge is only basics :( Please bear with me. Thank you for your time.


How to change post format from Aside to Image for all posts?

I have a blog where all the posts had the post format **_Image_**. This morning I see that somehow they have all been changed to **_Aside_**. I'm still trying to figure out how this happened, but in the meantime, how do I go about changing them all back to Image? Is this something I can do with a SQL statement or do I need to write a custom script to loop through all the posts and save them with the Image post format? And if a SQL statement would work, any thoughts on what that might look like? Thanks much, Mark


Is there a way to import Blogger into bbPress?

I have a blog on Blogger that I would like to turn into a bbPress forum. This is a blog that has essentially been used as a forum, so bbPress is a better solution. Unfortunately, by default bbPress only seems to be able to import from phpBB and bbPress. I imported Blogger into WordPress as posts thinking I might be able to convert the posts to topics, with comments being the replies, but I can't seem to do that either. Is there any way to do this?


Redirect to 404.php from single.php

I have a situation where I want to redirect the user from single.php to my 404.php How can I do this? I did it like this inside single.php               header("HTTP/1.0 404 Not Found");     header("Location: ".bloginfo('template_url')."/404.php");     exit();      **But when I check the http responses I get a 302 response instead of the 404** **Important: it may not work because I have a post called "cars" which I use to custom generate pages like:**               http://www.mysite.com/cars/bwm     http://www.mysite.com/cars/crysler      The post is just:               http://www.mysite.com/cars/      The rest are just php query strings which were rewrited using add_rewrite_rule. So               http://www.mysite.com/cars/?bmw      is rewrited into:               http://www.mysite.com/cars/bmw      And sometimes the variable bmw is not inside my database, and I want this page to get a 404 response.


admin_print_styles incuding $_SERVER['DOCUMENT_ROOT']

All the Javascript isn't working in the admin area on my production server. Locally it works fine. I have narrowed it down to /wp-admin/wp-header.php line 72-78               do_action('admin_print_styles');      And all similar ones to these. The only difference on the production server is that I have set up a sym link:               ln -s /current/wp-content/plugins /shared/plugins      The symlink is working fine, I can access files by going to: httt://productionsite.co.uk/wp-content/plugins/pluginname/file.css However, when I view the console I get the following errors: "NetworkError: 404 Not Found - http://productionsite.co.uk/wp- content/plugins/var/www/vhosts/productionsite.co.uk/shared/plugins/wordpress- form-manager/css/style.css?ver=3.2.1" So it is trying to include the wrong file and seems to have something to do with the sym link. Any ideas are appreciated.


Custom Author Loop

Essentially what I'd like to do is have the same effect as the wp_list_authors tag, but instead of just listing the name or their post count, I want to be able to do a loop with the IDs. Ultimately I'd like have to a page with every author, with their name, description, avatar and link. I can figure out the specifics, I just need a way to do something like:               foreach $author as $author->ID      Thanks in advance, Pete


Working with post values in the admin panel

I have this basic admin page functions.php > `<?php include('ui.php'); ?>` ui.php               <?php     function gui()     {         include('gui.php');     }     function add_page()     {         $themename = 'Cesaro';         $page_function = 'gui';         add_menu_page( $themename." Options", $themename, 'edit_themes', $page_function, 'gui' );     }     add_action( 'admin_menu', 'add_page' );     ?>      gui.php               <form name="input" action="post_options_from_form.php" method="post">
             Firstname<input type="text" class="x-input"/>

             Lastname<input type="text" class="x-input"/>

             City<input type="text" class="x-input"/>
         <input type="submit" value="Update Options" class="x-button"/>     </form>      When i click update options,i get the error               The requested URL /wp-admin/post_options_from_form.php was not found on this server.      How do i make sure that post values end up my php i specified in the post action?.My post php file is `post_options_from_form.php`


File access different with permalinks on and off

I have a page with a link to a file in a password protected folder. When I have permalinks turned off, clicking on the link starts the file download. When I have permalinks turned on, clicking on the link takes me to Page Not Found, however, if I then go to the address bar and press `Enter` the file starts downloading. How can I make it so when permalinks are turned on, the file starts downloading on link click?


Fourth page of custom post type archive page does not exist

I recently developed a custom post type for my company's blog, so that we could have a separate press area. In the archive-presse.php page I make a query, thus :               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     //echo '
 paged :'. $paged . "
";     $press_articles = new WP_Query(         array(             'post_type' => 'presse', // Tell WordPress which post type we want             'paged' => $paged,             'orderby'   => 'post_date',             'posts_per_page' => '10'             )         );      and at the bottom, I create the navigation links :

<?php previous_posts_link('« Zurück',$press_articles->max_num_pages) ?>

<?php next_posts_link('Weiter »',$press_articles->max_num_pages) ?>

      (Austrian website, in case you were wondering) On the first page, this works fine; the posts appear and so does the navigation links, which points to the second page and so on. On the third page however, when I click on 'Weiter', I end up on the 404 page, although I am sure there are still articles to be shown. My only fix at the moment is to make sure that the posts per page is equal to a third of the total number of posts. Not much of a fix.


Make thumbnails in woocommerce replace the main image instead of opening fancybox

I would like the thumbnails underneath the main image on the single product page to replace the main image when they are either clicked or on hover, I prefer hover. Right now the thumbnails just open in their own fancybox. This is a very common feature on most big ecommerce sites and it's weird that it's not an option in woocommerce. Any help will be greatly appreciated.


Check if post is in draft or pending review?

Each of our posts are reviews for individual games and we occasionally have to 'pause' the game by changing it from published to pending review. The problem is if the page is indexed by search engines, anyone trying to visit the link will get a 404, which is obviously not desired. I'd like to instead redirect to a listing of all our games. I can think of a few options but I'm not sure which would be preferred. I could just do a temporary 302 redirect from that post to the game listing page. I'm not entirely sure how this will work for SEO however. I could also do a check to see if the post is pending review (in the 404 page?), and if it is, then display the game listing page. I'm not entirely sure how to go about this. I tried finding a function to check if it's in pending review but didn't have any luck.


Show newly added posts since last user login time /date

I'm looking for a solution to create a custom loop which will only display the last added/ modified posts since the last user login to the site. It shouldn't be that complicated doesnt it ?


Using default WP menu functionality to link to custom post-type listing?

I'm completely starting over with a wordpress project that began a couple of weeks ago, and basically i'm totally discovering wordpress, so please bare with me. I might be completely misunderstanding what has been coded until now, but I've been asked to generate a menu based on the "cutom-post-types" and their respective categories. When using the               <?php wp_nav_menu(); ?>      hook, I thought it would be enough. **BUT** : when editing the menu and it's content in the menu admin section it seems that I cannot have each category of a custom post-type to be listed UNDER each custom-post-type. All I can do is select each category, like so : Beauty Campaigns ... shops ... Wich leads to this on the public site : Beauty Campaigns ... Shops ... My only wisgh is to be able to avoid hacking wordpress as much as possible, while finally having : News Beauty Cmpaigns ... Trends shops ... in both the menu admin and the final public menu. What did I miss ? Thanks a lot.


How to remove administrator role in settings -> general -> New User Default Role?

I don't want to accidentally select Administrator role. So is there a way to remove it from `Settings -> General -> New User Default Role` ?


Shortcode to display the latest news article within a page

Could someone help me write a custom shortcode to simply display the latest post anywhere in Wordpress? I've seen a lot of ways how to do this in pure PHP in a custom page template, but if I try to convert it, I always get problems (double display) or completely nothing. It should be just one post (not page) of any kind at all, as long as it's the most recent one. I just need it like this:
Title

Excerpt...
     Read more      I've also looked for some plugins, but that's also problematic. They break all shortcode functionality or they just display a list... Can anyone help me out and score some points? I would surely appreciate it.


WP Multisite - multilanguage - swich to other language by click, but "same" content

I want to run a WP-multisite for 4 languages (in development), and did it so, 4 blogs, each one got the same content but in a different language, same structure, same pages, same postings, same images. No translation plugin, cause we need and want native translations for out contents. If we publish articles, so we have the articles in 4 languages and post it parallel on this 4 blogs. Is it possible to swich the whole site-content by click? Now we linked to the index of each blog. Thank you. (Sorry for my "great" english)


how to get next record from database when wordpress schedule hook runs?

favorite I am working on plugin which will work automatically via wordpress schedule hooks. But to do that I need a single record from database and process it and next schedule run, I want to get next single record from database to process. I am using custom table for my data, the table have a primary key with auto increment value. So how can I get next record every time when wordpress schedule hook runs ? I have tried with sessions/php pagination and Its working outside of wordpress but wordpress does not provide session support so I can't use it. I can use $wpdb global class for single record retrieval but I don't have a idea about next record retrieval. I hope I have explained my problem clearly. here is the function which will execute on wp schedule hook:               function ACP_poster($n){             global $wpdb,$api_key;             $row = $wpdb->get_results('SELECT a,b,c FROM tbname ORDER BY id DESC LIMIT 1',ARRAY_A);                  $url = 'https://example.com';                  $headers = array( 'Authorization' => $api_key );             $request = new WP_Http;             $result = $request->request( $url , array( 'method' => 'GET', 'headers' => $headers, 'sslverify' => false ) );             $data = new SimpleXMLElement($result['body']);             $attributes = $data->p->attributes();                  foreach ($data->p[0] as $p)                      {                     // Sanitize data.                     $pr = number_format((float)$p->pr, 2, '.', ' ');                     $image = '{'url2'}.'">{'url3'}                            .'" style="float: right"/>';                     $pd =  $image.$p->description .'-- ='.$p->currency.' '.                            ' ,Retail Price ='.$p->{'retail-price'}.' , '.                            $p->{'sale-price'}.'{'url2'}.                             '">...';                     $v = $c[$no]->child;                     $ids = get_term_by('slug', $v, 'category');//wordpress function                          $id = (int)$ids->term_taxonomy_id;                     $p2 = array('post_title'    => $p->name,                         'post_content'  => $pd,                         'post_status'   => 'publish',                         'post_author'   => 1,                         'post_category'  =>array($id));                     $pr = wp_insert_post( $p2, $wp_error );                          wp_reset_query();  // Restore global post data stomped by the_post().                     }                 }     }


Cannot get local avatars to show

_See updates below._ I upgraded to 3.7.1 using svn. I did this on my localhost first to make sure everything is fine. Everything was, so I proceeded to do it on the server. However, on the server, the users' avatars are not showing up and instead everyone is getting Gravatar's mystery man. Here is the code I have in my functions.php:               <?php switch ( $comment->comment_type ) :     case '' :     ?>     <p <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">     <div id="comment-<?php comment_ID(); ?>">     <?php echo get_avatar( $comment, 40 ); ?>      When I look at the source of the generated page on my localhost for the above I get the following code:               <img src="http://localhost/[path]/wp-content/uploads/avatars/[a number]/[imagename.jpg]"      On the server when I view source I get the following code for the same user:               <img src="http://gravatar.com/avatar/[alphanumeric]=http://[mywebsite.com]/wp-content/plugins/buddypress/bp-core/images/mystery-man.jpg[code]"      I must be making a mistake somewhere but for the life of me I cannot figure it out. The only explanation I can come up with is that Gravatar is not accepting requests from localhost and that is why it is working the way I would like it to on my localhost. So what do I have to do to make their local avatars show up (the ones they uploaded themselves)? I should also add that I am using the BuddyPress plugin (both on localhost and server). Aside from that, is there a technique people use to compare the files on the server with those on the development machine? Something akin to vimdiff? **UPDATE:** I copied the localhost directory recursively using `cp -r` to another directory. I then rsynced that directory with the remote server making it a mirror of the server. Then I ran `diff -NbBiwr /path/to/localhost /path/to/localhostCopyThatWasRsynced` and received no major differences save for stuff in the `.svn` directories. When I view the copied version in a browser the local avatars show up. This is really starting to make no sense at all. I also updated the sql database to reflect the one on the remote server and the local avatars show up on localhost but not on the remote server. **UPDATE 2:** Here are all the things I attempted since the last update:   1. Toggle `wp-debug` to true. No errors of note.   2. Removed the entire directory, did a new `svn co`.   3. Deactived all other plugins besides BuddyPress.   4. Used the default BuddyPress theme.   5. Installed version 3.6.1 (the last good version I used).   6. Checked and rechecked directory permissions.   7. I removed the avatars directory and when someone tries to upload an avatar it creates the avatars directory and the userid subdirectory but the image does not upload. The subdirectory remains blank. This is the error that is returned on the front end `Upload Failed! Error was: Unable to create directory wp-content/uploads/avatars/1407/avatars/1407. Is its parent directory writable by the server?` As you can see it duplicates the avatars directory and the userid subdirectory for some reason. This happens on both the server and localhost. Localhost is displaying avatars properly however.   8. Tinkered with birgire's suggestions below. Nothing.


Number of External Links in Comments - Moderation Option

I just ran over a problem to properly use the count of external (meaning no relative or absolute links to my own blog) links on my blog for the _Comment Moderation_ count Option. It's labeled _Hold a comment in the queue if it contains [your number here] or more links. (A common characteristic of comment spam is a large number of hyperlinks.)_ on Settings -> Discussion in the Wordpress Back-end. Screenshot: ![alt text](http://i.stack.imgur.com/cd9Ok.png) I'm aware that currently it counts all links inkl. links to the blog and other comments (reported it here: #14681) but I can't imagine that there isn't a plugin or hack already available that properly corrects the count to only external links. So my question is: Is there a plugin / hack that makes Wordpress properly count only the external links in comments for it's Moderation Options?


How would implement StackExchange 'Questions with similar titles' for the FAQ on my wordpress site

I want to have a FAQ page on my site which has a search box. As the user types in their question, a field below the search box is populated with FAQ answers with similar titles. The exact same functionality as the StackExchange 'Questions with similar titles' feature: > Questions with similar titles > > 4 Open Source Forum for wordpress similar to stackexchange or stackoverflow > (1) > > 0 How to implement a WordPress comments function? (2) etc...


Registering jQuery kills admin functions

I recently added the following into my theme's `functions.php`, in order to load jQuery from the CDN:               function my_init_method() {         wp_deregister_script('jquery');         wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js');     }          add_action('init', 'my_init_method');      However, this causes problems with the admin screens, notably the WYSIWYG editor which then refuses to allow HTML mode (via the tab). I get an error:               jQuery is not defined      from the wp-admin/load_scripts.php file. What am I doing wrong?


Is it possible to switch the data layer within WordPress?

WordPress is undoubtely very customizable using plugins, but every customization possibility surely has limits defined by the underlying architecture. For those familiar with WP architecture and source code: What would be the effort required to customize the data layer used by WP to use another data store (e.g. files (or another database system) instead of MySQL?). Is WordPress architecture layered in the sense of having the possibility to switch layers? The UI layer is apparently very easy to switch (any theme does this), but how about other layers, namely the data layer?


Custom per-page sidebar widgets .. possible?

Let's say I'm doing a site about cars, and in the main content area of a Page (using a certain template), there are a few paragraphs about a particular car. In the sidebar, are several standard widgets. But I also want a widget with an 'info panel' about the particular car. So what's the sanest way of putting in a per-page widget in Wordpress? I guess ideally the info-panel could be entered via the standard page editing in Wordpress .. perhaps via the Custom Fields, so you could enter "Volvo" for the Manufacturer field and it would show up in the sidebar. (or is this something a plug-in already covers?)


Main Menu Theme Different Output Print

I am currently developing a wordpress theme that has a tricky main navigation menu. The problem I am stuck with is that I am looking for a special print of the submenu. Here is the html I am trying to achieve in my theme:

Menu Item 1

Menu Item 2

Menu Item 3

Submenu Item 1.1

Submenu Item 1.2

Submenu Item 1.3

Submenu Item 2.1

Submenu Item 2.2

Submenu Item 2.3

Submenu Item 3.1

Submenu Item 3.2

Submenu Item 3.3

           What's the best approach to achieve that?


WooCommerce custom taxonomy as meta?

I have created two custom taxonomies: (slug) = language (slug) = location On the single product page I would like to display these two as meta below the "Categories" and "Tags." Example: ![screenshot](http://i.stack.imgur.com/ypZ76.jpg) I found that the meta is displayed by `/wp- content/plugins/woocommerce/templates/single-product/meta.php` I copied this files under my theme `/wp- content/themes/mytheme/woocommerce/single-product/meta.php` and added the following after the categories and tags, before the               <?php do_action( 'woocommerce_product_meta_end' ); ?>      It doesn't work because I think the "`echo $product->get_terms`" doesn't actually get the custom taxonomy.                    <?php         $size = sizeof( get_the_terms( $post->ID, 'language' ) );         echo $product->get_terms( ', ', '' . _n( 'Language:', 'Languages:', $size, 'woocommerce' ) . ' ', '.' );     ?>          <?php         $size = sizeof( get_the_terms( $post->ID, 'location' ) );         echo $product->get_terms( ', ', '' . _n( 'Location:', 'Locations:', $size, 'woocommerce' ) . ' ', '.' );     ?>      Is there a pre-made function to call a custom taxonomy, such as "get_taxonomyslug"? I tried but it didn't work. Or do I have to define them by myself? If someone could help with code or some pointers it would be great. Please include file location with each code snippet as I am still quite new to this and might not know where to put them.


Create custom template in plugin and display it into post template section?

Right now i am developing a plugin for one of my client according to their need. But I want the plugin hold all the functionality itself including the custom template. I mean my plugin holds the custom template but i don't know that if the template display on the admin post/page section. Is it possible to display custom template on admin post/page section through plugin? If yes then how? Your help is highly appreciated. ## UPDATE: I have achieved this with old method like create a separate custom template for my plugin so that admin can select the template for the desired plugin. I don't want to provide two separate files for my client, one for plugin and second for theme :(


How to detect that site is hosted on WPEngine?

Is there anyway to detect that WordPress is hosted on WPEngine? The reason why I need to know it in their approach to eliminate cookies. But my plugin relies on cookie and can't work without it. So I need to not run the plugin on WPEngine hosting. Any thoughts?


function wp_insert_post and wp update_post_meta

how combine wp_insert_post and wp update_post_meta? i need first insert post, then update post, let me know about example? i want sample for my future project Thanks


Importing Squarespace blog into Wordpress.org

I had a blog on Squarespace 6. I followed the instructions to Export the Squarespace journal into a `xml` file. I then followed the instructions to Import the `xml` file into WordPress.org as a movable type file. The Import appeared to complete correctly however, when I am looking at the WordPress.org dashboard, I cannot find anything that appears to be the imported text and photos from my Squarespace blog. Does anyone have any suggestions on how to find my Imported blog while I'm working in WordPress?


Add credit to get_custom_header in alt

Been hunting for a while and I can't figure out how to use `get_custom_header` to get the alt text associated with the media file, so that I can add photo credits to the headers on my site. Am I missing something? Code to add header image is:               <img src="<?php header_image(); ?>" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" alt="" />      The `get_custom_header` function doesn't seem to have a way to pull in the alt text.


I'm having a lot of trouble since upgrade to 3.0.1 with get_page_children() function

I use the get_page_children() function to create a sub_nav for a designer client I do work for. She uses the Spry Assets flyout JS that DreamWeaver creates, so I have to manually do the menus like this rather than use the new menus functionality in WordPress. I had them all set up and working perfectly, and then my client upgraded to 3.0.1 and somehow she says that broke them. I'm not sure if it happened then or if it was something else that caused the break. I've narrowed down the problem. The Codex says you need to get a list of all page objects to use for this function. You use a "query" function I've never seen before. http://codex.wordpress.org/Function_Reference/get_page_children               $my_wp_query = new WP_Query();     $all_wp_pages = $my_wp_query->query(array('post_type' => 'page'));      Those 2 lines should generate an array of all of your page objects that is usable by get_page_children() later. However, it's not working anymore because $all_wp_pages _ISN'T_ all of my pages. I have 38 pages on this site, and when I do an output of the $all_wp_pages array, I only get 10 pages. Anyone have any idea why that would be happening? The 10 pages that do show up all happen to be ONE page and its children. But they show up no matter what page you're on. It's really bizarre. Thanks!


How to display a shortcode caption somewhere other than the_content

I want to disable shortcode captions for posts in one of my themes, and display the content elsewhere, such as in a sidebar. The images aren't uploaded to wordpress, but they're linked-to using the post editor's add an image -> from URL functionality resulting in the following shortcode:               [caption id="" align="alignnone" width="300" caption="Leonard Nimoy has done far more thing than just play Mr. Spock"][/caption]      Any thoughts? I'm assuming using a filter on `img_caption_shortcode` somehow, but I don't know if that's the way to approach this.


Are captions stored anywhere?

In regards to my previous question about shortcode captions, it doesn't appear to me that the actual text of a caption is stored anywhere other than in the post content within the shortcode itself. I would have thought that `wp_get_attachment_metadata` would store the info for an attachment, but it doesn't. Am I wrong? Or does WordPress not store the actual caption anywhere?


How do I hide tags that have only been used once?

I'm looking to modify my theme so that only tags that have been used more than once show up on the site. Here's my logic, feel free to fault any (and all) of it:   1. There is no point in only using tags once. All the tag will do is link to a tag archive with one post.   2. However, I'd still like to tag my first post about unicorns with `unicorn`.   3. That way, when I post about unicorns for the second time, the tag will suddenly appear on both posts. I know a bit about WordPress and how it works, but not enough to do this. Should it be a plugin? Is there a function option/parameter/thing I've missed that does this? I seem to remember a database field that counts the number of times a tag is used, how does that help? Thanks!


show posts names and links in the sidebar list as categories child

i'm using this plugin to show an exapandable/collapsible widget-menu in my sidebar. http://wordpress.org/extend/plugins/folding-category-widget it works very well! the question, not directly connected with this plugin, is: how can i also show in the list, all posts related to a category (title + a href)? for example:               category A               post1              post2          category B              post3              post4          category C              post5      thanks a lot in advance.


Home page is redirecting to another page - no obvious reason

I added a page to my site, and suddenly the home page seems to be redirecting to that page (that is, if you go to jesseliberty.com, which should bring you to the home page, you are redirected to jesseliberty.com/newPage (the page I created). To combat this, I've added a 301 redirect from jesseliberty.com/foo to jesseliberty.com/2010 which shows all the posts from this year, but is not, by any means, the right thing, and will truly fail in January. Any ideas on what caused this or what I can do about it? There is nothing obvious in .htaccess


Form Submitting Error with get_template_part()

I have come across an interesting problem regarding the `get_template_part()` . I have created a theme options page (named sitewideSettings.php) normally I would include this in functions.php like so:               include(TEMPLATEPATH."sitewideSettings.php");      which works fine. But now I am trying to use `get_template_part();`               get_template_part('sitewideSettings');      which is also working fine except that when clicking 'update' to update the settings I get an error message: "Are you sure you want to do this? Please try again". "Please try again" links back to the theme options page and clicking update takes you back to the error message which takes you back to Theme options and round and round we go. Nothing else has changed other than the use of `get_template_part();` Anyone else come across this problem? How did you get around it? I am sure its something simple and obvious, but exactly what it is totally escapes me. (Its not a nonce issue as a nonce is created in both instances)


Admin config screen without menu

I want to create a sub config from some page on admin panel, eg: I've set config menu this way:               add_menu_page( 'E+', 'CRE+', 8, 'cr_e_plus_user_config', 'cr_e_plus_user_config');     add_submenu_page( 'cr_e_plus_user_config', 'E+', 'Configurations', 8, 'cr_e_plus_user_config', 'cr_e_plus_user_config');      From `Configurations` page, I need to load another page when I click certain link. Now, I don't want this new page to be listed on menu, because it will need certain parameter before I can show it.


SHORTINIT and sessions

Is it possible to use SHORTINIT for AJAX called php file and use a Wordpress shared $_SESSION global in it? I have this thus far:               ini_set('html_errors', 0);     define('SHORTINIT', true);          require 'wp-load.php';          $_SESSION...      ...and it really made that file load in a snap, but with SHORTINIT i can't seem to retrieve that file's $_SESSION variables in Wordpress. Commenting it out enables session sharing.


Using a custom field inside a shortocde

Im trying to use a custom field inside a shortocde for a nextgen gallery slider on a page. The goal is to change the gallery id by entering in the corresponding id on page creation with a custom field. This doesn't seem to be working how I have it setup though and is just calling all images which makes me thing no value for the gallery id is being called.               <?php       global $image_gallery;        $image_gallery = get_post_meta($post->ID, 'image_gallery', TRUE);      ?>     <?php echo do_shortcode('[jj-ngg-image-list html_id="about-image-list" gallery="return $image_gallery" max_pictures="4" width="160" height="150" orientation="horizontal"]'); ?>     <?php ?>


Changed permalink structure of CPT - should I redirect?

Following this answer, I recently changed the permalink structure of a custom post type called 'Literature' to include the taxonomy term: Old structure: `mysite.com/literature/books/post_name` New structure: `mysite.com/literature/fiction/post_name` However, when visiting the original permalink, Wordpress doesn't automatically redirect it and both pages are appearing as separate entries in Google search. Should I redirect the old literature permalinks? If so, what's the best way to do this? ## UPDATE Thanks Brian, I've amended your code as below and this is working as desired:               add_action('parse_request', 'redirect_books_to_fiction', 0);     function  redirect_books_to_fiction(){         global $wp;         if(preg_match('/literature\/books/', $wp->request)){             $redirect = get_bloginfo('siteurl').'/'.str_replace('books', get_the_term_list( $ID, 'literature_category', '', ' / ', '' ), $wp->request);             wp_redirect($redirect, 301);             exit;         }     }      However, how can I redirect **_everything_** and not just 'books'? On my literature permalinks I can type any word into the trail and it doesn't redirect. e.g. `mysite.com/literature/any_random_word/post_name` Just stays as that permalink. Whereas, if I visit other pages on my site and change any of the trail leading up to a post, it automatically redirects to the correct permalink. e.g. If I change: `mysite.com/food/recipes/post_name` to: `mysite.com/a_random_word/another_random_word/post_name` It redirects to the correct permalink. I assume this is because of the custom permalink structure I used in this answer Here is the site.


Show tags in post? Function not working

I'm using the first example from here: http://codex.wordpress.org/Function_Reference/get_the_tags but nothing is showing up. There's nothing about get_the_tags in my function.php... nor do I know what to put there (sorry, amateur to wordpress) Just trying to show the tags associated with the post. Could anyone help?


Add image URL automatically to custom field?

Does anyone know how I automatically add the URL of the uploaded image to a custom field? In other words, When I upload a image I want the url to the image to get a custom field variable automatically so I dont have to add the URL manually to the custom field all the time. I need a seamless integration to make is user-friendly. I want to use scripts like timthumb instead of the built in WP functionality. **-----UPDATE:** Here is some code I have. Just missing the thumbnail variable in the custom value field.               add_action('wp_insert_post', 'mk_set_default_custom_fields');          function mk_set_default_custom_fields($post_id)     {         if ( $_GET['post_type'] != 'post' ) {                  add_post_meta($post_id, 'Image', 'I WANT THE THUMBNAIL HERE', true);              }              return true;     }


Programming Wordpress to send a custom-built form to specified email address

I have built a custom html/javascript form that I would like to incorporate into my blog. I would like the submit button of the form to send the information to a specific email address. Is there a way I can add that into the html of the form, or is it going to require an outside php file? And if an outside file is needed, please let me know what I need to do. I have little experience with php, so very clear, basic answers would be much appreciated.


What is zinging my HTML commands? I don't think I can blame TinyMCE this time...

I'm creating some pretty involved websites where I insert the contents of a wordpress 'page' directly into a page display element. (example would be a custom entry in the footer...) Its absolutely essential that we can use html code within our pages without errors. This enables our admins to make minor upgrades without having to recode a template. Generally they add or edit links or images on the site, nothing more fancy than that. Unfortunately I'm having lots of issues with content being mangled upon delivery. (inspected in firebug or chrome dev tools.) Not sure what is going on. I'm very well aware of the TinyMCE Advanced Plugin from Andrew Ozz. Got that puppy plugged in and I'm using the HTML button as well as the setup checked for "Stop removing the `<p>` and `<br/>` tags when saving and show them in the html editor" The system still generates the `<p>` tags, but at least I can see where they are. I'm also familiar with https://codex.wordpress.org/TinyMCE#Customize_TinyMCE_with_Filters At first four glances it would appear that any customization mods done via the codex would interfere with the Ozz TinyMCE Advanced Plugin, so I've shut any custom work there. I've also verified that the theme I'm using isn't doing the mangling. In fact when I check what's stored in the page, it looks clean there. What's not clean is the output on the web page. Here is a simple example, a html comment symbol. The sample is `<!--` hide this link `\-->`. The html view button shows EXACTLY this code. When you go to the web page and look at the generated code you get `<!--` and `–>` The `\-->` is converted to garbage. Same thing happens to a lot of my characters, single quotes get changed to `‘` and `&#8217`, double quotes to `“` and `&#8221` Anybody know what is going on? Is this an ascii vs UTF issue? Is this a database setup error, perhaps using the wrong character storage type? I just checked the database and phpMyAdmin tells me that the "Server Connection Collation" is "utf8_general_ci". Is this correct? Ouch.. I just checked the data within the database, and the errors are not apparent there. `\-->` looks just like `\-->`. Many thanks for any insight you guys might provide.. Zip.


Not redirecting upon front-end post submission

I have been trying this code to submit front-end post: http://pastebin.com/B8LGhsGA It is not redirecting upon clicking the submit button the form works fine but its not redirecting. When the post is submitted it loads the same page again.


Convert attachment ID into url?

I'm using the plugin advanced custom fields to create custom fields to create a relationship between two pages. The code below is looking at the relationship field and grabbing the page title and company logo of the linked page. The only problem is that instead of outputting the image url (so it displays the image), it's outputting the attachment ID. How can I convert the attachment ID into a url so the image displays?                       <?php foreach(get_field('connections') as $relationship): ?>                 <img src="<?php echo get_post_meta($relationship->ID, 'company_logo', true ); ?>" height="57" width="250" />                         <a href="<?php echo get_permalink($relationship->ID); ?>"><?php echo get_the_title($relationship->ID) ?>
             <?php endforeach; ?>


Can I stop images linking to themselves?

I have images on my website which I do not really want stolen, I have a no right click plugin which will help, and I would like to stop people clicking on the image to display it on it's own in a browser window. I understand that anyone can access the source code and find the URL, I just want to make it a little more difficult. How can I remove links from images, and just have the embedded image?


Increasing the the file upload size

I put these inside wp-admin/php.ini               upload_max_filesize = 75M     post_max_size = 75M     max_execution_time = 300      Still not working, please advice if i am doing the right way or not?


Adding widgets to header and footer from plugin

i created 4 header and 4 footer widgets using a site spesific plugin, the reason been that when i change themes, i keep all of my widgets. i created two files, one for the header widgets and one for the footer widgets. what i need to do now is to add these to the header and footer files. at this stage i'm putting the following code manually in my header at the bottom after my header closing tag:               <? if ( is_front_page() ) : ?>               <?php   get_sidebar( 'homepage' );  ?>             <?php endif ; ?>`      and the following code in my footer at the top:               <?php get_sidebar( 'footer1' ); ?>      How can i insert these codes automatically into my header and footer files from my plugin. many thanks


How to use Wordpress multisite with mixed HTTP and HTTPS sites?

I have a multi-wordpress installation (3.x) with 5 sites and only one of them is using SSL. All of these are running on their own domain, and the http://ssldomain.com forwards to https://ssldomain.com. Still, this seems to break wordpress upgrades. Now I get a message: Upgrade Network https://nonsecureddomain.com Warning! Problem updating https://nonsecureddomain.com. Your server may not be able to connect to sites running on it. Error message: SSL: no alternative certificate subject name matches target host name 'nonsecureddomain.com' It seems that at some point WP decides to go HTTPS for this domain, where it is not supposed to. The network itself is the one running on HTTPS(SSL), and what concerns me is that https://mydecureddomain.com/wp-admin/network/site-info.php?id=5 Is listing the site with a hardcoded HTTPS prefix which seems to to be configurable? ![enter image description here](http://i.stack.imgur.com/mvVdd.png)


Related posts by category not working right

I have somehow managed to create this code to display Related Posts by category on single post page.

You might also like
           <?php             $orig_post = $post;             global $post;              $categories = get_the_category($post->ID);                  if ($categories) {                    $category_ids = array();               foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;                    $args=array(                 'category__in' => $category_ids,                 'post__not_in' => array($post->ID),                 'showposts'=> 4, // Number of related posts that will be shown.                 'caller_get_posts'=>1);                    $my_query = new wp_query( $args );               while( $my_query->have_posts() ) {                $my_query->the_post();           ?>
                   <a rel="external" href="<?php the_permalink(); ?>" alt="<?php the_title(); ?>" title ="<?php the_title(); ?>" ><?php the_post_thumbnail(); ?>
<?php the_title(); ?>
                <?php } // ending while loop            }          $post = $orig_post;     wp_reset_query();     ?>
      Problem is, this code doesn't displays related posts of the same category as on single post page. Even includes the same post displayed on single post page and also shows some recent posts. You can test yourself. Please suggest how can I resolve this or am I missing some thing in this code? Thanks


Wordpress json api taxonomy index method

In edition to this post below: wordpress json custom taxonomy problem How to write a method for getting categories withing a custom taxonomy, similar to Method: get_category_index in core json api controller? Scenario: I have a taxonomy called - books which has four categories and i need those categories to be outputted through get_taxonomy_index. Something like this http://example.com//api/get_taxonomy_index/?dev=1


how to create theme based widget that can be drop in sider bar or footer

I am developing a installable theme in wordpress I have created a contact form and called that form in footer but I want to create a widget that should be theme based mean i dont want any plugin.I can create a widget but for this i need to put the file in plugin folder that I don't want that should be completely theme based . I want this because if I want to change the position of contact form like from footer to sidebar so for this I need to make this contact form widget that can be drag and drop in footer and sidebar. I have searched this also on Internet but all are based on plugin directory so that Its not my requirement because it will activate whenever plugin will be activate but I need widget should activate whenever theme will be activate Please provide me help or your suggestion I shall be very thankful to you Thanks


Adding a Javascript slideshow to the home page

I'm trying to add a Javascript slide show to my WordPress home page. In my theme folder I have a js folder and then in that I have `jquery.cross- slide.min.js` and `jquery.min.js`. This is what I have and what I'm pasting into my post area:               <script type="text/javascript" src="js/jquery.min.js"></script>     <script type="text/javascript" src="js/jquery.cross-slide.min.js"></script>          <script type="text/javascript">     function() {     crossSlide({     sleep: 3,     fade: 1     }, [     { src: 'images/slideshows/block1.jpg' },     { src: 'images/slideshows/block2.jpg' },     { src: 'images/slideshows/block3.jpg' }     ])     });     </script>      If I paste this into a WordPress page throught the HTML editor it doesn't work. Please could you check for errors and advice.


move blog posts from one wordpress to another

I have a blog in the subdirectory. Last year I installed a new blog in the root basically about the same thing. I like to be able to transfer all my old posts from the blog in the sub directory to the root so I can close down the sub one what is the best way to do this?


Custom post type not saving

I've recently created a custom post type, however each time an update is saved the contents of the meta field disappears after a few minutes. Is this a bug?               <?php          //      CUSTOM POST TYPE 1     add_action('init', 'ootb_tenant_register');          function ootb_tenant_register() {         $args = array(             'label' => __('Tenant'),             'singular_label' => __('Tenant'),             'public' => true,             'show_ui' => true,             'capability_type' => 'post',             'hierarchical' => false,             'rewrite' => true,             'supports' => array('title', 'editor', 'thumbnail')         );              register_taxonomy("business", array("tenant"), array(             "hierarchical" => true,              "label" => "Business Type",              "singular_label" => "Business",              "rewrite" => true)         );              register_post_type( 'tenant' , $args );     }               add_action("ootb_admin_init", "ootb_admin_init");     add_action('wp_insert_post_data', 'ootb_save_tenant_options');          function ootb_admin_init(){         add_meta_box("gallerymeta", "Tenant Directory Data", "ootb_tenant_meta_options", "tenant", "normal", "low");     }          function ootb_tenant_meta_options(){         global $post;         $custom = get_post_custom($post->ID);         $location = $custom["location"][0];         $shortdesc = $custom["shortdesc"][0];         $website = $custom["website"][0];         $email = $custom["email"][0];         $twitter = $custom["twitter"][0];         $facebook = $custom["facebook"][0];         $smallpictureurl = $custom["smallpictureurl"][0];         $contactname = $custom["contactname"][0];         $landlinephone = $custom["landlinephone"][0];         $mobilephone = $custom["mobilephone"][0];         $largepictureurl = $custom["largepictureurl"][0];         $picturealttag = $custom["picturealttag"][0];     ?>

                 Location :             <select name="location" style="width: 200px;">                 <option <?php if($location == "Please select...") echo "selected"; ?> value="Please select...">Please select...</option>                 <option <?php if($location == "Out of the Blue Drill Hall") echo "selected"; ?> value="Out of the Blue Drill Hall">Out of the Blue Drill Hall</option>                 <option <?php if($location == "Portobello Powerhouse") echo "selected"; ?> value="Portobello Powerhouse">Portobello Powerhouse</option>             </select>
Location of Business

             Short Description :             <textarea name="shortdesc"><?php echo $shortdesc; ?></textarea>
Short description of the business which will appear on the directory homepage.

             Website Address :             <input name="website" value="<?php echo $website; ?>" />
Website address including http://www.

             E-mail Address :             <input name="email" value="<?php echo $email; ?>" />
Business contact address.

             Twitter URL :             <input name="twitter" value="<?php echo $twitter; ?>" />
Twitter URL including http://www.

             Facebook URL :             <input name="facebook" value="<?php echo $facebook; ?>" />
Facebook URL including http://www.

             Small Picture URL :             <input name="smallpictureurl" value="<?php echo $smallpictureurl; ?>" />
250 x 250 Picture URL

             Large Picture URL :             <input name="largepictureurl" value="<?php echo $largepictureurl; ?>" />
500 x 500 Picture URL

             Picture Alt Tag :             <input name="picturealttag" value="<?php echo $picturealttag; ?>" />
Alt tag for both images.

             Business contact name :             <input name="contactname" value="<?php echo $contactname; ?>" />
Business contact name.

             Landline Telephone Number :             <input name="landlinephone" value="<?php echo $landlinephone; ?>" />
Landline telephone number.

             Mobile Telephone Number :             <input name="mobilephone" value="<?php echo $mobilephone; ?>" />
Mobile telephone number.

          <?php     }          function ootb_save_tenant_options( $post_id ) {         global $post;            //skip auto save         if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {             return $post_id;         }         //check for you post type only         if( $post->post_type == "tenant" ) {                 if( isset($_POST['location']) ) { update_post_meta( $post->ID, 'location', $_POST['location'] );}                 if( isset($_POST['shortdesc']) ) { update_post_meta( $post->ID, 'shortdesc', $_POST['shortdesc'] );}                 if( isset($_POST['website']) ) { update_post_meta( $post->ID, 'website', $_POST['website'] );}                 if( isset($_POST['email']) ) { update_post_meta( $post->ID, 'email', $_POST['email'] );}                 if( isset($_POST['twitter']) ) { update_post_meta( $post->ID, 'twitter', $_POST['twitter'] );}                 if( isset($_POST['facebook']) ) { update_post_meta( $post->ID, 'facebook', $_POST['facebook'] );}                 if( isset($_POST['contactname']) ) { update_post_meta( $post->ID, 'contactname', $_POST['contactname'] );}                 if( isset($_POST['smallpictureurl']) ) { update_post_meta( $post->ID, 'smallpictureurl', $_POST['smallpictureurl'] );}                 if( isset($_POST['landlinephone']) ) { update_post_meta( $post->ID, 'landlinephone', $_POST['landlinephone'] );}                 if( isset($_POST['mobilephone']) ) { update_post_meta( $post->ID, 'mobilephone', $_POST['mobilephone'] );}                 if( isset($_POST['largepictureurl']) ) { update_post_meta( $post->ID, 'largepictureurl', $_POST['largepictureurl'] );}                 if( isset($_POST['picturealttag']) ) { update_post_meta( $post->ID, 'picturealttag', $_POST['picturealttag'] );}         }     }          ?>


Is there a way to use the Wordpress users but without loading the entire Wordpress core?

I have a Wordpress site and a web application that can be used only by the registered (Wordpress) users. Now I'm loading `wp-blog-header.php` to check if the user is logged in. Everything is working fine but because on every request (including AJAX) I have to load the Wordpress core also, it slows down my application visibly (more than 70% from the total loading time). Is there any simple way to use the Wordpress users but without loading the entire Wordpress core? Update: I need to know which user is logged in and also security is important. Thank you!


rename attachments based on parent-post-title on upload

I know there a some functions already avaible here for this task, but none of them seem to work as needed. The best way seems to me adding a filter to **wp_handle_upload_prefilter** like kaiser does in this example. Unfortunately the file only gets the parent- post-title if the post is already saved to the database. * * * Another approach is to add a function to **add_attachment** like Ijaas does here. Then the file gets the parent-post-title as name, but no thumbnails are created. And my attempt in using wp_generate_attachment_metadata(); to create the missing image sizes, ended in an endless loop (propably cause I'm using it the wrong way, but now I'm a bit scared by this function). * * * Would be great if there was a way to pass the title to **wp_handle_upload_prefilter** even if the post isn't saved yet. Oh by the way, this is my endless function, maybe somebody can tell me what's wrong with it. **DON'T USE THIS FUNCTION !!!**               add_action('add_attachment', 'fkp_rename_attacment');     function fkp_rename_attacment($post_ID){            $post = get_post($post_ID);       $file = get_attached_file($post_ID);       $path = pathinfo($file);       $parent = get_post($post->post_parent);       $p_author = get_the_author_meta( 'display_name', $parent->post_author );       $p_author_san = sanitize_title($p_author);            $newfilename = $parent->post_name . '-' . $p_author_san . '-' . $post_ID;       $newfile = $path['dirname']."/".$newfilename.".".$path['extension'];            rename($file, $newfile);                $wp_filetype = wp_check_filetype(basename($newfile), null );       $wp_upload_dir = wp_upload_dir();       $attachment = array(         'guid' => $wp_upload_dir['url'] . '/' . basename( $newfile ),          'post_mime_type' => $wp_filetype['type'],         'post_title' => preg_replace('/\.[^.]+$/', '', basename($newfile)),         'post_content' => '',         'post_status' => 'inherit'        );       $attach_id = wp_insert_attachment( $attachment, $newfile, $parent->ID );       require_once(ABSPATH . 'wp-admin/includes/image.php');       $attach_data = wp_generate_attachment_metadata( $attach_id, $newfile );       wp_update_attachment_metadata( $attach_id, $attach_data );     }      **DON'T USE THIS FUNCTION !!!**


How to reorder categories for Custom Post Type

Is there a plugin available that will allow the drag and drop reordering of categories for a custom post type? Or suggestions on how to achieve reordering categories?


Extract 1st word of blogname/insert in middle of new string

Wordpress Website Name (say) = "German Philosophy Politics & Economics" I want to return "My German Site" I have tried the following :               <?php     $myvalue = bloginfo('name');     $arr = explode(' ',trim($myvalue));     $var = $arr[0];     echo "My ".$var." Site";     ?>      but it returns "German My Site" not "My German Site" Any ideas ?


Emailing only the users of a MultiSites Sub-Sites

Context: Creating a MultiSite in which each Sub-Site will have it's own set of users that they belong to. These users are only able to view their own site. I was wondering what the easiest way to mass-email the users of each Sub-Site would be? For instance, when a new News post is put in the blog, it will send a notification to the members of that Sub-Site, but noone else. I have found Plug-ins that would mass-email the whole network, but it seems to be hard to find one that can separate from the network and the Sub-Sites. It would be the admins/owners of the Sub-Sites that will be sending the email, not the Super- admin.


Listing only custom post types with two required categories?

I use the following custom loop to display a custom post type with the custom taxonomy:               <?php // Create and run custom loop         $custom_posts = new WP_Query();         $custom_posts->query('post_type=page_content&page_sections=Apps');         while ($custom_posts->have_posts()) : $custom_posts->the_post();     ?>
             <?php the_post_thumbnail('large'); ?>
     <?php endwhile; ?>      Right now it reads: retrieve ONLY posts with the **page_content** custom post type and the **App** custom taxonomy. Is it possible to make it read: retrieve ONLY posts with the **page_content** custom post type, the **Front Page** custom taxonomy, and the **Apps** custom taxonomy? **EDIT:** This didn't work:               <?php // Create and run custom loop             $custom_posts = new WP_Query();             $custom_posts->query('post_type=page_content&page_sections=Front Page, Apps');             while ($custom_posts->have_posts()) : $custom_posts->the_post();         ?>
                 <?php the_post_thumbnail('large'); ?>
         <?php endwhile; ?>


WooCommerce Tabs

In my theme, I have the _WooCommerce_ plugin installed and would like to rename the " _Catalog_ " tab, located under the _WooCommerce_ > _Settings_ submenu page. Am I able to do this from my `functions.php` file so that I'm not directly modifying the plugin itself and if so, how? ![enter image description here](http://i.stack.imgur.com/A2W3I.png) Thanks.


Is it possible to block subscriber users to changing its password?

I want to disable changing password option for all my subscriber users. Is it possible by doing any code tweak or something using any plugin? ![Disable password changing option for subscriber users](http://i.stack.imgur.com/Q3Des.jpg) If someone has any idea or plugin knowledge to do this then appreciated.


Media library to list images only user uploaded

I want to list images for only user uploaded image. Here is the scenario:   1. Using the image uploader on front end using iframe.   2. I have added `upload_files` cap to subscriber level users and want them to see only images they uploaded.   3. I've found this Q Restricting Users to View Only Media Library Items They Have Uploaded? but the accepted answer not working for me.              // Code originally by @t31os     add_action('pre_get_posts','users_own_attachments');          function users_own_attachments( $wp_query_obj )      {         global $current_user, $pagenow;              if( !is_a( $current_user, 'WP_User') )             return;              if( 'upload.php' != $pagenow )             return;              if( !current_user_can('delete_pages') )             $wp_query_obj->set('author', $current_user->id );              return;     }        4. The frontend page i am using the image uploader is named "Entry".   5. If i remove this part of the code `if( 'upload.php' != $pagenow ) return;` the code works. I i think i have to improve that part of the conditional code but could not figure it out. The conditional is important because i don't want the code to apply on other pages where it not required. So, i need help to improve the conditional part as i mentioned. Thanks!