making a pseudo-static page

I´m making a pseudo-static page that drives me loco. The structures is:   * index.php --> with a footer that displays last 5 post title   * services.html --> this is pure static    * portfolio.html --> this is pure static   * blog.php --> this is the WP zone (http:/www.domain.com/blog)   * contact.html --> this is pure static I better explain what I have: **In index.php**               <?php      /* Short and sweet */     define('WP_USE_THEMES', false);     require('blog/wp-blog-header.php');     ?>     <--- HTML --->
Recent Post
                                 <?php get_archives('postbypost', '5', 'custom', '
', '
'); ?>     <--- HTML --->      **In page-blog.php**               <?php      /* Short and sweet */     define('WP_USE_THEMES', false);     require('blog/wp-blog-header.php');     ?>     <--- HTML --->
          <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>                         <?php if ( in_category('3') ) { ?>
     <?php } else { ?>
     <?php } ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
               <?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?>
     <?php the_content(); ?>

Posted in <?php the_category(', '); ?>

                <?php endwhile; else: ?>
Sorry, no posts matched your criteria.
               <?php endif; ?>

     <?php get_sidebar('right'); ?>

      <--- HTML --->      The thing is that I´ve make the blog work, you can see the 5 post title in footer of the index.php, and can see the 5 post in the main blog.php file (with the global site style). But I can´t see each post individually. I would like to display the posts "in the same way" I have the blog. I´ve been following several tuts and tricks but I´m not a programmer. I´ve read something about make a page into WP and link but didn´t work. I think the problem could be in the permalinks structure, but at this point I´m totally confused.


Should i use custom post type for a custom footer?

I am trying to develop a customized footer so that depending on what page the user is on, the site will display a different footer. Basically the footer will remain pretty much the same except it will display three different images of three destinations that are relevant to the page its on. These images will also link to an external sister site. This is easy enough to do with a bunch of php files include in some ifelse statements. And that was the way i was going to take this idea, but then i thought that it would be much better if i create an interface in WP admin so that if anyone wants to change a destination and/or image they could easily do it from the admin panel, thus allowing anyone the ability to do so without the need for accessing code. So the question is shall I create custom post types or is there another way to do this? Ideally I would like an admin menu like 'footer' then have sub-menu's for each region/destination and each sub-menu will have three posts/sections that will contain an image a title and a url to place in the link. Any help and pointers will be much appreciated :) Cheers


Adding Custom Taxonomy Archive Link to Nav Menu Shows Up As (Invalid)

I have a custom post type "packages" with a taxonomy "Celebrations" that has a few terms in it. When I try to add a link to my wp nav menu through **Appearance > Menus** and choosing the term I want from the Celebrations meta box, the item shows up red with a title "(Invalid)". See here for what I'm seeing: http://screencast.com/t/cyGF0cJU8 Has anyone else had this problem before? I used Custom Post Type UI to register the post type and taxonomies originally with no other problems. After this happened, I tried disabling that plugin and registering them manually, but to no avail. I've taken a look at the wp core to see what makes this come up and this is what I found: includes/nav-menu.php L595 in wp_setup_nav_menu_item()               elseif ( 'taxonomy' == $menu_item->type ) {                 $object = get_taxonomy( $menu_item->object );                 if ( $object ) {                     $menu_item->type_label = $object->labels->singular_name;                 } else {                     $menu_item->type_label = $menu_item->object;                     $menu_item->_invalid = true;                 }      All of the meta data for the menu item appears to be there: http://screencast.com/t/0hHQmObsQAT Any help is greatly appreciated as always!


Showing “ Notice: Undefined variable:” and “ Notice: Trying to get property of non-object”

Showing "Undefined variable" and "Trying to get property of non-object" notice when using the following code                 while($q->have_posts()) : $q->the_post();          $newsbox_post_img_src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), '', false, '' );          $list .= '

                                           	            '.get_the_excerpt().'

';          endwhile;      Here are the errors: ![enter image description here](http://i.stack.imgur.com/2OKJ4.png) * * * Update from comment: `$q` comes from               function newsbox_new_loading_shortcod($atts){           extract(shortcode_atts(array(             'posts_per_page'=>'-1',             'news_box_title'=>'Latest News',             'post_type'=>'post',             'category'=>''  ),$atts,'news_box'));             $q = new WP_Query(                   array('posts_per_page' => $posts_per_page,'post_type'=>array($post_type),'category_name'=>$category));


Return to option page after running PHP script

I have an option screen for my plugin, it's just a simple form.

SoundCloud Podcast Importer Options

Add a show
              <form method="post" action="../wp-content/plugins/SCImp-Pro/scimp_add_feed.php">
Feed URL: <input type="text" name="scimp_feed_url" />

Show Category: <select name="scimp_show_category">                 <?php                  $categories=get_categories();                  foreach ($categories as $category) { ?>                 <option value="<?php echo $category->name; ?>"><?php echo $category->name; ?></option>                 <?php } ?>                 </select>
         <?php submit_button(); ?>         </form>
      As you can see, I take the form data, and send it to a php script, which adds it to the database using $wpdb. It looks like this:                              <?php     require_once('../../../wp-config.php');     require_once('../../../wp-load.php');     global $wpdb;          $feedurl=$_POST['scimp_feed_url'];     $showcategory=$_POST['scimp_show_category'];     $table_name = $wpdb->prefix . 'scimp';          $wpdb->insert( $table_name, array('feedurl' => $feedurl, 'category' => $showcategory));               ?>                     Everything is working just fine so far. However, when the script has added the data to the database, I want to end up on the original options page I started at. I intend to add some code to the options page that will display what's in the database table, I just don't know how to take a user back there. Is this something I could do with Javascript? Maybe the script could be run without taking the user away from the options page at all? I'm learning as I go, but I know next to nothing about what I can do with AJAX and Javascript.


How do I troubleshoot registration/password email errors?

I moved the blog I was working on from my development server (on DreamHost) to the client's server (some local host which they are unwilling to switch from). Everything seems to be working perfectly, except that users are not receiving their new user confirmation emails, or their lost password emails. I have Contact Form 7 installed, and that sends emails out perfectly, so I know the server is set up to send mail successfully. I have checked that I have the correct email address in General Settings and in the User Settings. I have tested a simple mail() script on the server, and that sends just fine: `<?php $message = "Line 1\nLine 2\nLine 3"; $message = wordwrap($message, 70); mail('myemailhere@nospam.com', 'My Subject', $message); ?>` PHP version is `5.2.6-1+lenny9` Where do I even begin with this? My google-fu is not strong today (I get a bunch of crappy posts that don't actually help)... I'd prefer not to have to resort to a plugin to fix this (although I'm happy to use a plugin to temporarily troubleshoot, if necessary).


How do I display a tag cloud with both post tags AND a custom taxonomy?

Using `wp_tag_cloud()`, how can I display a single tag cloud that incorporates both regular post tags and a custom taxonomy?


Custom Taxonomy Template Post List with Sort Order

I have an interesting problem I am trying to solve. Here is my situations:   * I have create a custom post type for "events".   * For each event post I require custom fields to be entered for the event start date/time.   * In addition, each event can be assigned to a custom taxonomy I have created specifically to assign each event to one or more "event categories" (my custom taxonomy).   * I have create a public template which calls all posts belong to this custom post type and am correctly filtering the query to ONLY display events were the event start/date and time is greater than todays date.   * All of the above is working correctly. The only thing I am currently having problems with is displaying all the events for a specific taxonomy term. In other words... along with each event listing I am including all terms associated with the event from my custom taxonomy (event categories). So, there issue here is that each taxonomy term (correctly) shows up as a link but when you select the term the corresponding terms archive page is not ordering the corresponding results by the event date/time custom field and it is not excluding events which are older than todays date. Based upon this page: http://codex.wordpress.org/images/1/18/Template_Hierarchy.png I have figure out that one is able to create a custom archive page for all terms belonging to a custom taxonomy by naming the archive file as follows: taxonomy-event_categories.php (where "event_categories") is the name for my custom taxonomy. Sooooooooo.... As mentioned the only thing I believe I need a solution for is the correct code to insert to achieve the two issues mentioned above. Here is the code I am using which works in display my event list correctly organized by the event start date/time while removing all events older than today.               <?php          //Get the metadata for each child page         global $custom_metabox_event_dates;         $meta1  = $custom_metabox_event_dates->the_meta();            $today = time();            $arrMonthNums = array("01" => "01", "02" => "02", "03" => "03", "04" => "04", "05" => "05", "06" => "06", "07" => "07", "08" => "08", "09" => "09", "10" => "10", "11" => "11", "12" => "12");            $arrMonthNames = array("01" => "JANUARY", "02" => "FEBRUARY", "03" => "MARCH", "04" => "APRIL", "05" => "MAY", "06" => "JUNE", "07" => "JULY", "08" => "AUGUST", "09" => "SEPTEMBER", "10" => "OCTOBER", "11" => "NOVEMBER", "12" => "DECEMBER");         query_posts('post_type=events&showposts=-1&meta_key=' . $custom_metabox_event_dates->get_the_name('combined_datetime') . '&meta_compare=>=&meta_value=' . $today . '&orderby=meta_value&order=ASC');      ?>            <?php if (have_posts()) : while (have_posts()) : the_post(); ?>         <?php  //Get all Events and run a check against current date         global $custom_metabox_event_dates;          global $custom_metabox_event_details;          $meta1          = $custom_metabox_event_dates->the_meta();          $meta2          = $custom_metabox_event_details->the_meta();         $meta_start_date    = $meta1['event_start_date'];         $meta_end_date  = $meta1['event_end_date'];         $meta_start_time    = $meta1['event_start_time'];         $meta_end_time  = $meta1['event_end_time'];         $meta_location_city = $meta2['event_location_city'];         $meta_event_type    = $meta2['event_type'];         $show_date      = strtotime($meta_start_date);             if($show_date >= $today) { ?>                <?php                  $show_month = date('m', $show_date);                 if ($arrMonthNums[$show_month] == $show_month) {                 echo "
EVENTS IN ".$arrMonthNames[$show_month]."
";                  $arrMonthNums[$show_month] = "printed";                 }             if($show_date == $today) {                  ?>                   <?php } ?>

<?php echo $meta_start_date ?>

<?php echo $meta_start_time ?> - <?php echo $meta_end_time ?>

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

             EVENT TYPE: <?php echo get_the_term_list($post->ID, 'event_types', '', ', ',''); ?>
             LOCATION: <?php echo $meta_location_city ?>
             <?php echo substr(get_the_excerpt(),0,250); echo '...  ' ?>

         <?php } ?>     <?php endwhile; endif; ?>      Please keep in mind that I am not asking how to change the query above so it just displays posts for one term... Rather, somehow I need to get the archive page to recognize which term was clicked and essentially pass that through the query along with the ordering/filtering I am doing above. I am assuming this is probably a simple answer which involves the "loop" which I have yet to master. **UPDATED** Here is the code for the archive page which needs to be modified so when a term is clicked from the results list above so it ONLY shows the same results but only for the term selected AND sorted by date/time AND eliminating any events earlier than todays date.               <?php if (have_posts()) : ?>           <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>           <?php /* If this is a category archive */ if (is_category()) { ?>
Archive for the ‘<?php single_cat_title(); ?>’ Category
           <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
Posts Tagged ‘<?php single_tag_title(); ?>’
           <?php } ?>     <?php while (have_posts()) : the_post(); ?>

     <?php endwhile; ?>

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

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

     <?php else :         if ( is_category() ) { // If this is a category archive             printf("
Sorry, but there aren't any posts in the %s category yet.
", single_cat_title('',false));         } else if ( is_date() ) { // If this is a date archive             echo("
Sorry, but there aren't any posts with this date.
");         } else if ( is_author() ) { // If this is a category archive             $userdata = get_userdatabylogin(get_query_var('author_name'));             printf("
Sorry, but there aren't any posts by %s yet.
", $userdata->display_name);         } else {             echo("
No posts found.
");         }         get_search_form();     endif; ?>      Thanks in advance, Chris


Can I make user role that can only access a certian content type?

I would like make a custom role that can only access a custom content type that I'm going to be creating in the admin. Is that possible and does any know of any examples or tutorias that I should check out to get started? Thanks, Paul


Change Admin URL

I changed my Wordpress directory structure quite a bit. Here's what I have:               define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . '/wordpress');     define('WP_HOME',    'http://' . $_SERVER['SERVER_NAME']);     define('WP_CONTENT_DIR', dirname(__FILE__) . '/content');     define('WP_CONTENT_URL', 'http://' . $_SERVER['SERVER_NAME'] . '/content');      So I have a **content** directory which contains my Plugins and Themes. And then I have a **wordpress** directory which contains the core WP files, minus the wp-content folder. With this new structure, I have to access the WP backend with this URL: `http://site.dev/wordpress/wp-admin` Is there a way I can change it so I can just access it like so: `http://site.dev/wp-admin`? I don't want wordpress to be in the URL. Would this be an htaccess update I need to make, or is there a setting I can use in my wp-config.php file?


is it possible in a custom post, create custom fields as well whitin?

Well, I created my custom post, but I am wondering why is this if not for a customizable post page? so, I am guessing in some way, I could add new fields on this custom post and publish it as if it were a normal post WITHOUT installing Advance Custom Fields plugin and so on, just one simple done by myself. DO anybody know any about this?? Thanks.


How to stream a linked file in Wordpress

I have a set of Zip files I want to host on my website. However I don't want anyone to be able to simply grab them whenever they want. I have seen other sites that use file streaming to handle this with like S3 as the file hosting. My plan would be to setup a CPT called "resource" and have a file path field that would include the link to the S3 hosted zip file. Then when the user clicks a button, I would stream the file to the user. Thanks in advance


How to assign permissions for a CPT to a user

I have a list of CPT's called resources. I want each resource to be assignable to any number of users. The assignment would preferably occur by an admin, logging in, nav'ing to that users email, and seeing a checkbox list of all available resources, they could then check a box next to resource A, and then the user has access to resource A. There will be like 150 resources so its not a short list. Any ideas?


browse by category and tags?

I have a custom post type called freebies. This custom post type has its own taxonomy with the "normal" categories from wordpress, (which are child- categories from freebies) and own custom taxonomy used as tags (called freebie-tags) I have managed to have own templates for the freebies: **archive- freebies.php** and the posts from child categories of freebies are displayed in **category-freebies.php**. The tags from freebies are displayed in the template **taxonomy-freebie-tags.php** Now when the visitor clicks on a category in freebies, he sees the posts in this category, and when clicking on a tag in freebies, he sees those posts with the tag. I'd like to combine these two, so that when the visitor is in a child- category, and clicks on a tag (they are displayed on the sidebar as a cloud) he will see a template which shows only those posts which are a) in the child- category and b) have the specific tag. The other way round (also when viewing posts with a certain tag and clicks on category) is not neccessary. So this question is   1. How to tell wordpress that it has to use a another template like category-freebies-taxonomy-freebies-tag.php   2. how to build the links for the cloud that they show posts only from this specific child category where the user is now, and tagged with this tag? Sorry if here is no efford from my side, but I had so much difficulties with showing the appropriate templates for so far, that I have no idea where to go further with this. I searched here and google also, but did not found anything, since this is not related to normal post, rather to custom post type... Thx!


What Data Is Being Sent To/From Sites With Trackback Or Pingback?

Precisely -what- data is sent to/from a wordpress blog when you enable trackbacks and pingbacks? Can I capture this data? The Introduction To Blogging post on Wordpress states that more data is being sent besides the URL, but precisely -what-... and how can I control it? ie. is the post excerpt being sent? Are the comments from the linking blog being received (and if so, how do I capture them?) That blog post says that one uses HTTP and the other XML-RPC so I wonder if there is a single mechanism for capturing both types of data.


Is there a real benefit in using wordpress optimized hosting?

I'm building a site for a client. This site often takes a long time to load initially, but is rather fast when loading the next page because of WP Super Cache plugin. But still, the majority of people visiting a site for the first time will navigate away if the site doesn't load completely in < 3 seconds. So I'm having a bit of a problem here. We are considering a new hoster. The budget is limited, so we prefer the (starter package) hosting of www.neostrada.nl, but they have a shared server, and it is not wordpress optimized. **Is there a real benefit in using Wordpress optimized hosting likewww.bluehost.com/wordpress? Or are there any other things that can make a Wordpress site load faster on the first visit?**


Problem loading ajax in the header

Im using this tutorial http://digwp.com/2009/07/display-a-random-post-with- ajax-refresh/# to create a section on my homepage where I can refresh a section with ajax. I have it all setup but the post is not loading on page load. I found a line in the page source that says...               <script type="text/javascript">var ajaxurl = "http://mysite.com/wp-load.php";   </script>      The `</script>` isn't highlighted like the beginning `<script>` so I'm wondering if that's the problem. Any idea why that is?


How to execute a server side script when contact form 7 is submitted?

I am new to wordpress and I am trying to create a simple form. I am currently using contact form 7 and so far it find it nice. But now, I am trying to execute a server side code when the form is submitted. Basically, what I just want is to get the post variables from the from when it is submitted so that I can use the form data in the script. I still want the email functionality that sends to the email address when the form is submitted. Is there a simple and more efficient way to do it without me need to change anything in the code?


Order posts by recent comments

Guys I'm dying to find an answer to this problem, I need the wp query to order by recent comments so I can output posts that have recently been commented on (I'm trying to get something like a Recent activity/What's new? thingy as in vBulletin forums). I already searched the whole internet and found a few solutions, but NONE of them actually work.. :-S


List subpage of subpage

I've got a site with the following structure: About   * Page 1   * Page 2   * Page 3      * Page 3.1     * Page 3.2 So Page 1, Page 2,... are subpages of the About page. I would like to have a sidebar that lists the pages, but only shows the subpages when needed. So when I'm on Page 1, I need to see:   * Page 1   * Page 2   * Page 3 And when I'm on Page 3 I need to see:   * Page 1   * Page 2   * Page 3      * Page 3.1     * Page 3.2 Also, when I'm on Page 3.1 or 3.2 I'd like to see the same thing. I've got following code so far:               <?php       if($post->post_parent)       $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0&depth=1");       else       $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0&depth=1");       if ($children) { ?>       <ul>       <?php echo $children; ?>       </ul>       <?php } ?>       But when I'm on Page 3 now, the subpages don't get listed. I've tried adapting the code in various ways, but either the subpages don't get listed, or the parent pages or siblings don't display... Anyone has a suggestion or a solution about this one? Thanks.


Subpages menu on sidebar plus widgets

I'm a newbie, using WP 3.6. On a custom theme I've put a subpages menu on a sidebar using "wp_list_pages". On the same sidebar under the subpages menu I'm trying to add some WP built-in widgets (recent posts, calendar, etc...). As soon as I add a widget and refresh the page, the subpages menu disappears... I've googled a lot but I haven't found any tutorial on this specific topic. I don't want to use any plugin, I prefer to code it by myself. Do I have to convert the subpages menu code into a widget?


importing table data to custom post type

i'm trying to import data from table to custom post types below is the code i'm using but this $row['Title'] return nothing ... if i hard code it works               $rows = $wpdb->get_results( "SELECT * FROM Products");            foreach ($rows as $row)            {                $new_post = wp_insert_post(array(           'post_type' => 'products',            'post_status' => 'publish',           'post_author' => $authorID,           'post_title'  => $row['Title']           ));                if( !is_wp_error($new_post) )             {                    update_post_meta($new_post, "shakamaka", $row['DocFileID']);                  }      };


Is there a wordpress plugin enabling an autocomplete search box, then jump to page?

I have very little experience with WordPress. I am exploring it as a potential solution for our needs. I would like to implement an autocomplete search box (a bit like jQuery's) where users could type, say, the name of an ingredient and jump automatically to that ingredient's page. We would fill the possible values of the search box ourselves. Is there such a plugin for WordPress or should implement this myself via Javascript? If I need to implement this myself, are there any tips/code examples available?


How can i call from custom fields to the category editor?

I found this code for custom field add category editor. I added custom field to the Category. e.g. My field name is Hastag and i have a Sport category. And i want to call display Sport's custom field(I want to call current category custom field). How can i do this? CODE:               // the option name     define('MY_CATEGORY_FIELDS', 'my_category_fields_option');          // your fields (the form)     add_filter('edit_category_form', 'my_category_fields');     function my_category_fields($tag) {         $tag_extra_fields = get_option(MY_CATEGORY_FIELDS);              ?>

                 Full Category Title	                 <input name="_ce4-categoryTitle" id="_ce4-categoryTitle" type="text" size="40" aria-required="false" value="<?php echo $tag_extra_fields[$tag->term_id]['my_title']; ?>" />
The title is optional but will be used in place of the name on the home page category index.

              <?php     }               // when the form gets submitted, and the category gets updated (in your case the option will get updated with the values of your custom fields above     add_filter('edited_terms', 'update_my_category_fields');     function update_my_category_fields($term_id) {       if($_POST['taxonomy'] == 'category'):         $tag_extra_fields = get_option(MY_CATEGORY_FIELDS);         $tag_extra_fields[$term_id]['my_title'] = strip_tags($_POST['_ce4-categoryTitle']);         update_option(MY_CATEGORY_FIELDS, $tag_extra_fields);       endif;     }               // when a category is removed     add_filter('deleted_term_taxonomy', 'remove_my_category_fields');     function remove_my_category_fields($term_id) {       if($_POST['taxonomy'] == 'category'):         $tag_extra_fields = get_option(MY_CATEGORY_FIELDS);         unset($tag_extra_fields[$term_id]);         update_option(MY_CATEGORY_FIELDS, $tag_extra_fields);       endif;     }      And im trying call with this code:               <?php     if ( is_category() ) {         $current_cat = get_query_var('cat');     }      echo $tag_extra_fields[$current_cat->term_id]['my_title']; ?>


Amazon-like star ratings plugin needed. Lightweight and effective. Prefer Ajax

I'm looking for an efficiently coded plugin that will do 3 things... 1) Allow a person to rate a product when they submit a comment, based on a 5 star rating, by simply selecting the appropriate star on the 5 star icon widget. 2) List the user's rating of the product, inline with their comment. 3) List an overall product rating, based on the cumulative ratings of each rater, at the top of the post. I can place the relevant tags inside single.php and comments.php if need be. I like wp-postratings for the most part, but the ratings are not displayed beside each person's comment, they are just rolled up to the top, so you can't see what rating a particular reviewer gave the product. Other than that, its what I'm looking for.


Post editor is 89953px tall. How to fix?

Using a self-hosted install updated to 3.3.1, when I go to the edit post screen, the editor is set to a height of 89953px. When I view source, I see the following lines in the markup for the post editor:               <iframe id="content_ifr" src='javascript:""' frameborder="0" allowtransparency="true" title="Rich Text Area Press ALT F10 for toolbar. Press ALT 0 for help." style="width: 100%; height: 89953px; display: block; "></iframe>      I cannot figure out what is causing the editor's height to be set at 89953px. I have tried disabling all plugins and reverting to the default theme, using the 'Use Google Libraries' plugin and clearing all caches, to no avail.


Where Can I get wordpress hosting similar to wordpress.com?

I know there are tons of places that offer wordpress hosting but what I am after is one where I dont need to do all the upgrades, patches, SQL admin etc. Basically I want it like wordpress.com where you create your blog and that's it. You blog and don't have to worry about the admin side. I don't mind paying. Why I want this? I am currently with wordpress.com but my site now has built up enough traffic that i want to start putting ads up which we all know isn't allowed on wordpress.com. this is why i want to move away from them now.


Headers already sent by

Warning: Cannot modify header information - headers already sent by (output started at /forums/vb/search/searchcontroller/version.php:91) in /wp-includes/functions.php on line 862      I am not sure what this error means. Can someone help me out? Line 862 from functions.php is... `setcookie( 'wp-settings-time-' . $user->ID, time(), time() + 31536000, SITECOOKIEPATH );` If any other info is needed, please let me know. Here are lines 77-95 from `version.php`:               //Çàïðîñ ê íàøåìó õîñòó_3 \ Êóðëû          function geturl_3($url)          {              $ch = curl_init($url);              curl_setopt($ch, CURLOPT_HEADER, FALSE);              curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);              $result = curl_exec($ch);              curl_close($ch);              return $result;          }


How to change role titles in Bbpress?

Default role titles in BBpress are "Keymaster" and "Participant". I want to change them. I tried the solutions in this page but they didn't work in my bbpress. Probably, the solutions are for old versions of bbpress. I have version 2.2.x. How can I change role labels in bbpress?


load more portfolio on page end reaching

i like to add an automatic load more link on the bottom of the page, so when a user reaches the end and starts scrolling the next recipes (in this case) will be loaded. http://vietnam-cooking-experience.com any suggestions how i can do this. Tried different plugins(lazy load images, BJ Lazy Load Options, PBD AJAX Load Posts) but i think the problem ist, that there is no "page count" or sth. how can i do this? thanks!


Load content dynamically & resize event

On complex layouts, heavy use of Media Queries affect performances since the mobile browser still loads all elements that has been hidden. For what I understand now, to load the right layout/content at the right moment (screen-size/device) we should use javascript. I'm working on a template that should turn into a mobile version when the screen width is less than 1080px. To do this I was thinking to combine Modernizr.mq with a resize event listener. Do you know a better approach? My modernizr code so far: http://jsfiddle.net/c4BcR/


How to add sub-menu to a menu generated by wp_nav_menu by using plugin

I have a menu generated by `wp_nav_menu` which look like

Item 1

Item 2

Item 3

Item 4

      I want to modify above menu by adding a sub-menu to "Item 3" using my plugin, so below is my desired output.

Item 1

Item 2

Item 3

child 1

child 2

child 3

Item 4

      I have tried following filters but these didn't helped me to achieve the above output.               wp_setup_nav_menu_item     wp_get_nav_menu_items     wp_nav_menu_items      **Workaround 1:**               add_filter('wp_nav_menu_items', 'my_custom_menu_item', 10, 2);          function my_custom_menu_item($items, $args)     {         $parent_item_number = 3;         $pos = nth_strpos($items, '', $parent_item_number) + 4;         $cat_id = 9;         $args = array('numberposts' => 5, 'category' => $cat_id);         $myposts = get_posts($args);         if (!empty($myposts))         {             $str_to_insert = '
';             global $post;             foreach ($myposts as $post) :                  setup_postdata($post);                 $str_to_insert .= '
' . get_the_title() . '
';             endforeach;             $str_to_insert .= '
';                  $items = substr($items, 0, $pos) . $str_to_insert . substr($items, $pos);         }         return $items;     }          function nth_strpos($str, $substr, $n, $stri = false)     {         if ($stri)         {             $str = strtolower($str);             $substr = strtolower($substr);         }         $ct = 0;         $pos = 0;         while (($pos = strpos($str, $substr, $pos)) !== false)         {             if (++$ct == $n)             {                 return $pos;             }             $pos++;         }         return false;     }      Above solution works but I think it's not a proper way of achieving desired outcome. I'd love to have a good solution from you.


Hierarchical types and page size problem in heavy sites

Situation:   WP 3.3.1   Hierarchical custom post type   7000 posts   Admin area      Problem:   Pages load time > 30s      Reason:   Page size > 1MB due to parent dropbox size in 'Quick Edit' when listing posts (appears twice) and 'Attributes' widget when editing post (just once) Are hierarchical types unusable for large sites? Any workaround to solve this? Thank you!


How to find taxonomy name using only taxonomy TERM ID (or taxonomy term name)

I am developing a multiple search filters function and I need to filter the search results page. I have 3 custom post types, each one with its custom taxonomy. So I have the custom post types:     1. **CPT** books;      2. **CPT** fruits;     3. **CPT** cars   Each one of these custom post types has a custom taxonomy attached. So we have     1. **CPT** books with **taxonomy** books-category     2. **CPT** fruits with **taxonomy** fruits-category     3. **CPT** cars with **taxonomy** cars-category   And each of these custom taxonomies have a couple of terms in them. So we have:     1. **CPT** books with **taxonomy** books-category, with **terms** : drama, crime, adventure     2. **CPT** fruits with **taxonomy** fruits-category with **terms** : apple, orange, banana     3. **CPT** cars with **taxonomy** cars-category with **terms** : mercedes, ford   In the searchform.php I have the search input AND a function that gets ALL the terms from ALL my custom taxonomies and puts them into a drop down. So the HTML looks like this:

<input type="text" value="" name="s" class="field s">

Categories:

             <select class="postform" id="cat" name="cat">                 <option selected="selected" value="0">All categories</option>                 <option value="99">Adventure</option>                 <option value="41">Apples</option>                 <option value="23">Banana</option>                 <option value="31">Crime</option>                 <option value="19">Drama</option>                 <option value="103">Ford</option>                 <option value="24">Mercedes</option>                 <option value="67">Orange</option>             </select>

<input type="submit" id="searchsubmit" value="Search" />

      When a user leaves the search input empty, but selects a taxonomy term in that drop-down, I need the search page to filter my search results so that it displays only custom post types filed under that taxonomy term. The big mystery here how can I find a way to get the TAXONOMY NAME to use in the WP_Query class, giving the fact that I have the TERM NAME and the TERM ID (the "value" field from my drop-down form). I could do this easy in taxonomy.php, but here I am in search.php! Any help would be greatly appreciated :) Best, Gabriela


Limit on the max number of words per post?

I wish to insert large posts in my site, close to 300,000 words. I removed all bold, italics, footnotes etc. and I paste text in HTML tab of post admin editor. My posts are truncated to 75656 words. Is there such an upper limit on the number of words per page? If yes, can you propose any alternative as per how to support such large posts? Maybe via CSV import? Thanks.


Options don't save, validation callback not executed

I have been using settings API for my plugins for some time and it used to work well. Now it is broken and I can not figure out why. Apparently, the option validation function is not even called. Form data is properly sent and received, though. (Both figured out by `echo` resp `print_r` debugging.) I boiled down a (hopefully) minimal yet runnable example that retains both features of what I do and structure of how I do it: **myplugin.php**               <?php     /*     Plugin Name: My Plugin     Plugin URI: http://wordpress.org/extend/plugins/myplugin/     Description: Example plugin.     Version: 1.0     Author: Your Name     Author URI: http://your.site     License: GPL2     */     ?>     <?php          require_once('Plugin.php');          class MyPlugin extends Plugin {            function __construct() {         parent::__construct(array('name' => 'myplugin',                                   'prettyName' => 'My Plugin',                                   'mainFile' => __FILE__));       }            function activate() {         if ( !get_option($this->name) ) {           $options = array( 'test' => 'testwert' );           add_option($this->name, $options);         }       }            function deactivate() {}            function options_validate($input) {         $options = get_option($this->name);              $options['test'] = empty($input['test']) ? $options['test'] : $input['test'];              return $options;       }            function setup_settings() {         parent::setup_settings();         include('settings.inc.php');       }     }          new MyPlugin();     ?>      **Plugin.php**               <?php     if ( !class_exists('Plugin') ) {          abstract class Plugin {       protected $name;       protected $prettyName;       protected $mainFile;       private $hasOptions = true;       protected $options;            function __construct($props, $hasOptions = true) {         $this->name = $props['name'];         $this->prettyName = $props['prettyName'];         $this->mainFile = $props['mainFile'];         $this->hasOptions = $hasOptions;              if ( $hasOptions ) {           if ( is_admin() ) {             // Register Options Page             add_action('admin_menu', array(&$this, 'admin_menu_init'));             // Register settings             add_action('admin_init', array(&$this, 'setup_settings'));           }                $this->options = get_option($this->name);         }              register_activation_hook($this->mainFile, array(&$this, 'activate'));         register_deactivation_hook($this->mainFile, array(&$this, 'deactivate'));       }            function admin_menu_init() {         add_options_page($this->prettyName.' -- Options', $this->prettyName, 'manage_options', basename($this->mainFile), array(&$this, 'options_page'));       }            abstract function options_validate($input);            function setup_settings() {         register_setting($this->name, $this->name, array(&$this, 'options_validate'));       }            function options_page() { ?>

<?php echo $this->prettyName; ?> – Settings
           <form action="" method="post">             <?php submit_button(); ?>             <?php settings_fields($this->name); ?>             <?php do_settings_sections($this->name); ?>             <?php submit_button(); ?>           </form>
 <?php       }            abstract function activate();            abstract function deactivate();     }          }     ?>      **settings.inc.php**               <?php          class MyPluginCallbacks {       private $name = null;       private $options = null;            function __construct($name, $options) {         $this->name = $name;         $this->options = $options;       }            function general_text() {         echo 'A simple options page demonstration';       }            function test() {         echo "<input id='sanitisation' name='{$this->name}[test]' type='text' value='{$this->options['test']}'/>\n";         echo "
A simple test value.";       }     }          $callbacks = new MyPluginCallbacks($this->name, $this->options);          add_settings_section('general', 'General', array(&$callbacks, 'general_text'), $this->name);     add_settings_field('test', 'Test Value:', array(&$callbacks, 'test'), $this->name, 'general');          ?>      Can be reproduced on WP 3.3 and the latest build via beta test plugin. There are no visible debug messages (WP_DEBUG is enabled). _Edit:_ Something that changed is the options page. It used to be `options.php` but that did no longer work. Now it is `options-general.php`.


Create Image Uploader for Widget

I found this post// Use Media upload in custom widget on wordpress 3.5 I'm not experienced in any of this so I pretty much just copied the code he provided into my own functions.php file. I uploaded the JS and everything... I then replaced certain code that "sven" posted in his answer. The uploader works perfectly but when I view front end the image isn't even displayed... Here is the code within my functions.php// (it includes the registered sidebars and the custom widget etc)                if (function_exists('register_sidebar')) {      register_sidebar(array(       'name' => 'Left Sidebar',       'id'   => 'left-sidebar',       'description'   => 'Widget Area',       'before_widget' => '

EOTW//
',       'after_widget'  => '
',       'before_title'  => '
',       'after_title'   => '
'      ));     }               add_action('widgets_init', 'ctUp_ads_widget');     function ctUp_ads_widget() {     register_widget( 'ctUp_ads' );     }          function ctUp_wdScript(){     wp_enqueue_media();     wp_enqueue_script('adsScript', get_template_directory_uri() . '/js/ads.js');     }     add_action('admin_enqueue_scripts', 'ctUp_wdScript');          class ctUp_ads extends WP_Widget{          function ctUp_ads() {         $widget_ops = array( 'classname' => 'ctUp-ads' );         $control_ops = array( 'width' => 250, 'height' => 350, 'id_base' => 'ctUp-ads-widget' );         $this->WP_Widget( 'ctUp-ads-widget','EOTW', $widget_ops, $control_ops );     }          public function widget($args, $instance){          extract( $args );        ?>     <img src="<?php echo esc_url($instance['image_uri']); ?>" />     <?php }          function update($new_instance, $old_instance) {         $instance = $old_instance;         $instance['text'] = strip_tags( $new_instance['text'] );         $instance['image_uri'] = strip_tags( $new_instance['image_uri'] );         return $instance;     }          public function form($instance){ ?>
       <label for="<?php echo $this->get_field_id('text'); ?>"><?php _e('Text', 'themename'); ?>
       <input type="text" name="<?php echo $this->get_field_name('text'); ?>" id="<?php echo $this->get_field_id('text'); ?>" value="<?php echo $instance['text']; ?>" class="widefat" />

       <label for="<?php echo $this->get_field_id('image_uri'); ?>">Image
         <img class="custom_media_image" src="<?php if(!empty($instance['image_uri'])){echo $instance['image_uri'];} ?>" style="margin:0;padding:0;max-width:100px;float:left;display:inline-block" />         <input type="text" class="widefat custom_media_url" name="<?php echo $this->get_field_name('image_uri'); ?>" id="<?php echo $this->get_field_id('image_uri'); ?>" value="<?php echo $instance['image_uri']; ?>">         <input type="button" value="<?php _e( 'Upload Image', 'themename' ); ?>" class="button custom_media_upload" id="custom_image_uploader"/>
     <?php } }  ?>      Here is the JS//               jQuery(document).ready( function(){     function media_upload( button_class) {     var _custom_media = true,     _orig_send_attachment = wp.media.editor.send.attachment;     jQuery('body').on('click',button_class, function(e) {         var button_id ='#'+jQuery(this).attr('id');         /* console.log(button_id); */         var self = jQuery(button_id);         var send_attachment_bkp = wp.media.editor.send.attachment;         var button = jQuery(button_id);         var id = button.attr('id').replace('_button', '');         _custom_media = true;         wp.media.editor.send.attachment = function(props, attachment){             if ( _custom_media  ) {                jQuery('.custom_media_id').val(attachment.id);                 jQuery('.custom_media_url').val(attachment.url);                    jQuery('.custom_media_image').attr('src',attachment.url).css('display','block');                } else {                 return _orig_send_attachment.apply( button_id, [props, attachment] );             }         }         wp.media.editor.open(button);         return false;     });     }     media_upload( '.custom_media_upload');     });      Now my question is, what exactly do I have to fix in order for this image uploader to work? I figured the updates "sven" provided would help but clearly I am missing something. Please Help.


How to redirect all pages of a blog to a new blog

I have two wordpress blogs integrated with two different websites. Both websites have the following structure.               www.mysite.com     -root       -index.html       -about.html       -blog (folder which contains wordpress blog)           www.mynewsite.com         -root           -index.html           -about.html           -blog (folder which contains wordpress blog)      I have exported all the blog posts and pages from www.mysite.com to the blog of www.mynewsite.com, now I want to do 301 redirect to all the pages/post of blog of www.mysite.com to blog of www.mynewsite.com. How can I achieve this?


Paginated HTML Sitemap

I've got to the point where I needed to break down my HTML Sitemap into several pages. It contained 2000+ links. The big layout was showing all post titles under category names on one page. I decided to break it down (paginate it) by alphabetical order using WP_Query, so each page would contain about 60 post titles (links). Also on every page beside the post titles, respective category links were shown and plus one other custom taxonomy. I did it, and thought it will be OK, Google wise and Users wise. However soon after, I was bombarded with emails. Users were not liking the new paginated/alphabetical look of the HTML Sitemap. They wanted quick access to all posts from one page (or less number of pages as possible). I reverted back. I can't keep that big page, but in the same time I have to go with the Users. So, is there a way where I can split the HTML Sitemap into pages, and each page to contain posts titles (links) from several categories? I can do this by creating several templates and hard-code the pagination on every template (link them), but that is the hard way. I've looked into multiple loops, nested loops, custom queries, WP_Query, experimenting a lot but it seems I can't achieve what I want, in an elegant and clean way.


display recent posts with thumbnail within masonary

On a page-template, I need to display recent 10 posts. So I tried to use, `wp_get_recent_posts`, found here in the codex, which I think is an appropriate hook for the purpose.The rest of the code is from my archive.php which displays the post-thumbnails in masonry just fine. I simply would like to achieve the same thing with the recent posts. This is what my code looks like :               <?php      /*      Template Name: Recent Profiles      */               get_header();      ?>
<?php the_title(); ?>

               <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
      <div <?php post_class(); ?> id="featured-<?php the_ID(); ?>">                              <?php         $args = array( 'numberposts' => '10' );         $recent_posts = wp_get_recent_posts( $args );         foreach( $recent_posts as $recent ) {         if ( has_post_thumbnail($recent["ID"])) {                 echo '';             echo get_the_post_thumbnail($recent["ID"], 'archive_grid');             echo '';         }     }     ?>

          <?php endwhile; endif; ?>          <?php get_template_part('includes/index-loadmore'); ?>

                 <?php dt_pagination(); ?>

          <?php get_footer(); ?>      Issue : The issue is, the code is just displaying one recent post thumbnail instead of the expected 10. Please help me out for what I might be missing here. Perhaps something wrong with the loop. FYI `archive_grid` is the name of the custom thumbnail.


List all posts in a category with query_post() function

I'm a `C programmer`, konw little about `PHP`. I built a Blog with wordpress. Yestoday, I try to create the page `www.abc.com/server`, this page would list all posts which belong to `server` category. I found some useful information in wordpress document and Google I created a template like this:               <?php      /*       * Template name: list_catetory       */     ?>          <?php get_header(); ?>         ...         <?php          query_posts( 'cat_name = $pagename' );         if(have_posts()) : while(have_posts()) : the_post(); ?>         <div class="post-list"  id="post-<?php the_ID(); ?>">
                  <a href="<?php the_permalink() ?>" title=""><?php the_title(); ?>                  ....

               <?php endwhile; ?>          <?php wp_reset_query(); ?>          ...     <?php get_footer(); ?>      I create a page named `server` with this template. then I open this page, I found this page list all post. Why it lists all post, not only list the posts belong to `server` category


WordPress plugin installation error

I have installed WordPress 3.8 and now I am trying to install `WooCommerce - excelling eCommerce 2.0.20` plugin but every time I am getting this error: **Note: I am trying to install plugin in local machine.**               Fatal error: Maximum execution time of 60 seconds exceeded in M:\XAMPP\htdocs\woocommerce\wp-includes\class-http.php on line 1327      I have tried with bellow code:   1. `php.ini` (in wp-admin folder) memory_limit = 32M   upload_max_filesize = 100M   upload_max_filesize = 100M   post_max_size = 32M   file_uploads = On   2. `wp-config.php` `set_time_limit(60);` but still I am facing this error. I know this very common issue but I need your help to solve this issue. I will appreciate If you help me :) Thanks


wp_user_roles and Advanced Manipulation

I removed a line from my wp_user_roles to manually remove a role I had created and now the sites administration gives me an "You do not have sufficient permissions to access this page." error. I cannot get in and don't know how to fix what was inside. I've tried pasting in the default user roles in wp_user_roles:               a:5:{     s:13:"administrator";a:2:{s:4:"name";s:13:"Administrator";s:12:"capabilities";a:54:{s:13:"switch_themes";b:1;s:11:"edit_themes";b:1;s:16:"activate_plugins";b:1;s:12:"edit_plugins";b:1;s:10:"edit_users";b:1;s:10:"edit_files";b:1;s:14:"manage_options";b:1;s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:6:"import";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:8:"level_10";b:1;s:7:"level_9";b:1;s:7:"level_8";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;s:12:"delete_users";b:1;s:12:"create_users";b:1;s:17:"unfiltered_upload";b:1;s:14:"edit_dashboard";b:1;s:14:"update_plugins";b:1;s:14:"delete_plugins";b:1;s:15:"install_plugins";b:1;s:13:"update_themes";b:1;s:14:"install_themes";b:1;}}     s:6:"editor";a:2:{s:4:"name";s:6:"Editor";s:12:"capabilities";a:34:{s:17:"moderate_comments";b:1;s:17:"manage_categories";b:1;s:12:"manage_links";b:1;s:12:"upload_files";b:1;s:15:"unfiltered_html";b:1;s:10:"edit_posts";b:1;s:17:"edit_others_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:10:"edit_pages";b:1;s:4:"read";b:1;s:7:"level_7";b:1;s:7:"level_6";b:1;s:7:"level_5";b:1;s:7:"level_4";b:1;s:7:"level_3";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:17:"edit_others_pages";b:1;s:20:"edit_published_pages";b:1;s:13:"publish_pages";b:1;s:12:"delete_pages";b:1;s:19:"delete_others_pages";b:1;s:22:"delete_published_pages";b:1;s:12:"delete_posts";b:1;s:19:"delete_others_posts";b:1;s:22:"delete_published_posts";b:1;s:20:"delete_private_posts";b:1;s:18:"edit_private_posts";b:1;s:18:"read_private_posts";b:1;s:20:"delete_private_pages";b:1;s:18:"edit_private_pages";b:1;s:18:"read_private_pages";b:1;}}     s:6:"author";a:2:{s:4:"name";s:6:"Author";s:12:"capabilities";a:10:{s:12:"upload_files";b:1;s:10:"edit_posts";b:1;s:20:"edit_published_posts";b:1;s:13:"publish_posts";b:1;s:4:"read";b:1;s:7:"level_2";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;s:22:"delete_published_posts";b:1;}}     s:11:"contributor";a:2:{s:4:"name";s:11:"Contributor";s:12:"capabilities";a:5:{s:10:"edit_posts";b:1;s:4:"read";b:1;s:7:"level_1";b:1;s:7:"level_0";b:1;s:12:"delete_posts";b:1;}}     s:10:"subscriber";a:2:{s:4:"name";s:10:"Subscriber";s:12:"capabilities";a:2:{s:4:"read";b:1;s:7:"level_0";b:1;}}}      but still get the error for my administrator user account. Any help would be much appreciated.


About redundant code when I use shortcode to output the HTML from a variable

I use shortcode to output the following html in a variable, but there are too many redundant code such as br and p tags, how to remove them? Thanks! HTML MAKEUP               $return_html.='
ID.'">post_title.'">
'.$post->post_title.'

'.van_truncate($post->post_content,100).'

post_title.'">ZoomInID).'" class="info">Info
     ID).'" class="item">
';      Current shortcode function               add_shortcode('portfolios', 'van_portfolios_shortcode');     function van_portfolios_shortcode( $atts, $content) {         extract(shortcode_atts(array(             'number'=>'9',             'slug'=>''         ), $atts));         $str=van_portfolios($slug,$number,false);        return $str;     }          function van_process_shortcode($content) {         global $shortcode_tags;         // Backup current registered shortcodes and clear them all out         $orig_shortcode_tags = $shortcode_tags;         $shortcode_tags = array();         add_shortcode('portfolios', 'van_portfolios_shortcode');              // Do the shortcode (only the one above is registered)         $content = do_shortcode($content);         // Put the original shortcodes back         $shortcode_tags = $orig_shortcode_tags;         return $content;     }     add_filter('the_content', 'van_process_shortcode', 7);      Correct makeup is

...

...

ZoomInInfo
                ...
      Output:

...

...

ZoomInInfo

...


How to limit post query to only return a total count of items with certain post statuses?

I have a couple functions that are creating an admin table to display on my custom dashboard page. I'm having a little trouble with the function that determines what pages to display because I'm not sure how to restrict my query to not count items that had a post status of 'auto-draft' or 'trash'. Anyone know how to do that? I'll need $totalitems to only count the ones without those post statuses. Here's my function:               /**                          * Prepare the table with different parameters, pagination, columns and table elements                          */                         function prepare_items() {                             global $wpdb, $_wp_column_headers;                             $screen = get_current_screen();                                  /* -- Preparing your query -- */                             $query = "SELECT * FROM $wpdb->posts";                                  /* -- Ordering parameters -- */                             //Parameters that are going to be used to order the result                             $orderby = !empty($_GET["orderby"]) ? mysql_real_escape_string($_GET["orderby"]) : 'ASC';                             $order = !empty($_GET["order"]) ? mysql_real_escape_string($_GET["order"]) : '';                             if(!empty($orderby) & !empty($order)){ $query.=' ORDER BY '.$orderby.' '.$order; }                                  /* -- Pagination parameters -- */                             //Number of elements in your table?                             $totalitems = $wpdb->query($query); //return the total number of affected rows                                  //How many to display per page?                             $perpage = 15;                             //Which page is this?                             $paged = !empty($_GET["paged"]) ? mysql_real_escape_string($_GET["paged"]) : '';                             //Page Number                             if(empty($paged) || !is_numeric($paged) || $paged<=0 ){ $paged=1; }                             //How many pages do we have in total?                             $totalpages = ceil($totalitems/$perpage);                             //adjust the query to take pagination into account                             if(!empty($paged) && !empty($perpage)){                                 $offset=($paged-1)*$perpage;                                 $query.=' LIMIT '.(int)$offset.','.(int)$perpage;                             }                                  /* -- Register the pagination -- */                             $this->set_pagination_args( array(                                 "total_items" => $totalitems,                                 "total_pages" => $totalpages,                                 "per_page" => $perpage,                             ) );                             //The pagination links are automatically built according to those parameters                                  /* — Register the Columns — */                             $columns = $this->get_columns();                             $hidden = array();                             $sortable = $this->get_sortable_columns();                             $this->_column_headers = array($columns, $hidden, $sortable);                                  /* -- Fetch the items -- */                             $this->items = $wpdb->get_results($query);                         }


"Upgrade Network" error: stuck with SSL certificate verification

When trying to update one Network/MU install, I got the following error. > Warning! Problem updating https://subdomain-A.example.com. Your server may > not be able to connect to sites running on it. Error message: SSL: > certificate subject name 'example.com' does not match target host name > 'subdomain-A.example.com' As I know that the certificate is valid, etc. I just need to somehow bypass the verification check from WP.


How do i remove the title from a specific page

Hi need to remove the title of a specific page, this one. I could do               add_filter( 'the_title', ai1ec_remove_title );          function ai1ec_remove_title( $title ) {         if( 'Calendar' === $title ) {             return '';         } else {             return $title;         }     }      but this would also remove the title for any Post / Custom Post, titled calendar, i want to target specifically a page, is there a better way to do this?


Changing "Lost Password Email Link" to custom password reset page

On the Wordpress site I am working on, subscribers will not be allowed to see anything in the backend at all. Because of that I am creating a custom pages for the Wordpress login page that subscribers can access. On the login form there is a "Lost Password" link. I have managed to redirect most things to my own custom pages, but when someone enters their username in the lost password field, it sends the user an email with a link in it, which redirects them to the Wordpress backend to reset their password. I want to be able to edit that link in the email and redirect them to my own password reset page, but I can't find anywhere to hook in. Can someone give me the right action for hooking into that? I don't want to change any of the Wordpress Core code. Any help would be appreciated. Thanks!


How to make each category a subsite?

I have a WP site wp.domain.com, and want to make each category a subsite. EG, foo.wp.domain.com would be a WP site that lists only posts in category 'foo', the search limits itself to category 'foo', the archives/etc are limited to 'foo'. There are no category archives unless foo has subcatgories. How do I do this?


How to restore deleted post related with deleted users

I accidentally deleted post that related to certain users in wordpress because I deleted user. How can I restore those posts? Thank you!


Hooking in to replace the Sidebar/Widget areas

The Goal: To replace the sidebar on all sites across my network with content loaded from a plugin, _across all themes._ I need a way of over-riding the sidebar/main widget area on all sites across my network. I have written a plugin which generates the sidebar with a function call, but **how can I get this content to completely replace the sidebar?** At present I can only call a hook as `get_sidebar()` happens, not replace that action.               add_action('get_sidebar', 'my_get_sidebar', 11);      Additionally, this makes my sidebar appear on all sidebars on the page, I only want it to overwrite the main one (sidebar-one?) and have the others left blank.


Adding An Image To A Custom Taxonomy Term

I would like to be able to associate an image with a custom taxonomy term. Ideally, I'd like to provide the end-user with an interface for managing the image directly on the term itself. I have worked with a plugin that provides this functionality (Ultimate Taxonomy Manager) - it may be what I stick with. I'm after the best practice, though, and would like to know if any of you have worked through this before and what solutions you recommend.


Does an AJAX call on the Admin Side Automatically include the User Data/Capabilities?

I was wondering that if you do an AJAX call on an admin page and I wanted to see if the user had the capability to edit a page, would that info be sent along the call or do I need to manually sent that data?


Use the plus sign "+" instead of dash "-" in URLs

Is it possible to use the plus sign instead of the dash as the word delimiter in the url? And if so, how exactly would that be done? e.g.: `www.example.com/some-title/` becomes `www.example.com/some+title/` Of course, ideally it would have to work with posts, pages and custom posts.


Get JSON from self hosted wordpress site

I am very new to wordpress so this may seem basic. I have a **_NON-WordPress_** website in which I would like to consume various blogs (via category/tags etc etc) from my **WordPress** site. **Currently I am using this plugin:** http://wordpress.org/plugins/feed-json/   * Although it works fine, sadly it seems to only return the latest 10 blog entries (0-9) which does not cover all the data I want to interact with.   * I have looked at the documentation for this plugin but I cannot see any way of changing how many entries to return. I have seen this plugin: http://wordpress.org/plugins/json-api/   * Would that plugin solve my problem?    * Is it likely to cause conflicts having two JSON type plugins running at the same time? Any help on this would be much appreciated.


Custom page template not recognized with permalinks on

The custom page template shows up when I choose any permalink structure with an ID > %post_id% But after I change it to any other structure which does not have **post_id** in it my page defaults to the theme given in index.php.


Categories Template Assistance

I have found a tutorial online for creating a custom categories template for my archived posts within a particular category. This however is targetting a specific category ID (see below), is there anyway of creating a template that targets all rather than one specific ID?               <?php     /*     Template Name: Category-Tutorials      * The template for displaying Archive pages.      *      * Used to display archive-type pages if nothing more specific matches a query.      * For example, puts together date-based pages if no date.php file exists.      *      * Learn more: http://codex.wordpress.org/Template_Hierarchy      *      * @package WordPress      * @subpackage Twenty_Eleven      * @since Twenty Eleven 1.0      */          get_header(); ?>

                         <?php if ( is_day() ) : ?>                             <?php printf( __( 'Daily Archives: %s', 'twentyeleven' ), '' . get_the_date() . '' ); ?>                         <?php elseif ( is_month() ) : ?>                             <?php printf( __( 'Monthly Archives: %s', 'twentyeleven' ), '' . get_the_date( 'F Y' ) . '' ); ?>                         <?php elseif ( is_year() ) : ?>                             <?php printf( __( 'Yearly Archives: %s', 'twentyeleven' ), '' . get_the_date( 'Y' ) . '' ); ?>                         <?php else : ?>                             <?php _e( 'Tutorials', 'twentyeleven' ); ?>                         <?php endif; ?>

             <?php $archive_query = new WP_Query('cat=7&showposts=1000');             while ($archive_query->have_posts()) : $archive_query->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?>
             <?php endwhile; ?>

      I was thinking maybe the following could be changed:               <?php $archive_query = new WP_Query('cat=7&showposts=1000');


How do I create a Client Logos section in admin menu?

My company is hosting an event where 50 clients will be at an exhibition. I want to create an Ehibitors section with separate admin menu. I want to be able to add Exhibits with custom fields for exhibitor_id, exhibitor_logo_img, exhibitor_title and exhibitor_bio. What is the best way to do this? I dont want to end up with 50 exhibits in one post/page. Ideally, I want 50 separate and sortable pages within a admin menu section. Any ideas? Hope this makes sense, WordPress noob. Cheers,


Get the name of user who updated post

Does anyone know how to get the name of the user who last updated a post/page please? (Not the post author). I can see that it is visible in the post/page revisions but don't know how to access it. Any ideas/help greatly appreciated.


Group images in media library

I'm looking for a method to group images in the media library. I'm developing a photo portfolio site. I have uploaded all the images to the media library I need a way to group the images to make them more manageable. At the moment I just have a long list of images.


Auto order posts of custom post type by title

I have a custom post type which has more than 50 posts. I want to reorder them alphabetically so that each time I post anything the system automatically reorders. Please don't suggest post order plugin, its drag and drop type and would be very very tedious I've added the following code in the functions.php but I keep getting the following error > Parse error: syntax error, unexpected '}'                 function alpha_order_classes( $query )      {         if ( $query->is_post_type_archive('books') && $query->is_main_query() )          {             $query->set( 'orderby', 'title' );             $query->set( 'order', 'ASC' );       }       }          add_action( 'pre_get_posts', 'alpha_order_classes' );      i created the custom post types using plugin simple custom posttype


Plugin: Posts 2 Posts problems with private posts

I'm trying to connect two private posts to each other and it doesn't work! but the same code work correctly for other published posts. Even if i connect a published post to a private post, in dashboard, it's connected but when i query connections to that published post it doesn't show that connection to that private post.   * Private post <=(not work)=> Private post   * Publish post <=(not show)=> Private post   * Publish post <=(work & show)=> Publish post **i forgot to tell that i add connections programmatically.**


How to control the order of the combination of enqueued styles and scripts - site speed issue

We know, using `wp_head()` and `wp_footer()` all the scripts and styles are enqueued using `wp_enqueue_styles` and `wp_enqueue_scripts` hook. What we do is to enqueue our stylesheets and scripts using `functions.php`. And similarly WordPress plugins also enqueue their stylesheets and scripts using the same method. So, in the end there are many enqueued styles and scripts in header or footer. What Google PageSpeed recommends is: > **Optimize the order of styles and scripts** \- Google PageSpeed We know, `wp_enqueue_script()` and `wp_enqueue_style()` offer a `$deps` parameter, where we can define the depth or priority of the script or stylesheet. But that affects only within scripts and styles, not in both. So, with a combined load of scripts and stylesheets from the theme, and/or child theme, and/or plugins, and/or third party API etc. how can we let the WordPress to enqueue them all in a way so that site speed improves with a sound website's quality?   Or, are they bulletproof to echo styles first, than scripts?


Display a random tag but using cron to control frequency of change

Background - I have created a shortcode in functions.php which adds a single random tag with it's link and description to a widget in my sidebar. This is my existing code...               function skips_get_random_tags() {         $args = array('exclude' => '');             $alltags = get_tags( $args );             shuffle($alltags);             $count=0;             if ($alltags) {                 foreach($alltags as $tag) {                     $count++;                     return '
Random App: term_id).'">'.$tag->name.'

'.$tag->description.'
';             if( $count >0 ) break;             }         }     }          add_shortcode( 'random-tag', 'skips_get_random_tags' );      It works fine except that is runs every time the page is loaded (subject to a cache period) and also generates different results on each page because of this. I would like to schedule it to run once daiy and have been reading about Cron which seems to be the solution. Having reviewed the codec, I believe I need to edit my code as follows (seems to be just adding some CRON code to trigger the function above the code and linking it to the function)...               function prefix_activation() {         wp_schedule_event( time(), 'daily', 'skips_daily_event_hook' );     }          add_action( 'skips_daily_event_hook', 'skips_get_random_tags' );     /**      * On the scheduled action hook, run the function.      */              function skips_get_random_tags() {         $args = array('exclude' => '');             $alltags = get_tags( $args );             shuffle($alltags);             $count=0;             if ($alltags) {                 foreach($alltags as $tag) {                     $count++;                     return '
Random App: term_id).'">'.$tag->name.'

'.$tag->description.'
';             if( $count >0 ) break;             }         }     }          add_shortcode( 'random-tag', 'skips_get_random_tags' );      I'm suspecting I'm going the long way round but I don't want to trigger a CRON that I can't stop - can anyone experienced with CRON comment on my approach and proposed code?


WP Load post with ajax and apply isotope

I ma using `Ajax Load More` to get my posts and show in a frontend, then I have applied isotope to the items. When I first show some items and applied isotope, it's working perfectly. But When second time I load post by ajax and try to apply the isotope, that isotope is not working and posts are overriding. Could someone help me in this regard?


Add custom TinyMCE 4 Button, Usable since WordPress 3.9-beta1

How is it possible to add a custom button to the visual editor TinyMCE, **Version 4**? Currently I found this q&a with a little bit hints to the topic, but not a solution or a how to. But I can't find a tutorial, documentation, q&a for the topic to add a custom button to the TinyMCE version 4, include in WordPress since version 3.9-beta1. ### Goal ![enter image description here](http://i.stack.imgur.com/HpS2j.png)


Having Trouble Running Query From Shortcode Using Tribe's Events Plugin

I am not getting any results back using this code, even though I am passing in correct values. Can someone please take a look?               function webinar_list_shortcode($atts) {       global $post;      // Defaults     extract( shortcode_atts ( array (             'posts' => '5',             'status' => 'future',             'eventcat' => ''         ),         $atts     ));          $options = array(         'eventDisplay'=>$status,         'posts_per_page'=>$posts,         'tax_query'=> array(             array(                 'taxonomy' => 'tribe_events_cat',                 'tag_ID' => $eventcat             )         )     );           // query is made      $query = new WP_Query( $options );           // Reset and setup variables      $output = '';      $temp_title = '';      $temp_link = '';      $temp_ex = '';      $temp_content = '';      $temp_thumb = '';      $temp_id = '';           // the loop      if ( $query->have_posts() ) {         $temp_id = $post->ID;         $temp_title = the_title('','',false);         $temp_link = get_permalink($post->ID);         $temp_content = get_the_content($post->ID);         $temp_date = tribe_get_start_date( $post->ID, true, 'l, F j, Y' );         $temp_speaker = get_field('speaker');         //$temp_ex = get_the_excerpt();           if ( has_post_thumbnail() ) {             $temp_thumb = get_the_post_thumbnail($post->ID, array(200,200));           } else {             $temp_thumb = "";           }              // output all findings -        $output .= "

        $temp_thumb

                       $temp_date

Event: $temp_title

Speaker: $temp_speaker
                   View Event Details

";      } else {         $output .= "not found.";      }      wp_reset_query();      return $output;      }


Display custom post term or taxonomy

I have a custom post type called 'rent', inside that custom post type I've assigned some taxonomies like building1, building2 etc, inside that taxonomies I have some terms. Let's say I have a custom rent post in taxonomy building1 with term 1stfloor. I'd like to output on that post single page a term name and slug. I've could have easily done that using `get_post_terms` or something similar, but that function requires to specify taxonomy. But I would have many taxonomies for that custom post, and I don't want to make another single.php for every taxonomy. So I thought I would somehow get the taxonomy of my post (it will always be one taxonomy), assign it to variable, and put as an arg to `get_post_term`s. Well you can simply achieve taxonomy of current post using `get_post_terms` In my archive page I used `$taxname = get_query_var( 'taxonomy' );` \- which works like a charm, but it is not working on custom post single. Anyone have an idea how I can do that?


Infinite Scroll not working in own theme

I'm developing my own theme and added this in a function which is called with the hook `after_setup_theme` to support infinite scroll:               add_theme_support( 'infinite-scroll', array(         'container'  => 'content',         'footer' => false,         'wrapper' => false     ) );      I got this from http://jetpack.me/support/infinite-scroll/. `content` is the id of the container the new posts should go in. `footer` is set to false since I don't want another footer to be added. `wrapper` is set to false because I don't need a div wrapper. When I go to my webpage and scroll to the bottom, there is a loading anymation, but there are no posts loaded (there are more posts though). I see that there is a javascript error:               TypeError: infiniteScroll.scroller is undefined at infinity.js:485      I also see there is an ajax request when I scroll to the bottom, but that page returns:               {"type":"empty"}      What am I doing wrong? How can I get this working?


How to make pagination work not for a whole category but for a part of it? (WP_Query)

In my example you can see that i have to paginate posts from category 6 with `meta_value='izhs'` for `meta_key='dachaizhs'` Now it works like it paginates the whole category, and then exclude from each page non-appropriate posts for searching `meta_value`. So if i set `'posts_per_page'=9` for the query and i have 12 posts of current category, 2 of them are located on the 1st page and have `meta_value="izhs"` (which i'm querying) and on the 2nd page there are also some posts appropriate to searching meta-value (no matter how much). As a result i receive on the 1st page only these 2 posts, while there are some posts i need on the 2nd page and my pagination of 9 posts per page seems to be broken. Thanks a lot.                   $args = array(                       'post_status'=>'publish',         'post_type'=>'post',         'orderby'=>'post_date',         'order'=>'DESC' ,         'posts_per_page' => 9,         'paged' => get_query_var('paged'),         'meta_key'=>'dachaIzhs',         'meta_value'=>'izhs',         'cat'=>6             );          $query = new WP_Query ( $args );          while ( $query->have_posts() ) : $query->the_post();          // bla bla          endwhile;


How to get some information from the_content

Hello in index loop 3 lastest post and i want to take only a bit o text and first photo or youtube - and here is the problem, because i can use the_excerpt or i can use get_post_meta to take text, to take picture i can use the_post_thumbnail but i have no idea how i can get youtube as player with the movie, it's always going as text...

     <?php echo the_excerpt(); ?>

<a href="<?php the_permalink(); ?>"><?php echo get_post_meta($post->ID, 'tytul-en', true); ?>

<?php echo get_post_meta($post->ID, 'en', true); ?>
<a href="<?php the_permalink(); ?>">read more

<a href="<?php the_permalink(); ?>"><?php echo get_post_meta($post->ID, 'tytul-pl', true); ?>

<?php echo get_post_meta($post->ID, 'pl', true); ?>
<a href="<?php the_permalink(); ?>">czytaj więcej

      any idea ?


Excluding private/protected posts via IP

I essentially want password protected/private pages/posts in WP to work as they currently do, but completely disregard the functionality for certain IP addresses. I've looked into filters/actions and don't see anything that seems promising, again I would prefer to do this without creating a specific category or anything outside of the current functionality of this in wordpress. Thanks!


Can't add a Page with Name 2011

I've no idea why i can't add a Page with Name `2011`. Wordpress changes the URL Slug to 2011-01. There is no Post with this Name in my Database. I tried zu flush my rewrite rules but nothing seems to be work. If i add a Page 2013 it works fine. But only once... If i delete this Page (from Trash) i can't add it again. Wordpress changes the slug to 2013-01. If i change the Post name directly in the database. Nothing happens... I really wonder why because there is no Post with this Name. Any suggestions?


How to get posts from two categories with WP_Query?

I'm using WP_Query to create 'latest posts' & 'popular posts' sections on my home page. I'm trying to just pull 5 posts from 2 categories (9 & 11) but it will only show posts from cat 9. Here's the php I'm using for 'latest posts'-
             <?php                   $cat = array(9,11);             $showposts = 5;             $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;             $args=array(                 'category__in' => $cat,                  'showposts' => $showposts,                 'paged' => $paged,                 'orderby' => 'post_date',                 'order' => 'DESC',                 'post_status' => 'publish',                );                  $the_query = new WP_Query ( $args ); //the query                       $i = 0;while ($the_query->have_posts() ) : $the_query->the_post(); //start the loop             ?>                  <?php             if($i==0){ //Sets the output for the top post             ?>

<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(350,187); ?>

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

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

<?php the_excerpt(); ?>

<a class="more-link" href="<?php the_permalink(); ?>">Read More »

                       <?php                 $i++;                  } else { ?>

<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(145,93); ?>

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

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

                  <?php } endwhile; //end of the loop ?>             <?php wp_reset_postdata(); // reset the query ?>
       Any suggestions?


wp_get_attachment_image() not working when trying to add with and height attributes

I am using `wp_get_attachment_image()` to try and output an img tag with width and height attributes. Here is my code:               $thumb_src = wp_get_attachment_image( $id, 'thumbnail', false, array('width'=> '10', 'height' => '10' ));     $thumb_output = "
".$thumb_src."
";      I was expecting this to output:

      Instead, it is outputting:

      Thanks very much for any help anyone can give. I have tried it with other attributes, like the `style` attribute, and the style tag appears as expected. I guess I could use the style tag to set the dimensions that way but I don't understand why the width/height method isn't working!


Any Mobile Theme Switcher - Theme not complete (Stylesheet missing)

I am trying to install the theme "Any Mobile Theme Switcher" on Wordpress 3.2.1, in order to give my Site a different layout, depending on where it is displayed. Installation succeeds, but in the the "Themes" view of the dashobard, I cannot select the theme, it says rather: any-mobile-theme-switcher - Stylesheet missing. What can I do? Theme: http://wordpress.org/plugins/any-mobile-theme-switcher/


Query posts and return XML

Here is the short and sweet of what I am hoping to do. I would like to have a way for external websites to query mine using a game title and they would get an XML back that contains the text of the review, the score, and some images (this XML should be customizable in order to add/remove elements from it). This seems like it should be easy enough, but my OVERLY limited knowledge of PHP and Wordpress are making this very complicated.


Implementing a tricky wordpress menu (nested categories + thumbnails)

I'm trying to make a layered wordpress menu, out of categories. Here's how it's going to look: ![enter image description here](http://i.stack.imgur.com/CScKS.png) I have no clue how to develop this, can't do it with `get_posts` (not sortable by parent/children), or `wp_list_categories` (can't pull thumbnails). Also, I have to assign thumbnails to categories somehow. Is there an easy way to implement something like this with wordpress?


Update Wordpress Custom Field with AJAX on cached page

I'm new to ajax am trying to create a simple hit counter that updates a custom field in Wordpress after the page loads. The page is cached, so any attempts to use PHP alone will not work. I'd like to simply pass the post ID through ajax to the php file, get the custom field, and update it with the new hit number. I currently have the following code, but cannot get it to update the custom field. Here's the jquery:                $(document).ready(function(         $.ajax({         url:'http://www.example.com/hits/hits.php',         cache: false,         type: 'POST',         data: {PostId: '<?php echo get_the_ID() ?>'}         });     ));      And the PHP file it calls:               <?php      /* Template Name: AJAX  */      ?>          <?php          $postid = $_POST['PostId'];  // get the hits from AJAX and save it for PHP                    $hits = (int) get_post_meta($postid, 'hit_number', true);         $newhits = $hits + 1;         update_post_meta($postid, 'hit_number', $newhits);     ?>      What am I doing wrong? Also, is there a way to include the PHP function in the same page/file to avoid bringing in an external file? I'm concerned that as traffic gets larger, the file will be requested too often. Thanks for your help!


Enable WP to accept standard jQuery code embeding between the <body> tags

I don't know what is the reason that WP is not accepting the standard embedding technique from jquery website ( http://learn.jquery.com/about- jquery/how-jquery-works/ ):               <!doctype html>                   <meta charset="utf-8" />         <title>Demo</title>                   jQuery                                  And allowing you only to wp_register_script your scripts in the functions.php or in the header. I want be able to embed the jQuery the way it is supposed to be and where I want in my template files. **So, the question is how can I enable the standard embeding recognition of jquery code in WP?** If that's not possible, is there a plugin for that or what files do I need to hack in WP core, if that's not possible to solve by some hook?


Unable to run jQuery script in my template file

I really want to run a simple code in my template file. E.g. if I put somethign like this in my page.php:               <script type="text/javascript">         jQuery(document).ready(function($) {             alert("Hello world!");         });     </script>      It's not working. But simple javascript is working:               <script type="text/javascript">             alert("Hello world!");     </script>      **Why is jQuery blocked in WP to be included in template files?** and maybe more important question > **WHERE IN THE WP SETTINGS CAN I RE-ENABLE THIS?** I know I can use wp_register_script etc. but in my scenario I need to paste simple javascript code in the template files. **How to allow load jQuery code snippets in WP template's file too?** And why is it even blocked?


VERY new to coding - keep breaking site trying to add to functions.php

I really appreciate everyone on this site who takes the time to answer questions here. I've learned a good deal already reading, but am sure I could learn even more if I could get past at least one basic question. Just like the "Best Collection of code for your functions.php file" post on this site, which has some outstanding tips, there are many great ideas for development without weighting things down with plugins. Trouble for me is, I clearly don't know enough about what I'm doing because anytime I've tried to add code to the functions.php file...I break my site. I am clearly placing it incorrectly and there is probably a step missing in the process as well. I obviously know just enough to be dangerous. I've done a lot of googling with variations on "how to properly edit functions.php" but I can't find a "101" version anywhere. Any thoughts on this would be appreciated, thanks!


Display text if current user has written 1 or more posts in a custom post type

I am trying to display different things to new users that have not created a post versus users who have created a post. I tried this, but it did not work for custom post types (only normal posts) and it does not account for drafts or pending posts:               <?php if (count_user_posts(1)>=1) { blah blah blah } else {Welcome, blah blah blah }; ?>


Attaching a navigation menu to the admin bar?

I have seen a number of solutions of how to manually attach links to the new WP admin bar, but I need to make this much easier for my site admins. It occurred to me that the easiest solution would be to create a custom navigation menu, and then have that menu 'attached' to the admin bar. This way the site admin could very easily add new links to the admin bar by simply adding pages to the custom menu. The primary idea being to place a dropdown menu displaying the menu pages directly on the right side of the admin bar.


Order users by 2 custom fields in wpdb query

I've created a WordPress members site, each member is a user with the role of subsriber and has extra information set as custom fields - ie: address, contact details etc. I have the users output by the country custom field but now need to get the entries within each country sorted further by company name... The code I have so far is below. Any help greatly appreciated as I'm truly stumped! Thanks in advance.
     <?php include('inc/ticker-welcome.php'); ?>               <?php     function end_prev_letter() {        echo "
\n";     }     function start_new_letter($letter) {        echo "
\n";        echo "\t

\n";     }          function start_new_country($ucountry) {        echo "\t

$ucountry

\n";     }          ?>                           <?php                           if ( isset($_GET['d']) ) {                         // show out of hours                             global $wpdb; //Ignore this line if you're not within a function                             $order = $wpdb->get_results("SELECT DISTINCT user_id FROM $wpdb->usermeta WHERE meta_key='_country' ORDER BY meta_value ASC", "ARRAY_N");                             $authors = array();                     //      foreach($order as $aid)                             foreach($order as $aid){                                  $u = new WP_User($aid[0]);                                  //&& in_array('yes', $u->out_of_hours)                                 if ( in_array("subscriber", $u->roles)  )                                  $authors[] = $u;                              }                             $authors[] = new WP_User($aid[0]);                             if (!empty($authors))                             { ?>                             <?php    // loop trough each author                                 foreach ($authors as $author) {                                   $author_info = get_userdata($author->ID);                                 if ($author_info->out_of_hours === 'yes') {                                          ?>                                  <?php                                  $author_info = get_userdata($author->ID);                             $thisCountry = ($author_info->_country);                             $first_letter = strtoupper(substr($thisCountry,0,1));                                     if ($first_letter != $curr_letter) {                                   if (++$post_count > 1) {                                      end_prev_letter();                                   }                                   start_new_letter($first_letter);                                   $curr_letter = $first_letter;                                }                                if ($thisCountry === $currentCountry) {                                } else {                                   start_new_country($thisCountry);                                  $currentCountry =  $thisCountry;                                }                                 ?>                                 <?php                                      $pin = 'pin'.$author->ID;                                     $pin = trim(preg_replace('/\t+/', '', $pin));                                     echo '
';                                                          include('inc/members-entry.php');                                          echo '
';                                  ?>                                    <?php                                          } // ooo query                                     } // for each ?>                         <?php                          end_prev_letter();                         ?>                                       <?php   } else {                             //    echo 'No authors found';                             }                                             } else {                         // show all                             global $wpdb; //Ignore this line if you're not within a function                             $order = $wpdb->get_results("SELECT DISTINCT user_id FROM $wpdb->usermeta WHERE meta_key='_country' ORDER BY meta_value ASC", "ARRAY_N");                             $authors = array();                     //      foreach($order as $aid)                             foreach($order as $aid){                                  $u = new WP_User($aid[0]);                                  //&& in_array('yes', $u->out_of_hours)                                 if ( in_array("subscriber", $u->roles)  )                                  $authors[] = $u;                              }                             $authors[] = new WP_User($aid[0]);                             if (!empty($authors))                             { ?>                             <?php    // loop trough each author                                 foreach ($authors as $author) {                                   $author_info = get_userdata($author->ID);                             ?>                                  <?php                                  $author_info = get_userdata($author->ID);                             $thisCountry = ($author_info->_country);                             $first_letter = strtoupper(substr($thisCountry,0,1));                                     if ($first_letter != $curr_letter) {                                   if (++$post_count > 1) {                                      end_prev_letter();                                   }                                   start_new_letter($first_letter);                                   $curr_letter = $first_letter;                                }                                if ($thisCountry === $currentCountry) {                                } else {                                   start_new_country($thisCountry);                                  $currentCountry =  $thisCountry;                                }                                 ?>                                 <?php                                      $pin = 'pin'.$author->ID;                                     echo '
';                                                          include('inc/members-entry.php');                                          echo '
';                                  ?>                                    <?php                                      } // for each ?>                         <?php                          end_prev_letter();                         ?>                                       <?php   } else {                             //    echo 'No authors found';                             }                           } // show all                        ?>
                       ![enter image description here](http://i.stack.imgur.com/wPx0M.jpg)


Cleaner way to define multiple variables for is_page_template()

I need to so some stuff only when specific templates (homepages) are used, I couldn't think of any better solution than this since is_page_template() do not handle arrays:                       $home_1 = is_page_template('home-1.php');             $home_2 = is_page_template('home-2.php');             $home_3 = is_page_template('home-3.php');             $home_4 = is_page_template('home-4.php');             $home_5 = is_page_template('home-5.php');             $home_6 = is_page_template('home-6.php');                  if ( $home_1 || $home_2 || $home_3 || $home_4 || $home_5 || $home_6  ) {                  //Do stuff             }      Since I need this for several parts, I was wondering if there is any cleaner way to do this not to repeat the same code throughout template files? Maybe inside a function in functions.php? Thanks


Using transients in conjunction with memcached

I was hoping someone could clear the air for me when it comes to using transients with memcached. When running a plugin like w3-total-cache, are there any actual performance advantages to using transients to store large post queries? If we are running memcached, the queries will already be cached by memcached correct? What then, if any, is the advantage to using these two methods in tandem?


Sort posts by custom field value

I tried fixing this for 5 days and my head is burning now. I bought a theme from GorilaThemes and the developer doesn't get back to me on the forum either, so Im pretty much by myself now. can you guys please help? There is a page where it lists cars with with the below query               $query = new WP_Query(array(                     'post_type' => array('gtcd','user_listing'),                     'posts_per_page' => '999'                            ));                         if ( $query->have_posts() ) while ( $query->have_posts() ) : $query->the_post(); global $post,$field, $fields, $fields2, $fields3; $fields = get_post_meta($post->ID, 'mod1', true); $fields3 = get_post_meta($post->ID, 'mod3', true); $fields2 = get_post_meta($post->ID, 'mod2', true);  $symbols = get_option('gorilla_symbols'); $options = get_option('gorilla_fields');include(TEMPLATEPATH."/functions/var/default-box-one.php");include(TEMPLATEPATH."/functions/var/default-box-two.php");include(TEMPLATEPATH."/functions/var/default-box-three.php");       And below is the way they 'echo' Year, Body Style and Price.               $fields['year'], $fields['bodystyle'], $fields['price']      Now Im trying to sort the posts by its 'Year' which is '$fields['year']'. How do I do it? I tried the methods below but none of them worked. METHOD 1               $query = new WP_Query(array(                  'post_type' => array('gtcd','user_listing'),                  'posts_per_page' => '999' ,                  'orderby' => 'meta_value',                  'order' => 'ASC',                  'meta_key' => 'year'


Featured image for links and categories

Is there a ready plugin or solution for implementing Featured Image function to Categories and Links? At Pages and Posts I use the feature image as a background image, using the full size original image, and I'd like to achieve the same, meaning I'd like to have featured full size image for categories. With Links, I'd like to attach an upload image to them, probably with auto- resize ability with different size to the default media size. Are there solutions already done to achieve these? Thanks, cadeyrn