title: how to display full post with pagination on home page

text:
I am using the 'Hatch' theme. I'm familiar with HTML/CSS but not with WordPress, first time working with this.   I have my homepage showing recent posts and that's good. However, I want to make a new page called 'Blog' where I can show all my full posts, with pagination as well. I thought I might have to create a template? Or, I tried making a category 'blog', but I don’t know how to change the display of that particular category. I read similar questions, to my understanding I gotta get a loop happening, but I don’t know where. my site is LizettePhotography.com ### home.php code:               <?php     /**      * Home Template      *      * A custom home page template.      *      * @package Hatch      * @subpackage Template      */          get_header(); // Loads the header.php template. ?>              <?php do_atomic( 'before_masthead' ); // hatch_before_masthead ?>
                  <?php do_atomic( 'open_masthead' ); // hatch_open_masthead ?>                  <?php $hatch_author_bio = hybrid_get_setting( 'hatch_author_bio' ) ? hybrid_get_setting( 'hatch_author_bio' ) : '1'; ?>
<?php the_author_meta( 'description', $hatch_author_bio ); ?>

                      <?php // Check to see if the header image has been removed                 $header_image = get_header_image();                      if ( ! empty( $header_image ) ) : ?>                          <img src="<?php header_image(); ?>" alt="" />                      <?php endif; // end check for removed header image ?>
                  <?php do_atomic( 'close_masthead' ); // hatch_close_masthead ?>
              <?php do_atomic( 'before_content' ); // hatch_before_content ?>
                  <?php do_atomic( 'open_content' ); // hatch_open_content ?>
                      <?php if ( have_posts() ) : ?>                          <?php $counter = 1; ?>                          <?php while ( have_posts() ) : the_post(); ?>                                  <?php do_atomic( 'before_entry' ); // hatch_before_entry ?>                                  <?php if ( ( $counter % 4 ) == 0 ) { ?>                                      <div id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?> last">                                  <?php } else { ?>                                      <div id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>">                                  <?php } ?>                                                                                <?php do_atomic( 'open_entry' ); // hatch_open_entry ?>                                          <?php if ( current_theme_supports( 'get-the-image' ) ) {                                              get_the_image( array( 'meta_key' => 'Thumbnail', 'size' => 'archive-thumbnail', 'image_class' => 'featured', 'width' => 220, 'height' => 150, 'default_image' => get_template_directory_uri() . '/images/archive_image_placeholder.png' ) );                                          } ?>                                                              <?php echo apply_atomic_shortcode( 'entry_title', '[entry-title]' ); ?>                                                               <?php do_atomic( 'close_entry' ); // hatch_close_entry ?>
                                  <?php do_atomic( 'after_entry' ); // hatch_after_entry ?>                              <?php $counter++; ?>                          <?php endwhile; ?>                      <?php else : ?>                          <?php get_template_part( 'loop-error' ); // Loads the loop-error.php template. ?>                      <?php endif; ?>
                  <?php do_atomic( 'close_content' ); // hatch_close_content ?>                  <?php get_template_part( 'loop-nav' ); // Loads the loop-nav.php template. ?>
              <?php do_atomic( 'after_content' ); // hatch_after_content ?>          <?php get_footer(); // Loads the footer.php template. ?>


title: Tag system like Quora?

text: What would be the best way to go for creating a tag-system similar to the one on quora.com? If you don't know what quora looks like, here is what I'm thinking about: On the tag archive page the user can add or edit a description of the tag and tie a photo to the tag. The tag also have a manage page on the frontend were it's possible to delete the tag or merge it with another one if it's a duplicate. All of this is made from the frontend. How hard would it be to achieve this? How would one do?


title: problem with nextgen plugin

text: I have a problem with Nextgen gallery,after activating some plugins it doesn't show the submit buttons(insert, cancel). Then i have deactivated all plugins, but that doesn't help. I haven't any experience with wordpress, so any suggestions would be very useful. Thanks much


title: Wordpress Post Grid

text:
I am trying to make a custom grid for my Wordpress posts. I have been searching the web however all the tutorials I have found utilize a column method where it just alternates between the columns. For what I am doing that would be impossible I need it to actually count off six thumbnails and then return a line and do it again. Does anyone know of a good tutorial/example of this(It can't be a plugin.)? All answers much appreciated. The code below is what I have so war without it wrapping the lines. ![enter image description here](http://i.stack.imgur.com/CgWv9.png)                $categories =  get_categories('child_of=2');       foreach  ($categories as $category) {                       //Display the sub category information using $category values like $category->cat_name             echo '
'.$category->name.'
';                  foreach (get_posts('cat='.$category->term_id) as $post) {                           echo '
';                      setup_postdata( $post );                 $custom = get_field('face');       echo wp_get_attachment_image($custom);            echo '
';      $custom = get_field('fullname');       echo $custom;       echo '
';       echo '
';      REVISED TO POST BELLOW: ![enter image description here](http://i.stack.imgur.com/cyByx.png)


title: Feature Differences between WordPress.com and Hosting on your Own Server?

text: I created a new blog using WordPress.com and obviously it got hosted on their server. But what I notice is that few features are not visible in this version as compared to the WordPress PHP script that I downloaded and hosted on my server. For example: the Plugins options is not visible anywhere from where I can upload any plugin. Is the online version a degraded editon of the original WordPress script?


title: Wordpress not opening posts with only numbers if permalink is post_name

text: Someone knows why this happens? For instance, I have a post called `1987`, but it does not open it when I click on the link. When I use a different permalink structure, it opens it. Why is this and how can I solve this? FYI: **I don't get a** `404 error`, I just get a Firefox error where it says: **this page is not redirecting it well**


title: Wordpress Sidebar menu for posts based on date - guidance needed

text: One of the issues I have with WordPress is knowing when (and when it is possible) to use the WordPress back end instead of coding my own solution from scratch. This question is based around this. I'm attempting to set up the blog page for the site I'm working on. Most of the site is static pages, with the posts ideally being collected on a news page. I have the news page displaying the posts through the traditional set up (selecting the static front page, and selecting a page to be the blog page through the WordPress dashboard). With that done, I want to create a sidebar for the blog post (and all posts) that displays a list of years and months. Example sidebar: August 2014 July 2014 June 2014 ... October 2013 This seems like something that would be built into WordPress, but I can't seem to find any information on it. So I ask you all, is this a built in function? If so, could you direct me towards a good starting point? If it is not, how would you suggest developing links to posts based off of a time stamp? Apologies again for the low level question. I know just enough to get my hands dirty here, but I have a ways to go on the learning curve.


title: Ways to handle SVG rendering in wordpress?

text: With the advancement of internet browsers, I find myself more and more comfortable using SVGS when coding websites... especially for icons, and simple graphics that can be replaced on the fly by pngs. It looks like wordpress almost supports SVGS. I say almost because:   1. It's not by default an allowed file type in wordpress. So you need to add that before uploading SVGs   2. You can't see a SVG thumbnail in the Media gallery. (see image below)   3. Sometimes when you add it to the editor (via add media button) the editor doesn't know the svg size, so although it adds the svg as an image it has a width and height of zero.   4. When you click in "edit image" from within the media upload popup you get a message saying "image does not exist". See image below. I am fine with item 1 in this list, but has anyone figure out how a fix item 2 3, and 4? ![enter image description here](http://i.stack.imgur.com/rKVAE.png) ![enter image description here](http://i.stack.imgur.com/V6Mvy.png) **Update about item 1:** To allow a new mime type (such as SVG) you can just add a hook in functions.php               function allow_new_mime_type($mimes) {              $mimes['svg'] = 'image/svg+xml';              return $mimes;     }     add_filter( 'mime_types', 'allow_new_mime_type' );      Now you should be able to upload SVGs. You can find further information in this tutorial. This only solves item 1, which as I mentioned before, it's not an issue for me (although I think it should be a allowed by default). **Update about item 2:** I did some digging and tracked down the function that decides whether an attachment is an image or not. It seems that it all comes down to this function in wp-includes/post.php               /**      * Check if the attachment is an image.      *      * @since 2.1.0      *      * @param int $post_id Attachment ID      * @return bool      */     function wp_attachment_is_image( $post_id = 0 ) {         $post_id = (int) $post_id;         if ( !$post = get_post( $post_id ) )             return false;              if ( !$file = get_attached_file( $post->ID ) )             return false;              $ext = preg_match('/\.([^.]+)$/', $file, $matches) ? strtolower($matches[1]) : false;              $image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' );              if ( 'image/' == substr($post->post_mime_type, 0, 6) || $ext && 'import' == $post->post_mime_type && in_array($ext, $image_exts) )             return true;         return false;     }      As you can see there's an array of valid image extensions defined in this function. I don't see any filters that could be used to modified that array. But that's a start... I am not sure why the last if statement returns false for svgs though. Even if I don't add the svg extension to the array $image_exts, the first condition should return true, shouldn't it?               if ( 'image/' == substr($post->post_mime_type, 0, 6)      That checks if 'image/' is enqual to the first six character in the mime type, which for svg is image/svg+xml (first six is "image/"). **UPDATE** Upon further investigation, it seems that the problem is not with wp_attachment_is_image at all, but because the image size (width and height) are not being added to the attachment metadata when the SVG is uploaded. That's because the function to calculate the image used is the php function getimagesize(), which does not return an image size for SVG. I found an answer on stackoverflow about the getimagesize function and about how svgs behave. See it here.


title: get_item_quantity() Error When Fetching Feed

text:
I'm using this script in two places on the same page to output some RSS feeds:               <?php         include_once(ABSPATH . WPINC . '/feed.php');         $rss = fetch_feed('https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=BarackObama');         $maxitems = $rss->get_item_quantity(3);         $rss_items = $rss->get_items(0, $maxitems);     ?>     <?php if ($maxitems == 0) echo '
No activity to display.
'; ?>
     <?php         if (!$maxitems == 0)         foreach ( $rss_items as $item ) : ?>
                 <a href="<?php echo $item->get_permalink(); ?>">                     <?php echo $item->get_title(); ?>                     <time datetime="<?php echo $item->get_local_date('%Y-%m-%d %H:%M'); ?>" class="timestamp">                         <?php echo $item->get_local_date('%A %d %b %H:%M'); ?>                     </time>
         <?php endforeach; ?>
      I'm manually setting the cache lifetime in my `functions.php` to two hours:               function filter_handler( $seconds ) {         return 7200;     }     add_filter( 'wp_feed_cache_transient_lifetime', 'filter_handler' );      A few times a day, the feed breaks and displays this error instead: `Fatal error: Call to undefined method WP_Error::get_item_quantity() in /public_html/wp-content/themes/twentyeleven/home-page.php on line 100` It seems WordPress' fetch of this Twitter feed occasionally fails, then the error is output for 2 hours until the cache is flushed. How can I get around this?


title: Installing WordPress into a user directory without any admin privileges

text: I posted a question over at webmasters.stackexchange.com that was migrated over to this stack. It's here now: Canonicalization issue regarding academic URL vs. blog URL Before the migration, someone over at the webmasters' stack added a comment. I cannot reply to his comment over at that stack because the question is locked, and that user does not seem to be a member of the wordpress stack, so he will likely not see my response here. Since his comment might lead to a solution to my original problem, I'm going to open it up as an independent question, which I will state below. (Note that you do not have to read my original question to understand or contribute to the one I am about to ask. The original question simply provides some context.) **Question:** I have an account on a university department server. I am an academic within that department, which gives me limited privileges. I have a web-enabled directory in my account, and an index.html file in that account can be displayed in the typical way, by visiting **www.(universityname).edu/~(username)**. I pretty much have complete control over this directory, and I (believe) I can run PHP scripts from my directory. However, I don't have any kind of root / admin / superuser privileges. Is it possible to install the WordPress.org platform to my directory, without additional privileges? If so, should I install it into the directory or into a subdirectory of it? Thanks!


title: Define constant for one plugin in mu-plugin

text: I'm trying to define the constant `ACF_Lite` as `true` so that the interface of the Advanced Custom Fields plugin is hidden on all of my multisite subsites except the parent. For clarity and maintainability, I'm wanting to do this from an `mu-plugins` plugin that will also control the fields displayed by that plugin. I thought this would do it but it didn't:               if( get_current_blog_id() !== 1 )         define( 'ACF_Lite', true );      The plugin author says that this needs to be in `wp-config.php`, but I'm surprised that this doesn't work because, according to the codex, mu-plugins are: > Loaded by PHP, in alphabetical order, before normal plugins, I've confirmed that `get_current_blog_id()` returns the right ID, so that's not the problem. I've also tried explicitly hooking that to `muplugins_loaded` and `plugins_loaded` but that has failed. Can anyone explain why I can't define this from `mu-plugins`?


title: Output thumbnail for current DJ using Radio Station Plugin

text:
So I've installed the "Radio Station" to my Wordpress installation. All seems fine with that. There's a widget included with this plugin that is meant to display "On Air" information about the current DJ in the sidebar and also some information, including their thumbnail image. The trouble I’m having is, I can't (properly i.e. dynamically) get this thumbnail to display. With the standard installation, the plugin is apparently meant to use Gravatar avatars, but that didn't work no matter what I tried. So I've been digging through the code most of the day, trying to figure it out and maybe find a function that would get me the right value and found the following which was relevant in the `dj-on-air.php` file:               if(count($djs['all']) > 0) {         foreach($djs['all'] as $dj) {             //print_r($dj);             $dj_str .= '
';             if($show_avatar) {                 $dj_str .= ''.get_the_post_thumbnail($dj->ID, 'thumbnail').'';             }      The `get_the_post_thumbnail()` function doesn't seem to be working as intended for whatever reason. When I assigned the following variable and displayed it to see what was happening               $tmp = $dj->ID;      the output was "293" (without quotes) which, looking through phpmyadmin seemed to be the "ID" value from the wp_posts table which kinda made sense but explained why get_the_post_thumbnail() wasn't outputting a valid image url for the thumbnail since there is no user ID with a value of "293" - so it just returned nothing and the output html was                     So what I need to do is somehow get the "user ID" value for the currently "on- air" DJ and feed that into the following:               echo ''.get_wp_user_avatar($dj->ID, 96).'';      The above doesn't work presumably because the $dj->ID is returning "293". get_wp_user_avatar() is a function I'm using from another plugin called WP User Avatar so I could set an avatar image manually for each User in the admin area. If I manually enter the user ID value of "3":               echo ''.get_wp_user_avatar(3, 96).'';      It displays the avatar in the widget perfectly as the user ID of the DJ in question is "3". However, I need a way to do this dynamically. I'm not too sure what $dj->ID is doing or how to maybe use that to get the "user ID" of the DJ and not the "wp_posts ID" as it seems to be giving? I hope I've made some sort of sense here. If anyone can help it'd be greatly appreciated and if you need to see more of the source files, please let me know. **UPDATE:** So I'm trying the following:                                   global $wp_query;                     //  $tmp=$dj->post_author;                              //$tmp = $wp_query->post->ID;                     $author_id = $dj->post_author;                     $tmp2 = the_author_meta( 'ID', $author_id );                              $getid = $posts[0]->post_author;                                       echo ''.get_wp_user_avatar($dj->ID, 96).$getid.'';                         }      This keeps giving me "1" as the $getid value which seems to be the ID of the admin user not the user of the current "post". How can I get the user ID of the "post" relating to the current widget. Do I need to make $dj include more values? The other code above was other attempts to get the user ID of the ON- AIR DJ. I think I'm missing something fairly obvious here.


title: Retreive tags from attached post for media on page

text:
I am working on a custom template file that pulls all images in my Media Library with a specific tag. I was able to get this working with some help from the community, it also shows the title of the post that the image is associated with. I need to pull the tags for post the image is attached to as a class name on a container. This is my code:               <?php         $args = array(             'post_type' => 'attachment',             'posts_per_page' => -1,             'post_status' => 'any',             'post_parent' => null,             'tax_query' => array(                 array(                     'taxonomy' => 'post_tag',                     'field' => 'slug',                     'terms' => 'logo'                 )             )         );          $images = get_posts( $args );     if ( $images ) {         foreach ( $images as $image ) {             // Get the parent post ID             $parent_id = $image->post_parent;             // Get the parent post Title             $parent_title = get_the_title( $parent_id );             // Get the parent post permalink             $parent_permalink = get_permalink( $parent_id );             // Get image caption                  $logoimg = wp_get_attachment_image( $image->ID, 'Work Gallery' );                  $posttags = get_the_tags();                 if ($posttags) {                     foreach ($posttags as $tag) {                         str_replace('-','_',$tag->slug . ' ');                     }                 }                      echo '';                          echo '
';                              echo '
';                                  echo '
';                                      echo $logoimg;                                  echo '
';                                  echo '
';                                      echo '
';                                          echo ' ' . $parent_title . ' ';                                      echo '
';                                      echo '
';                                          echo ' ' . get_post( get_post_thumbnail_id($post->ID) )->post_excerpt . ' ';                                      echo '
';                                  echo '
';                                  echo '
';                                      echo '
';                                          $attachment_id = $post->ID; // dynamic attachment ID                                     $image_attributes = wp_get_attachment_image_src( $attachment_id, 'full' ); // returns an array                                          echo '';                                              echo 'Lightbox';                                          echo '';                                      echo '
';                                  echo '
';                              echo '
';                          echo '
';                      echo '';                  }             wp_reset_postdata();         }     ?>      This line: `echo '<aside class="work_item" data-id="id-' . get_the_ID() . '" data-type="' . $posttags . '">';` is where I am trying to get the posts tags (ie: hvac, contractor... for example). On another custom template file I use the following code:               data-type="<?php $posttags = get_the_tags(); if ($posttags) { foreach ($posttags as $tag) { echo str_replace('-','_',$tag->slug . ' '); } } ?> <?php $posttags = get_the_terms($post->ID, 'type'); if ($posttags) { foreach($posttags as $tag) { echo str_replace('-','_',$tag->slug . ''); } } ?>"      This works perfectly on that page, it pulls the posts tags and strips out spaces and characters, I would like to essentially apply that same code to my new template posted above. Of course all help is greatly appreciated!


title: WP_Query - Order results by meta value

text: I've checked around and haven't seen an answer which works as of yet. I have a WP_Query with the following arguements:               $args = array(         'post_status' => 'publish',         'post_type' => 'listing',         'meta_key' => 'client_feedback_score',         'orderby' => 'client_feedback_score',         'order' => 'DESC'             );          $query = new WP_Query($args);      I want to order the results by the custom post field 'client_feedback_score', lowest to highest. But this doesn't seem to work... can anyone point me in the right direction? **EDIT (SOLVED):** Thanks to Milo's response, here's the working code for ordering by a numerical meta value:               $args = array(                 'post_status' => 'publish',                 'post_type' => 'listing',                 'meta_key' => 'client_feedback_score',                 'orderby' => 'meta_value_num',                 'order' => 'DESC'             );


title: If you're calling a dynamic css inline style does that div have to be in the loop?

text:
In the code below i reference "the_field( 'bg_img' )" within my first container div. The reason i do this is because i created a custom field (within a CPT) that allows the admin to change that containers bg color from the admin panel. However when i load the page it doesn't work so i was wondering if: a) it's because it's above the query b) or because it needs to be within the loop I have tried including this div within the loop but then it creates duplicate divs embedded within duplicate divs, etc, etc. So i'm wondering if you can call functions outside of loops, which i'm guessing no. The function btw is unique to the ACF(Advanced Custom Fields) plugin and it's calling a custom field within my 'neighborhoods' CPT. So if i can't call my function outside of a loop then how do i keep this div from not repeating so many times within the code, does it have to do with conditionals or limiting posts? Thanks.                <div class="bg-img-default <?php the_field( 'bg_img' ); ?>">

              <?php                       $args = array(                 'post_type' => 'neighborhoods',                 'posts_per_page' => 1,                 'meta_key' => ''                 );                  $news_query = new WP_Query( $args );              ?>              <?php if ( $news_query->have_posts() ) : while ( $news_query->have_posts() ) : $news_query->the_post(); ?>

latest news

local events
                  <?php the_field( 'single_neighborhood_local_events' ); ?>

listings
                  <?php the_field( 'listings' ); ?>                  <a href="<?php get_permalink(); ?>">Read more
              <?php endwhile; endif; ?>              <?php wp_reset_query(); ?>


title: Replace author with custom field in feed

text: I'm doing some customization on a theme that was previously written by someone else. Rather than use multiple user accounts to assign articles, they created a taxonomy for the custom author name(s) so that an archive of posts by an author can be generated. The code is below, and it's working well. However, I'd also like to replace the author name in the feed. I assume it's going to be an extra filter and/or function. Can someone help me out?               add_filter( 'the_author_posts_link', 'custom_author_name' );     add_filter( 'get_the_author_display_name', 'custom_author_name' );     function custom_author_name( $name ) {         global $post;         $author = get_the_terms(get_the_ID(),'article_author');         if ( $author )             $name = the_terms(get_the_ID(),'article_author','',' & ');         return $name;     }      Update. I tried adding this function, based on code found elsewhere on stack exchange, but it seems to be overwriting the author on the whole site, not just the feed:               add_filter( 'the_author', 'feed_author' );     function feed_author($name) {       if( is_feed() ) {         global $post;         $author = get_the_terms(get_the_ID(),'article_author');          if ( $author )              $name = the_terms(get_the_ID(),'article_author','',' & ');          return $name;         }     }      Figured it out! Ended up using this modified from the sample get_the_terms code in the WP Codex.               add_filter( 'the_author', 'feed_author' );     function feed_author($article_authors) {         if( is_feed() ) {            $author = get_the_terms( get_the_ID(), 'article_author' );            if ( $author && ! is_wp_error( $author ) ) {                  $byline = array();                foreach ( $author as $author ) {                $byline[] = $author->name;                }                   $article_authors = join( " & ", $byline );               }                return $article_authors;         }     }


title: Custom Post Types and Rewrites

text: I have a custom post type registered using Custom Post Types UI plug-in. It has a rewrite rule:               rewrite' => array('slug' => 'apps/iphone-ipad', 'with_front' => '1'),      I am using a custom WP_Query loop to output posts from a bunch of categories. The template that handles the output of pages belonging to this post type has a conditional:               if($post->post_name == 'reviews')     {     include('_reviews.php');     }     else{     //continue with regular logic     }      Basically, I want to use this template to handle 2 different types of content and it works. However, when I try to add post pagination capability to the login in my _reviews.php, I am not able to view next pages. So, given the rewrite rule for CTP above, I have a page with this URL:               example.com/apps/iphone-ipad/reviews      When I step into my reviews logic, I see a number of posts per page as I specified and the Next Page link specified that links to `example.com/apps/iphone-ipad/reviews/page/2` However, when I click that link I get redirected back to `example.com/apps/iphone-ipad/reviews` It seems to have to do with the rewrite rule for the CPT, as I was able to replicate the functionality using a regular standard page.php template and pagincation works. I'd appreciate any tips.


title: Custom taxonomy categories menu with link to subcategory

text:
I'm currently developing a theme for a client that need a "catalog" in a page, I made that catalog with a custom taxonomy and some AJAX, until that everything is fine but the products of that catalog are ordered under categories and sub-categories so when a client click on the main category it must show the sub categories in another menu and list all the products on the first sub-category not all the products on each subcategory (like is currently done). I generated the menus with this code:               <?php     $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );     $parent = get_term($term->parent, get_query_var('taxonomy') );     $grandparent = get_term($parent->parent, get_query_var('taxonomy') );     $children = get_term_children($term->term_id, get_query_var('taxonomy'));     if (!is_single()) {          if (!$parent->term_id && sizeof($children) > 0) {         echo 'categoria';         $args = array(             'child_of' => $term->term_id,             'taxonomy' => $term->taxonomy,             'hide_empty' => 1,             'hierarchical' => true,             'depth'  => 1,             'title_li' => ''             );?>
 <?php  wp_list_categories( $args ); ?>
             <?php         } else {             if ($parent->term_id && sizeof($children) > 0)              {                            $args = array(                     'child_of' => $parent->term_id,                     'taxonomy' => $term->taxonomy,                     'hide_empty' => 1,                     'hierarchical' => true,                     'depth'  => 1,                     'title_li' => ''                     );?>
 <?php  wp_list_categories( $args ); ?>
                     <?php                      } else {                     $args = array(                         'child_of' => $grandparent->term_id,                         'taxonomy' => $term->taxonomy,                         'hide_empty' => 1,                         'hierarchical' => true,                         'depth'  => 1,                         'title_li' => ''                         );?>
 <?php  wp_list_categories( $args ); ?>
                         <?php                     }                 }             }      ?>      and it shows me the menu for the categories and another code similar for showing the sub-categories in other menu. The categories are in a hierarchy like this: Is there someone that can point me out how to do it? Sorry if my English isn't good enough to explain my problem, I'm not a native English speaker.


title: Adding an Unlinked Space in a Custom Function

text: This question has been a pain in my side for the last few days. I am using a function to display page numbers and next/previous links with WP_LINK_PAGES. The code I'm using (below) is a shortened version of the code found here \- to the best of my knowledge, it is correct. (Go easy on me, just diving into PHP.) Please view the working example here. The problem should be a simple fix, but I can't figure it out. **I would like to add a space in front of the "Next Page" link which is _not_ linked itself to the next page in order for the pagination to have equal spacing.**               function wp_link_pages_args_prevnext_add($args)     {         global $page, $numpages, $more, $pagenow;              if($page-1) # there is a previous page             $args['before'] .= _wp_link_page($page-1)                 . $args['link_before']. $args['previouspagelink'] . $args['link_after'] . ''             ;              if ($page<$numpages) # there is a next page             $args['after'] = _wp_link_page($page+1)                 . $args['link_before'] . $args['nextpagelink'] . $args['link_after'] . ''             ;              return $args;     }


title: Options for Wiki WordPress

text: I would like to know my options for how best to use WordPress as a wiki. I tried Media Wiki, but the sheer amount of changes I need to make to code to make even trivial changes turned me off. Way off. Googling doesn't reveal much. What are the best options for using WP as a wiki? (This can be a community question discussing various options.) In particular, I would like something that addresses:   * Links to non-existing pages actually link to a "create new page" page   * Editing pages without going through /wp-admin/ (i.e. the back-end)   * Searching/listing existing pages when linking (i.e. linking by title, not by URL) What are my options?


title: Should HTML output be passed through esc_html() AND wp_kses()?

text: I'm confused about the different uses of esc_html() and wp_kses(). I understand that esc_html() converts special characters to their HTML entity, and that wp_kses() removes unwanted tags (e.g., <script>), but I'm not sure in what contexts they should be used together or separately. If I run some untrusted HTML through esc_html(), then any JavaScript will be displayed in plain text rather than being rendered by the browser, so it is safe at that point, correct? The only reason to also run it through wp_kses() would be to avoid having the raw script displayed? Basically, esc_html() makes it safe, and wp_kses() makes it pretty. Is that correct?


title: Change role after the user has read all the posts in a category

text: I'm creating a platform with "X" categories and "X" roles with the same name to each category. I would like to know how to change the user's role after they have read all the posts in a category. When the role changes, the user will have access to the next category. To make the categories private and to create the related groups of users I'm using the Role Scoper plugin. This solution is very similar to what I mean: http://stackoverflow.com/questions/9181440/wordpress-change-user-role- conditionally Thanks


title: How to get an error message if a form is empty (plugin: Post for site)

text:
I wonder if you intelligent friends can detect the problem in this code. I want the form to display an error message if it's empty. Now it just goes to my completed form page.               <?php      /* * *     * Processed form data into a proper post array, uses wp_insert_post() to add post.      *      * @param array $pfs_data POSTed array of data from the form     */     require('../../../wp-load.php');     error_reporting(E_ALL);     ini_set('display_errors',1);          /**     * Create post from form data, including uploading images     * @param array $post     * @param array $files     * @return string success or error message.     */     function pfs_submit($post,$files){     $pfs_options_arr = get_option('pfs_options');     $pfs_options = $pfs_options_arr[0];     $pfs_data = $post;     $pfs_files = $files;     //echo "
".print_r($pfs_data, true)."
\n";     //echo "
".print_r($pfs_files, true)."
\n";          $title = $pfs_data['title'];     $category = $pfs_data['cat'];     $postcontent = $pfs_data['postcontent'];          $name = (array_key_exists('name',$pfs_data)) ? esc_html($pfs_data['name'],array()) : '';     $email = (array_key_exists('email',$pfs_data)) ? sanitize_email($pfs_data['email']) : '';          $taxonomies = array();          $imgAllowed = 0;     $result = Array(         'image'=>"",         'error'=>"",         'success'=>"",         'post'=>""     );     $success = False;     $upload = False;          if ( !current_user_can('publish_posts') && $pfs_options['allow_anon'] && $pfs_options['enable_captcha'] ){         require_once('recaptchalib.php');         $privatekey = $pfs_options_arr['recaptcha_private_key'];         $resp = recaptcha_check_answer ($privatekey,                                     $_SERVER["REMOTE_ADDR"],                                     $_POST["recaptcha_challenge_field"],                                     $_POST["recaptcha_response_field"]);     }     if ( !current_user_can('publish_posts') && $pfs_options['allow_anon'] && $pfs_options['enable_captcha'] && !$resp->is_valid ) {         // What happens when the CAPTCHA was entered incorrectly         $result['error'] = printf(__("Incorrect reCAPTCHA: %s",'pfs_domain'), $resp->error);     } else {         //echo "
".print_r($pfs_files['image']['name'], true)."
\n";         if (array_key_exists('image',$pfs_files)) {              /* play with the image */             switch (True) {             case (1 < count($pfs_files['image']['name'])):                 // multiple file upload                 $result['image'] = "multiple";                 $file = $pfs_files['image'];                 for ( $i = 0; $i < count($file['tmp_name']); $i++ ){                     if( ''!=$file['tmp_name'][$i] ){                         $imgAllowed = (getimagesize($file['tmp_name'][$i])) ? True : (''==$file['name'][$i]);                         if ($imgAllowed){                             $upload[$i+1] = upload_image(array('name'=>$pfs_files["image"]["name"][$i], 'tmp_name'=>$pfs_files["image"]["tmp_name"][$i]));                             if (False === $upload[$i+1]){                                 $result['error'] = __("Något gick fel när bilden skulle laddas upp.",'pfs_domain');                             } else {                                 $success[$i+1] = True;                             }                         } else {                             $result['error'] = __("Fel filformat. Bara formaten (.gif, .png, .jpg, .jpeg) fungerar.",'pfs_domain');                         }                     }                 }                 break;             case ((1 == count($pfs_files['image']['name'])) && ('' != $pfs_files['image']['name'][0]) ):                 // single file upload                 $file = $pfs_files['image'];                 $result['image'] = 'single';                 $imgAllowed = (getimagesize($file['tmp_name'][0])) ? True : (''==$file['name'][0]);                 if ($imgAllowed){                     $upload[1] = upload_image( array( 'name'=>$file["name"][0], 'tmp_name'=>$file["tmp_name"][0] ) );                     //echo "
".print_r($upload, true)."
\n";                     if (False === $upload[1]){                         $result['error'] = __("Något gick fel när bilden skulle laddas upp.",'pfs_domain');                     } else {                         $success[1] = True;                     }                 } else {                     $result['error'] = __("Fel filformat. Bara formaten (.gif, .png, .jpg, .jpeg) fungerar.",'pfs_domain');                 }                 break;             default:                  $result['image'] = 'none';             }         }         if ( '' != $result['error'] ) return $result; // fail if the image upload failed.              //echo "
".print_r($upload, true)."
\n";         //echo "
".print_r($success, true)."
\n";              /* manipulate $pfs_data into proper post array */         $has_content_things = ($title != '') && ($postcontent != '');         if ( !current_user_can('publish_posts') && $pfs_options['allow_anon'] ) $has_content_things = $has_content_things && ($name != '') && is_email($email);         if ( $has_content_things ) {             $content = $postcontent;             if ( !current_user_can('publish_posts') && $pfs_options['allow_anon'] ) $content .= apply_filters('pfs_submittedby_text',"
Berättat av $name
");             if ( is_user_logged_in() ){                 global $user_ID;                 get_currentuserinfo();             }             if (is_array($success)){                 foreach(array_keys($success) as $i){                     $imgtag = "[!--image$i--]";                     if (False === strpos($content,$imgtag)) $content .= "\n\n$imgtag";                     $content = str_replace($imgtag, wp_get_attachment_link( $upload[$i], $pfs_options['wp_image_size']), $content);                 }             }              //if any [!--image#--] tags remain, they are invalid and should just be deleted.             $content = preg_replace('/\[\!--image\d*--\]/','',$content);                  // $terms[{tax name}] = array(term1, term2, etc)             if ( array_key_exists('terms',$pfs_data) ) {                 foreach ($pfs_data['terms'] as $taxon => $terms){                     if ( !is_taxonomy_hierarchical($taxon) ) {                         $pfs_data['terms'][$taxon] = implode(',',$terms);                     }                 }             }                  $postarr = array();             $postarr['post_title'] = $title;             $postarr['post_content'] = apply_filters('comment_text', $content);             $postarr['comment_status'] = $pfs_options['comment_status'];             $postarr['post_status'] = $pfs_options['post_status'];             $postarr['post_author'] = ( is_user_logged_in() ) ? $user_ID : $pfs_options['default_author'];             $postarr['tax_input'] = (array_key_exists('terms',$pfs_data)) ? $pfs_data['terms'] : array();             $postarr['post_type'] = $pfs_options['post_type'];             $postarr['post_category'] = array($category);             //echo "
".print_r($postarr, true)."
\n";             $post_id = wp_insert_post($postarr);                  if (0 == $post_id) {                 $result['error'] = __("Berättelsen kunde inte laddas upp - okänt fel.",'pfs_domain');             } else {                 $result['success'] = __("Berättelsen är tillagd, du kommer att komma vidare om en stund.",'pfs_domain');                 $result['post'] = $post_id;             }         } else {              $result['error'] = __("Du har lämnat en ruta tom. Alla rutor behöver fyllas i.",'pfs_domain');         }     }      return $result;     }          /**          * Upload images     */     function upload_image($image){     $file = wp_upload_bits( $image["name"], null, file_get_contents($image["tmp_name"]));     //echo "
";     //var_dump($file);     //echo "
\n";     if (false === $file['error']) {         $wp_filetype = wp_check_filetype(basename($file['file']), null );         $attachment = array(          'post_mime_type' => $wp_filetype['type'],          'post_title' => preg_replace('/\.[^.]+$/', '', basename($file['file'])),          'post_content' => '',          'post_status' => 'inherit'         );         $attach_id = wp_insert_attachment( $attachment, $file['file'] );         // you must first include the image.php file         // for the function wp_generate_attachment_metadata() to work         require_once(ABSPATH . "wp-admin" . '/includes/image.php');         $attach_data = wp_generate_attachment_metadata( $attach_id, $file['file'] );         wp_update_attachment_metadata( $attach_id,  $attach_data );         return $attach_id;     } else {         //TODO: er, error handling?         return false;     }     }          if (!empty($_POST)){     $pfs = pfs_submit($_POST,$_FILES);     echo json_encode($pfs);     //echo "
".print_r($pfs, true)."\n";     wp_redirect("http://domda.se/tack/");     exit;     } else {     /* TODO: translate following */     _e('Den här sidan hade du inte behövt se, något är fel.','pfs_domain');     echo "" . __('Go home?','pfs_domain') . "";     }          //get_footer();     ?>      The support for the plugin isn't active. Sorry to say. Hope someone can help.


title: Tricky WP Query

text: I am trying to use wp_query (or another native Wordpress query class) to do the following: get all posts WHERE ( post_type = 'post' AND category = 7 ) OR ( post_type = 'case-studies' AND meta_key = 'homeslide' AND meta_value = 1 ) I am not sure any of them can handle this yet. **Trying with WP Query:**               $args = array (         'relation' => 'OR',         array(             'meta_key' => '_homeslide',              'meta_value' => '1'         ),         array(             'category' => '7'         )     );      But I think "relation" is only for use with tax_query. I could probably use $wpdb to create an advanced query but wanted to see if it could be done with the others and see if I was missing something obvious.


title: Migrating Roles from one environment to another

text: I have 2 identical environments . Now, on one I have created many roles and have assigned users to them . How do I migrate this to the other server which has the same set of users already. Any suggestions to the problem would be great.


title: How to exclude categories from a sidebar with active widgets in it?

text: Is there a way to exclude certain categories from a widgetised sidebar? I've got categories that are associated with custom post types and ones associated with my blog - I don't want to display the CPT categories when viewing my blog. Any ideas? All I can think of is that I have to hard code the sidebar instead and ditch the widgetised version.


title: Bootstrap Nav menu won't toggle collapse when in mobile viewport size

text:
I have copied the Bootstrap Default Navbar code to a T http://getbootstrap.com/components/#navbar-default However it's not working and i just need a simple dropdown nav for my mobile viewport size. Since chrome only allows down to 400px browser re-sizing I have set the media query to work on that min-width: 400px. Here is the site (i'll leave live for a few days in order to allow inspection of the code). But the reason i'm unsure about where to start is because i suspect a few culprits: 1) By default WordPress calls it's own copy of jquery if it's not included, but so does bootstrap.min.js so i'm not sure if there is a conflict there and if so how to resolve it 2) Don't know how to check if jquery is being called in Chrome DevTools on the Networks tab so i'm further unable to figure it out. On the server i see that bootstrap.min.js is indeed within the JS folder in the my custom theme but when i explore in DevTools the bootstrap.min.js file is NOT inside the themes JS directory (major head scratcher). 3) The way WP abstracts stylesheets and scripts could be a cause but here is how i have them right now               // Load the Theme JS          function theme_js() {            wp_enqueue_script( 'theme_js', get_template_directory_uri() . '/js/theme.js', array('jquery'), '', true );       wp_enqueue_script( 'theme_js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '', true );          }          add_action( 'wp_enqueue_scripts', 'theme_js' );          add_action( 'wp_enqueue_scripts', 'theme_styles' );      So i'm pretty sure that should be calling jquery through Bootstrap but i could be wrong. Also it is worth noting that in order for the mobile menu (burger menu/stack menu/ whatever you want to call that menu icon with three parallel horizontal lines) to work it needs to have the collapse.js script included which in BS's site it claims it is included in the boostrap.min.js file, really all you need is that one JS file. But as you can see here (please reduce your browser window to atleast 400px wide) http://dcinsideout.com/ when the menu is clicked nothing happens, it won't reveal the collapsed div and i'm kinda new at JS so i'm not very good at debugging it yet. I did open the console and tried applying a .toggle() method to the button class but that didn't work it returned a TypeError undefined is not a function. So i'm really confused at this point this should be a pretty simple cut and dry mobile nav menu but it's been pretty complicated. Here is the markup i have for the menu, NOTE: my menu is being called through the PHP script which shouldn't make a difference.

                            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#dcMobileNav">                         Toggle Navigation                                                                                </button>

                         <?php                                $args = array(                             'menu' => 'main-menu'                             );                                wp_nav_menu( $args );                              ?>

Explore a
Neighborhood

Hover over map to explore
                      <?php get_template_part( 'content', 'cirnav' ); ?>

                 I also commented out the BRAND link as i just decided to use my own div with a logo class, again not something that should hinder the menu from working. Any help, advice, comments, suggestions would be most helpful. Thank you.


title: qtranslate code doesn't work

text: function register_custom_artist() {               $labels = array(          'name' => _x( 'Artist', 'artist' ),         'singular_name' => _x( 'Artist', 'artist' ),         'add_new' => _x( 'Add New', 'artist' ),         'add_new_item' => _x( 'Add New Artist', 'artist' ),         'edit_item' => _x( 'Edit Artist', 'artist' ),         'new_item' => _x( 'New Artist', 'artist' ),         'view_item' => _x( 'View Artist', 'artist' ),         'search_items' => _x( 'Search Artists', 'artist' ),         'not_found' => _x( 'No artists found', 'artist' ),         'not_found_in_trash' => _x( 'No artists found in Trash', 'artist' ),         'parent_item_colon' => _x( 'Parent Artist:', 'artist' ),         'menu_name' => _x( '"[:en]English[:es]Português"', 'artist' ),     );      ''''''''''''''''''''' How to make 'menu_name' => _x( '"[:en]English[:es]Português"', 'artist' ) work??


title: Limit the number of posts from a specific category on index.php

text: I've had multiple requests from different clients to figure out a way to modify their blog (index.php) or Custom Post Type Archive page in order to show less posts from a certain category. A good example would be a client that has a system of automatic posting from social media (Facebook, Twitter, Instagram), which posts to their WordPress blog in the "Social Media" category. If this client posts a lot to social media, and writes actual posts on their blog sparingly, the social media posts will dominate their blog (at least on the first page). In this case, the client needs a way to limit the posts in the "Social Media" category per page, on the blog. I looked into using `pre_get_posts` to modify the query, but can't seem to find any examples of how to limit the number of posts per page of a specific category, on the index.php page. I was also considering making 2 separate queries (one for the "Social Media" category and another excluding this category) and combining them in a certain order. With this method, I was thinking that I could create a loop that combined the ID's of the 2 arrays (into 1), so that every fourth item would be from the "Social Media" category. This sounds like a bit of hacking to me though, and I would like to find out if there is a more elegant/less messy way to get this done.


title: Saving & reading analytics data in Wordpress

text: I am trying to create an analytics functionality where I would like to save my blog's daily facebook likes and use that data for date range based graphing purposes. What is the best way to save and read this data? Database, CSV , XML? Any good examples would help.


title: the_content() Returns post content when I want page content

text:
I'm very new to WordPress, but I'm currently doing work on a site built on the platform. I'm making my way through, but I've run into a bit of a problem. I'm trying to add content from the text editor of the site's blog `page`, which uses the standard index.php template. However, when I use `<?php the_content(); ?>` like other pages use, it returns the content of the latest `post`. Is there a way to get the content from the page editor instead? I've been looking all morning without really finding anything satisfactory. Any advice would be greatly appreciated!
                     <?php the_content(); ?>
                              <?php if (have_posts()) : ?>                                  <?php get_template_part('inc/loop', get_post_type() ); ?>                              <?php else : ?>                                  <?php get_template_part('inc/content', 'none' ); ?>                              <?php endif; ?>


title: Creating completely new WordPress site from old WP contents

text: I have an **old WordPress 3.5 site** , but now I'm working in **creating completely a new** WordPress project, it will be using the latest WP 3.8.1 and new design with a theme that i bought. Kindly, if someone can help me with this points:   * I need to use all the content from the old WP site ( the data itself as a raw martial e.g: if i have 1000 post i need to use them in my new site, i don't need to enter them again instead reuse them). Taking in consideration that the new website will be different in (categories, tags, new pages, new menu) that's what i mean by completely new, so **i'm not upgrading or migrating**. I hope that i make it clear.


title: Remove wordpress author's capability to moderate comments on their own posts

text: WordPress authors have permission to edit others comments on their own post. How to disable this and still allow the authors to edit their published posts?


title: Problem with Yoast SEO and GD Press Tools

text: I am having a small problem with getting Yoast SEO to work along side GD Press Tools, which i am hoping i can get some help from you guys. I am look to move from Platinum SEO Pack to Yoast, as I been told its all round better. But when I install Yoast SEO, GD Press Tools (another plugin) does not work as it should and keeps saying: Working, Please wait. Are You sure? Operation is not reversible The following is at the bottom of every setting page for GD Press Tools. ![enter image description here](http://i.stack.imgur.com/JZLUi.png) I spoken to the developer of the GD Press Tools and this is what they said: > It is very likely that the plugin is adding its own JavaScript where it > should not do it, causing problems to GD Press Tools. Plugins should load JS > files only on own pages, not messing with other plugins. So then, has anyone got any ideas one what could be up with it and how to fix it, as i don't really have a clue where to start.


title: Renaming/translating "your profile" page

text: I need to rename/translate the "Your Profile" page. I've used the function below               function pietergoosen_hoofskerm_vertaling( $translated ) {      $words = array(                         'Name' => 'Naam',                          );      $translated = str_ireplace(  array_keys($words),  $words,  $translated );      return $translated;     }     add_filter(  'gettext',  'pietergoosen_hoofskerm_vertaling'  );      The problem is, this change all instances of Name to Naam, even when name is part of word or sentence, like 'UserName' get changed to 'UserNaam' and 'Display Name publicly as' get changed to 'Display Naam publicly as'. Any other ways to this


title: Using Ajax with a Class file

text: At the moment I have an ajax that works (I get a success [200] response), but having an issue with the action hooks on the response. The JSON object is not coming back, instead **I'm getting a 0**. I have the die(); after my return so I'm thinking the issue is the hook not working. I've tried multiple methods within the Class constructor but I'm not sure if this approach is right, I've done it before with a plugin I made, but this is within the **theme**. ## Form.php _(included in functions.php with`add_action('after_setup_theme')`_               public function __construct(){      // Test #1      add_action( 'wp_ajax_nopriv_process_reservation', array( &$this, 'process_reservation' ) );           // Test #2       add_action( 'wp_ajax_process_reservation', &$this->process_reservation ); //with and without '&' before $this           // Test #3 (this is incorrect)      add_action( 'wp_ajax_nopriv_process_reservation', $this->process_reservation );               //If I wrap this with **add_action('init',function(){... *** then it does not load      wp_enqueue_script('ajax_script',THEME_MODULES_URL.'/Reservations/form.js',array('jquery'),TRUE);      wp_localize_script( 'ajax_script', 'myAjax', array(           'ajaxurl'               => admin_url( 'admin-ajax.php' ), //don't change this           'itemNonce'             => wp_create_nonce("ajax_nonce"), //don't change this       ));     }      Just in case it is needed here is the test of my callback function at the moment as well               private function process_reservation(){         check_ajax_referer( 'process_reservation_nonce', 'nonce' );              if( true )             wp_send_json_success( 'ok' );         else             wp_send_json_error( array( 'error' => $custom_error ) );          }      Form data in the XHR console shows both the action and nounce passed               action:process_reservation     ajax_nonce:6f155a1e17      I've done enough Ajax to know what to expect so I'm pretty sure its a hooking issue here, perhaps something with the theme scope that I don't understand, either way any suggestions or help from the community would be great! Thanks in advance


title: Can wp_schedule_single_event be used to run background proccess?

text: I got a plugin that let users send invitations to their friends. If the user have like 4000 friends we run into trouble. At the moment i use a simple batch like the following for emails. But we also send facebook and twitter messages. USer don't need to wait until procces is complete and this is called actually with a ajax call               set_time_limit(60*60);          if( $quantity < 40 ){              foreach( $emails as $email )         {             wp_mail( $email, $subject, $message, $headers);             sleep(1);         }          }     else     {         $counter = 0;         //Lets create batches         foreach( $emails as $email )         {                 $counter++;             wp_mail( $email, $subject, $message, $headers);             sleep(1);                  if( $counter == 50 )             {                 sleep(10);                 $counter = 0;             }         }     }      As cron jobs are usually not allowed in shared hosting, the same way exec sometimes is not available we were thinking on use wp_schedule_single_event. Should be possible or i would need to try a `exec("doTask.php $arg1 $arg2 $arg3 >/dev/null 2>&1 &");` approach to run the process in the background?


title: 500 Error when opening multiple WPMU domains in one browser

text: We have a WPMU instance with ~50 sites on it and, if we open multiple domains in a single browser, the CPU and memory usage on the server goes through the roof and further pages result in a 500 error. We have not tried disabling plugins to see if that was the cause yet, that will be done tonight in off- hours. I'm hoping that someone else has seen similar behavior and might be able to steer us in the right direction.


title: Is it possible to customize the layout of Gallery Shortcode?

text: Is it possible to customize how my gallery shortcode works. eg. have a div for showing the image then a list of thumbnails at the bottom or side? Or perhaps I can create a custom template file to loop through my page's gallery images?


title: Trouble Installing Wordpress Get PHP Not Running Answer

text: I have seen this topic discussed several places on the internet, both in the Wordpress official forums and on individuals' blogs. Despite having worked through some of the suggestions, I am still getting the error, when I try to run wp-admin/install.php in my browser locally logged into the console of the server. Here is what I have done: 1) Apache is installed. 2) MySQL is installed. 3) PHP is installed both according to yum, and the following works the command line, and if I put               <?php     phpinfo();     ?>      into /var/www/html/index.php and point my browser to `http://localhost` I get the phpinfo page. 4) The OS is CentOS 6.4 5) Here is the output of mysql Server version: 5.1.69 Source distribution 6) From command line php -version PHP 5.3.3 (cli) (built: Feb 22 2013 02:51:11) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies 7) From /etc/httpd/conf/httpd.conf `LoadModule rewrite_module modules/mod_rewrite.so` What else do I need to do to install WordPress? Here is part of the error page: ![enter image description here](http://i.stack.imgur.com/sWDZB.png) What is weird is I have not installed db tables from the MySQL server into the MySQL server on this system. It says the config has a bad database entry in it, so I'll go look at that, and update the OP.


title: Check if any users are logged in before running update

text: Before I update a Wordpress install (including the theme and various plugins) I wanted to ensure no one is logged in and editing the site. Is there a way to do this? Thanks!


title: Wordpress Admin Panel Search posts with custom post meta values along with title

text: Trying to modify default admin search by including search by custom post type fields, Below is my code,               function custom_search_query( $query ) {         $custom_fields = array(         // put all the meta fields you want to search for here         "rg_1job_designation",         "rg_2job_designation"         );         $searchterm = $query->query_vars['s'];         // we have to remove the "s" parameter from the query, because it will prevent the posts from being found         $query->query_vars['s'] = "";         if ($searchterm != "") {         $meta_query = array('relation' => 'OR');         foreach($custom_fields as $cf) {         array_push($meta_query, array(         'key' => $cf,         'value' => $searchterm,         'compare' => 'LIKE'         ));         }         $query->set("meta_query", $meta_query);         };     }     add_filter( "pre_get_posts", "custom_search_query");      But it's not working. i have a post **title** -> **John** & **Designation** -> **Designer** On search by **Designer** can get 1 result, But on search of **John** result is empty (This should also fetch one result). Now the default search for title is lost want to use that too. Did anyone know what's wrong in my code ?


title: How to use categories in the URL with Advanced Custom Fields?

text: Using the Advanced custom fields plugin: 1) I want to post to the ACF and use a category just like a regular blog post, but the URL would be: `mysite.com/customPost/category/post-name` Is this possible? And how can I do it? 2) Can I add a custom page template to each category page?


title: Where is the order of a menu saved in the database

text: I want to use a custom menu from the wordpress database but I get the elements disordered and I want them to have the same order how can i do that? There is a place in the database where the order is stored?


title: How to display the post of child custom taxonomy but not that post in parent?

text:
I want the archive page of custom page having custom post type in order with custom taxonomy. like               -parent1_taxonomy        -child1_taxonomy          -child1_taxonomy_post1          -child1_taxonomy_post2                -child2_taxonomy                      -child2_taxonomy_post1                      -child2_taxonomy_post2     parent2_taxonomy      -likewise       ................      I use following code for archive template.               <?php     /**     *Display categories list and post     */          $query_category = mysql_query("SELECT wp_terms.term_id,wp_terms.name, wp_term_taxonomy.parent FROM wp_terms INNER JOIN wp_term_taxonomy ON wp_terms.term_id = wp_term_taxonomy.term_id WHERE wp_term_taxonomy.taxonomy = 'food_menu_food_category' ORDER BY name");         $data = array();         $index = array();         while ($row = mysql_fetch_assoc($query_category)) {             $id = $row["term_id"];             $parent_id = $row["parent"] === NULL ? "NULL" : $row["parent"];             $data[$id] = $row;             $index[$parent_id][] = $id;         }         function display_child_nodes($parent_id, $level){             global $data, $index;             $parent_id = $parent_id === NULL ? "NULL" : $parent_id;             if (isset($index[$parent_id])) {                 echo "
";                 foreach ($index[$parent_id] as $id) {                     if($level == 0){                         echo "

".$data[$id]["name"]."";                         //$ca=$data[$id]["name"];                                                 ?>              <?php                     }                     if($level == 1){                         echo "

".$data[$id]["name"]."

";                           $ch=$data[$id]["name"]  ;                           //echo $ch;                                  //For post content                                  $post_type = 'food_menu';                                 $tax = 'food_menu_food_category';                                 $tax_terms = get_terms($tax, array('orderby' => 'id', 'order' => 'ASC'));                                 if ($tax_terms) {                                     foreach ($tax_terms as $tax_term) {                                         $args = array(                                             'post_type' => $post_type,                                             "$tax" => $tax_term->slug,                                             'post_status' => 'publish',                                             'posts_per_page' => - 1,                                             'orderby' => 'title',                                             'order' => 'ASC',                                             'caller_get_posts' => 1                                             ); // END $args                                         $my_query = null;                                         $my_query = new WP_Query($args);                                         if ($my_query->have_posts()) {                                             //echo '
' . $tax_term->name . '
';                                             $c=$tax_term->name;                                             //echo $c;                                             while ($my_query->have_posts()) : $my_query->the_post();                                             if($ch==$c){                                                 //echo '
'. $ch .'
';                                                 ?>

 <a href="<?php the_permalink(); ?>">                                                 <?php $scat=get_the_title();                                                 echo $scat; ?>                                                 <a href="<?php the_permalink(); ?>">                                                 <?php echo esc_html( get_post_meta( get_the_ID(), 'food_price', true ) ); ?>

                                            <?php                                                  }                                             ?>                                           <?php                                             endwhile;                                         } // END if have_posts loop                                         wp_reset_query();                                     } // END foreach $tax_terms                                 } // END if $tax_terms                          }                                    // Child of child class                     if($level == 2){                         echo "

".$data[$id]["name"]."

";                           $ch=$data[$id]["name"]  ;                           //echo $ch;                                  //For post content                                  $post_type = 'food_menu';                                 $tax = 'food_menu_food_category';                                 $tax_terms = get_terms($tax, array('orderby' => 'id', 'order' => 'ASC'));                                 if ($tax_terms) {                                     foreach ($tax_terms as $tax_term) {                                         $args = array(                                             'post_type' => $post_type,                                             "$tax" => $tax_term->slug,                                             'post_status' => 'publish',                                             'posts_per_page' => - 1,                                             'orderby' => 'title',                                             'order' => 'ASC',                                             'caller_get_posts' => 1                                             ); // END $args                                         $my_query = null;                                         $my_query = new WP_Query($args);                                         if ($my_query->have_posts()) {                                             //echo '
' . $tax_term->name . '
';                                             $c=$tax_term->name;                                             //echo $c;                                             while ($my_query->have_posts()) : $my_query->the_post();                                             if($ch==$c){                                                 //echo '
'. $ch .'
';                                                 ?>

 <a href="<?php the_permalink(); ?>">                                                 <?php $scat=get_the_title();                                                 echo $scat; ?>                                                 <a href="<?php the_permalink(); ?>">                                                 <?php echo esc_html( get_post_meta( get_the_ID(), 'food_price', true ) ); ?>

                                            <?php                                                  }                                             ?>                                           <?php                                             endwhile;                                         } // END if have_posts loop                                         wp_reset_query();                                     } // END foreach $tax_terms                                 } // END if $tax_terms                          }                                         //Child of child of child class                     if($level == 3){                         echo "

".$data[$id]["name"]."

";                           $ch=$data[$id]["name"]  ;                           //echo $ch;                                  //For post content                                  $post_type = 'food_menu';                                 $tax = 'food_menu_food_category';                                 $tax_terms = get_terms($tax, array('orderby' => 'id', 'order' => 'ASC'));                                 if ($tax_terms) {                                     foreach ($tax_terms as $tax_term) {                                         $args = array(                                             'post_type' => $post_type,                                             "$tax" => $tax_term->slug,                                             'post_status' => 'publish',                                             'posts_per_page' => - 1,                                             'orderby' => 'title',                                             'order' => 'ASC',                                             'caller_get_posts' => 1                                             ); // END $args                                         $my_query = null;                                         $my_query = new WP_Query($args);                                         if ($my_query->have_posts()) {                                             //echo '
' . $tax_term->name . '
';                                             $c=$tax_term->name;                                             //echo $c;                                             while ($my_query->have_posts()) : $my_query->the_post();                                             if($ch==$c){                                                 //echo '
'. $ch .'
';                                                 ?>

 <a href="<?php the_permalink(); ?>">                                                 <?php $scat=get_the_title();                                                 echo $scat; ?>                                                 <a href="<?php the_permalink(); ?>">                                                 <?php echo esc_html( get_post_meta( get_the_ID(), 'food_price', true ) ); ?>

                                            <?php                                                  }                                             ?>                                           <?php                                             endwhile;                                         } // END if have_posts loop                                         wp_reset_query();                                     } // END foreach $tax_terms                                 } // END if $tax_terms                          }                                  // echo str_repeat("-", $level) . $data[$id]["name"] . "
";                    display_child_nodes($id, $level + 1);                     if($level != 1){                         echo "
";                     }                 }                 echo "
";             }         }         display_child_nodes(0, 0);          ?>      This code display the post like ..               -parent1_taxonomy      -child1_taxonomy          -child1_taxonomy_post1          -child1_taxonomy_post2          -child2_taxonomy_post1          -child2_taxonomy_post2                -child2_taxonomy                      -child2_taxonomy_post1                      -child2_taxonomy_post2      parent2_taxonomy        -likewise...      Also the post of its sub category in root category.. Thank you in advance.


title: Special Character Appearing in my WordPress Pages Content

text: Can somebody please assist as to why I am getting the following special character � in my WordPress content pages. Not sure how it got in there. You can see this special character at this url: PPS Victoria and then just scroll down to "Restoration and Recovery Services" sub-section. Any help would be great. Thanks.


title: Opinions whether to go multisite VS 3 separate WP installation

text: I've been reading a lot of questions here regarding about multiple blogs/sites in one Wordpress installation and I've added some of them to my favorites. But I still have the urge/nerve to post this question as I'm excited to have my first attempt in blogging. I will ask for your opinions and experiences on how to best solve my dilemma. My goal is to launch 3 blogs based on my varied interests. I've already bought domains and web hosting. Now the questions going through my head are:   1. It might be better to have one account to manage the 3 blogs I'm planning. Is that the multisite feature of Wordpress? Those 3 blogs will be on 3 different domains as they are different (niche) in category. They'll also be having their own themes.   2. In this multisite feature, will they point to one database only? If that's the case, it would be better to have separate databases for those blogs of mine to avoid bloating the database. **I think this database thing is my main issue.** What do you guys think?   3. I've really no need for unified user registration as of the moment, contrary to what other users reason out for setting up multisite in WP. These are just blogs not forums anyway, besides users/visitors just can use OpenID or their WP accounts to comment right?   4. Finally, am I just better having 3 separate WP installations on my host? What pros and cons can you guys give from choosing multisite versus 3 separate WP installations? The perfect example might be the account one could have on Wordpress.com. You only have one account but you get to create many blogs that will be on their own domains later on. The benefit is that you control it on one account only. Hope to hear your opinions and thank you.


title: new WP_Query based on average values of meta fields

text: I have 5 different meta (numerical) fields for a custom post type and I need to create a query based on the average values from those fields (kinda like a rating system, post with highest average rating from those 5 different rating field should come first). The meta boxes are setup and working smoothly, however I am stuck when I have to query the posts by the average values.. I have absolutely no idea how to get those values before the query, any help will be appreciated. Thanks


title: Resize images in batch

text: I want to resize images on server, I have more than 7000 images in library of my WordPress site. I want to resize all images on server itself. I know that regenerate thumbnails plugin can be used, but for that I will have to keep my browser window open all the day and it can even crash somewhere in middle that will lead me to resize all images again. Does anyone have better idea to do this stuff? Please explain answer in brief.


title: Add custom field to existing meta box?

text: First off, I have been able to successfully implement custom fields within a custom meta box in Wordpress. I understand how this works. My question is, is there a way for me to add a custom field to an already existing meta box? For instance, I want to add field within Wordpress's "Author" meta box because it is directly related to the author of a post. I haven't found any documentation or examples of this, just many regarding adding an entirely new meta box. Is it possible to add a custom field to one of Wordpress's existing meta boxes? Thanks.


title: How do I determine if the user who registered is not spam?

text: I've recently set up a forum on my site with the bbpress-plugin. Now a user has registered on the site but the email-adress looks suspicious to me. How can I determine if the user is real? Is there a security risk if it is spam and I do not remove the user? Thanks


title: posts2posts query using connected_items array issue

text: **My setup is as follows** I hava a custom post type named 'events' and a custom post type named 'genres' which I link with scribu's Posts2Posts plugin. Each event can have multiple genres linked to it. **What I would like to do** _On an event page_ , I'd like to show other, related, events based on the genres the current event has. What I think I should do   1. Run a query which gets all the genres IDs of the current event   2. Pass these IDs in a second query which finds all the events which have one or more of these genres linked to it  I have a p2p query which I'd like to output all events which have one AND / OR more of the given genres in connected_items. I pass them as an array, just like in the documentation. To illustrate my outcome, lets say that   * event1 has linked genres with post ids 1240, 1241, 1242 and 1250   * event2 has linked genres with post ids 1240, 1241 and 1260    * event3 has linked genres with post ids 1241 and 1242 In the first query I get all the genre IDs, this works. The second query which gets all the events with the given genres (I pass them as an array):               $args = array(             'connected_type' => 'genres_to_events',             'connected_items' => array(1240,1241,1242),             'post_status' => 'publish',             'posts_per_page' => -1,         );          $query = new WP_Query($args);      The thing is that the output checks for each connection in the array, and therefor the output of the query is:   * event1    * event1   * event1    * event2   * event2   * event3   * event3 But I'd like to output each event once based on if it has one or more of the genres connected to it. I don't think this is explained in the documentation, any ideas?


title: Wordpress and WebRTC?

text: I'm pretty new to WordPress and I was wondering about WebRTC integration : user permissions, page integration... I'm especially interested in chat communications (writing and audio, video is not my first concern). At the moment the only available plugins are about video communications and use an external solution (service). Does someone has already addressed this topic and would share some hint ? Thanks


title: clicking on page title

text: In the website I'm looking for something so that I can disable clicking titles in category posts. Just want them to be a simple text not a link one How can I do that? Thanks


title: Get sidebars depending on page

text: Is there a way to get only the sidebars used on a particular page? Using:               global $wp_registered_sidebars;     $widget_map = wp_get_sidebars_widgets();      Can get me all of the sidebars, but I'm interested in getting the sidebars only for a particular page. Something sounding like `get_sidebars_by_page_id()`


title: Proper hook for W3TC defines, or dynamically disable w3 total cache

text: I have a site that uses a shopping cart plugin (Shopp), a plugin I wrote, and W3 Total Cache. In my plugin, I'd like to make sure that W3 Total Cache does not serve any cached pages if the user has any items in their cart, however, I can't seem to find the proper hook to define the constants that will disable W3 Total Cache caching. This is what I have at the very top of my plugin file (the shopp_init function runs during wordpress `init`):               // do not cache anything if items are in cart     add_action('shopp_init', function(){         if (shopp_cart_items_count() > 0)         {             define('DONOTCACHEDB', true);             define('DONOTCACHEPAGE', true);             define('DONOTCACHEOBJECT', true);         }     });      It seems like if the `DONOTCACHEPAGE` constant is detected once for a page, it won't check for it again. So if I have any items in my cart at any point, it'll never cache anything. Likewise, if my cart is empty once, it'll always allow all pages to be cached. How can I dynamically disable w3 total cache?


title: Redirect user if they are not logged in

text: If user enters the url www.abc.com in the browser and he is not logged in, then we want to redirect him to www.abc.com/de. How can I do this within WordPress?


title: get permalink of page children in loop

text:
I have some landing pages that show the page title, feature image and excerpt of their children. The image is linked to the child page, but I need the page title linked to the same place - and I can't figure out how. Here is my existing code - it works perfectly, except the title is not linked. Any recommendations?               <?php while ( have_posts() ) : the_post(); ?>     <?php get_template_part( 'content', 'page' ); ?>     <?php if ( is_page( 'foo' ) ) {         $pageChildren = get_pages( array( 'child_of' => $post->ID, 'sort_column' => 'menu_order', 'hierarchical' => '0' ) );         if ( $pageChildren ) {         foreach ( $pageChildren as $pageChild ) {         echo '

' . $pageChild->post_title . get_the_post_thumbnail($pageChild->ID).'
       ';       if ($pageChild->post_excerpt){       echo '
'.$pageChild->post_excerpt.'

     ';         }         }         }     }     elseif  ( is_page( 'bar' ) ) {         $pageChildren = get_pages( array( 'child_of' => $post->ID, 'sort_column' => 'menu_order', 'hierarchical' => '0' ) );         if ( $pageChildren ) {         foreach ( $pageChildren as $pageChild ) {         echo '

' . $pageChild->post_title .'
       ' . get_the_post_thumbnail($pageChild->ID);       if ($pageChild->post_excerpt){       echo '
'.$pageChild->post_excerpt.'
       ';       } echo '
     ';         }         }     }     ?>     <?php comments_template( '', true ); ?>


title: remove_action("wp_ajax_function", "function"); not working

text: I have the following code in a file called contact-form.php. The file lives here: wp-content/themes/NAMEOFTHEME/ (premium theme)               function theme_contact_form() {        // some code here (send mail when submit a form)     };     add_action("wp_ajax_theme_contact_form", "theme_contact_form");     add_action("wp_ajax_nopriv_theme_contact_form", "theme_contact_form");      All I want to do is remove this function and use my own. So I wrote a plugin which does a `remove_action()` and adds my own:               function extend_contact_submit() {        remove_action("wp_ajax_theme_contact_form", "theme_contact_form");        remove_action("wp_ajax_nopriv_theme_contact_form", "theme_contact_form");        function custom_theme_contact_form() {           // some code here (send email differently)           };        add_action("wp_ajax_custom_theme_contact_form", "custom_theme_contact_form");        add_action("wp_ajax_nopriv_custom_theme_contact_form", "custom_theme_contact_form");     };     add_action('shutdown', 'extend_contact_submit');      Using this plugin I can see the function is hooked and shortly _after_ that removed by my plugin. Everything seems to be fine, BUT: the function is still active. (Because the original email is sent.) Setting `$priority` to `10` has no effect at all... I have no idea what's going on. I'm stuck on this problem for about five hours, googling and trying different approaches like `add_action('after_setup_theme', 'extend_contact_submit');` but none of them worked for me. Might this be caused because my plugin code is executed too early? Or because of using AJAX? I'm really new to PHP, AJAX and writing plugins, so please bear with me! Thanks!


title: Why is wordpress permalink path wrong for single blog posts?

text: I'm developing my site with MAMP and my homepage is at localhost:8888/wordpress When I click on the link to my blog page (home.php) the url looks like this: localhost:8888/wordpress/blog All good so far. However, when I click on a blog post from the home.php template the url looks like this: localhost:8888/wordpress/blogpostname How can I make it so it's localhost:8888/wordpress/blog/blogpostname ? When I changed my permalink settings to localhost:8888/wordpress/%category%/%postname%/ it still left out the /blog in the URL. Why is it doing that and how can I fix it?


title: From where wp ecommerce is loading plugin theme files?

text: I updated my checkout page by updating the file which was in ....wp- ecommerce/wpsc-theme/wpsc-shopping_cart_page.php It worked fine for a while, but now some of the changed states reverted to the previous state. Actually, I can even delete the file that I mentioned above, so it means wordpress is loading this file from somewhere else. Any ideas from where and what had happened? Thanks for your help.


title: Is there a plugin that lets users request an account on the site?

text: Is there a Wordpress plugin that lets users fill in a form to request an account that then has to be cleared/activated by an admin for the user to get access?


title: How to can I search range of products using between

text: I want to show the range of my houses as per size. Ranges will be: 1-50   50-100   100-150   150-200   200-250   +250.   **HTML code**               <select name="size" id="search-type" class="text<?php echo $select_wide; ?>">         <option value=""><?php _e('Size..', TS_DOMAIN); ?>…</option>         <option name="size" value="1">1-50 M2</option>         <option name="size" value="5000">50-100 M2</option>         <option name="size" value="10000">100-150 M2</option>         <option name="size" value="15000">150-200 M2</option>         <option name="size" value="20000">200-250 M2</option>         <option name="size" value="999999">+250 M2</option>          </select>      **PHP code**               // check size custom fields          if($search_get['size'])         $meta_query_size = array(                 'key' => '_size',             'value' => array($search_get['size'],10000),             'compare' => 'BETWEEN',             'type' => 'NUMERIC'         );        Note: If I use the query below, then it works, but not for `between`.               // check size custom fields          if($search_get['size'])         $meta_query_size = array(                 'key' => '_size',                 'value' => $search_get['size'],                 'compare' => '<=',                 'type' => 'NUMERIC'             );        Please advise.


title: Do you clean up your self-written plugins' at deactivation?

text: After developing some plugins for myself, some of them is ready to be published. For all, I've written deactivation functions, which deletes the set options, the database, etc. after themselves. But I'm having doubts about the reason for these, for example, what if it's only a temporary inactivation? What do you think, does a process need a cleanup hook for deactivation or not?


title: get_post_meta not working on category.php

text: I'm referencing an attached image in my header.php page which is displayed as a full screen background on my posts:               global $wp_query;     $page_id = $wp_query->get_queried_object_id();     $background_image = get_post_meta($page_id, 'mb_background_image', true);     $src = wp_get_attachment_image_src($background_image, 'full');      This works fine on single posts, but doesn't work when displaying just one post per page in category.php. How can I fix this? Thanks


title: Display Plugin Panels Outside of Admin Areas

text: I'm trying to find a way to display the work area content of different plugins on pages/posts/areas aside from the admin backend. For example, how would I display the options panel for a certain plugin in a page instead of it's default location? If the plugin also has an output view, like Google Analytics dashboard, how would I call that output content to display in a post? I essentially want to move a lot of the settings and other panels from the admin areas to other locations, or have them display in other locations where they're called. Any pointers on how I might go about that?


title: 301 Redirect all posts urls from .html to / (without .html)

text: How can i redirect all posts permalinks from .html to / ,in Wordpress ? now all my posts url are ending in / ,but before it was with .html to be more clear ,for example a post url like this http://sitename.com/%category%/%postname%.html to be redirected to http://sitename.com/%year%/%monthnum%/%postname%/ . It's simple to redirect them one by one,but i need a rule to redirect all posts . my curent .htaccess               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress          ======      Thank you


title: Enabling XML-RPC Accross 500 blogs

text: How would I update 500 different blogs hosted on separate hosting accounts and enable xml-rpc publishing? We are writing a unified system for our clients who use a customized deployment of WP, allowing them to interact with their blogs from our site.


title: Generating images from an array of categories

text: I'm using the following code to display images based on the category id:               <?php      if (is_category( 'web-design' )){     ?>        <img src="<?php bloginfo('template_directory'); ?>/images/slider_webdesign.png" title="خدمات تصميم وتطوير المواقع" height="200px" width="960px" />     <?php     }else if (is_category( 'printing' )){     ?>     <img src="<?php bloginfo('template_directory'); ?>/images/slider_printing.png" title="تصميم مطبوعات" height="200px" width="960px" />     <?php     }else if (is_category( 'online-marketing' )){     ?>      I would like to make an array of only one condition to display an image with the category slug, is that possible?


title: Insert shortcode in post editor from javascript (Visual / HTML)

text: I want to insert a shortcode in the Wordpress Post Editor from javascript (not a tinymce plugin). I currently use:               tinyMCE.activeEditor.execCommand('mceInsertContent', false, "[SHORTCODE]test[/SHORTCODE] ");      but this only seems to work when the editor is in "Visual" mode (and sometimes activeEditor == null). How do I accomplish this regardless of the state of the editor? (I'd think this is a fairly common scenario)


title: can registration be enabled programatically?

text: I need to allow registration as part of a build for a client, and I am aware this can be turned on in the admin panel, but can I turn it on in the function?


title: Quick login from mobile phone

text: I have a site which is essentially a blog carrying alerts to Doctors. The idea is that the Doctors will get an SMS alerting them to the fact that a new alert has been posted and a link to the alert. The alert will contain images. It is public, hidden from SE but might contain some sensitive info. I was wondering if there was any way of authenticating a user by mobile phone number, or any easy way for a mobile phone user to log in to a Wordpress site?


title: how to add <span> around each author using wp_list_authors

text: how to add span around each author using wp_list_authors, so the result would be like this               author Aauthor B


title: How to create Custom Taxonomy Search Drop Down for specific Post Type

text: I have a number of custom post types which share a custom taxonomy. I'm trying to implement a dropdown search box using php (to insert into a widget or elsewhere) that allows selection of a taxonomy term, and returns the posts which have that term, but only within a specific post type. I'm hoping to then create one of these dropdown search boxes for each post type so a user can easily navigate to posts under a taxonomy term and within a post type. Can anyone assist with this please?


title: Disabling tooltip on menu items

text: For some reason, my menu items are showing tooltips on hover-over- In other words, the menu links have "title" attributes being added to them. Looking at my other, older WordPress sites, this is not the case. I can't remember having this issue before- Why would this be happening? Thanks-


title: How can I allow users to edit text that will be displayed on a custom post type archive page?

text: I like the custom post types Wordpress offers. Most of the time I like the way that the archive of custom posts is displayed. For example if you have a custom post type of `top_hats` you can visit `yoursite.com/top_hats/` if it is set as publicly queryable. I realize that a description can be set for custom post types, but I am looking for something that supports the built in rich text editor. I also realize that you can edit a post-type archive template, something like `archive-top_hats.php`, which could be edited to have a custom message in the top of it - however I am looking for something that will give the user more control. The expected (and ideal) behavior would be if you had the Admin Bar enabled and you were logged into the Wordpress site. Imagine if you visited the `yoursite.com/top_hats/` page and there was the menu bar option that said "edit this page" which made editing that page as simple as editing any other page. If you added a message and then updated the page and viewed it, you would see your content at the top, followed by the `custom_post_type` entries below (in archive format). Seems like that's how it should work, but I really am not sure the ideal way to get that integrated.


title: Enqueue script on every page except one

text: I want to load my javascript and exclude 1 page, so I tried the following without success:               function mypage_scripts()          {     if ( !is_admin() )     {          wp_deregister_script('jquery');         wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js', true, '1.6.2', false);         wp_enqueue_script('jquery');     /* My Script */      if ( !is_page('contact') )             {                        wp_enqueue_script('myscript', get_bloginfo('template_url') . '/js/myscript.js', array('jquery'), '1.1', false);             }     }          }          add_action( 'wp_print_scripts', 'mypage_scripts');      The result is that the script loads on every page except on Admin (as expected) but can't manage to not load on "Contact" page. Any ideas? Of course I can list all the pages I want to load it, but as the site is going to have more pages in the future I don't want to change the functions.php file everytime a new one is created. Thanks.


title: How can I do a variable for meta_query?

text: I have a code which needs a variable compare string               array(             'key' => 'rob_value',             'value' => $rob,             'compare' => '='             )        the compare `=>'=`' needs to be `'='` to get values according a variable data from search form, but sometimes the value is null (empty) and the compare line needs to change to compare `=>'!='` I have tested changing the code manually and it works perfectly. Now I want to do the code change according the values on search form.


title: Multisite pagination with get_posts

text: I'm looking for a way to paginate my get_posts :               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;                     $args = array(                         'posts_per_page'   => 5,                         'offset'           => 0,                         'orderby'          => 'post_date',                         'order'            => 'DESC',                         'post_type'        => 'post',                         'post_status'      => 'publish',                         'suppress_filters' => true,                         'paged'            => $paged,                         );                           $query = get_posts($args);      I've been trying to get this on my own but I did not succeed. Here is my paginate function :               function my_pagination($query = false){     global $wp_query;          if ( !$query ) $query = $wp_query;          $big = 999999999; // need an unlikely integer         echo paginate_links( array(             'base'         => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),             'format'       => '?paged=%#%',             'current'      => max( 1, get_query_var('paged') ),             'total'        => $query->max_num_pages,             'type'         => 'list',             'prev_text'    => __('%s Previous','textdomain'),             'next_text'    => __('Next %s','textdomain'),         ) );     }      I call it in my template with :               if ( function_exists('my_pagination') ) my_pagination($query);      Any help would be much appreciated.