Display all posts in a custom post type, grouped by a custom taxonomy term then paginate

I'm helping someone out that wants to sort their custom post type of "property" alphabetically by the value assigned in the custom taxonomy of "city" The below code works great for that:               <?php     $terms = get_terms('city', 'orderby=slug&hide_empty=1');         if(!empty($terms)) : foreach($terms as $term) :         $term_name = $term->slug;     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $args = array(      'city' => $term_name,     'post_type' => 'property',     'posts_per_page' => 1,     'paged' => $paged,     'nopaging' => false,     'order' => 'ASC',     'orderby' => 'title',                           );          $the_query = new WP_Query( $args );     // The Loop     if ( $the_query->have_posts() ) :     while ( $the_query->have_posts() ) : $the_query->the_post();      The issue I'm having is with the posts paginating. Since the above code is basically creating it's own loop for each city it doesn't listen to the "posts_per_page" or "paged" paramaters set in the $args array. Any suggestions on how I can make this paginate? Or is there an alternative method instead of using WP_query that would allow for pagination?


How to link up "read more" on excerpts hack from WP Recipies

I found the code on the WP Recipies page to force excerpts on the home page:               function my_excerpts($content = false) {         // If is the home page, an archive, or search results     if(is_front_page() || is_archive() || is_search()) :         global $post;         $content = $post->post_excerpt;          // If an excerpt is set in the Optional Excerpt box         if($content) :             $content = apply_filters('the_excerpt', $content);          // If no excerpt is set         else :             $content = $post->post_content;             $excerpt_length = 55;             $words = explode(' ', $content, $excerpt_length + 1);             if(count($words) > $excerpt_length) :                 array_pop($words);                 array_push($words, '...');                 $content = implode(' ', $words);             endif;             $content = '<p>' . $content . '</p>';              endif;     endif;          // Make sure to return the content     return $content;          }          add_filter('the_content', 'my_excerpts');      But how do I modify that snippet to add a hyperlink to the full post for the "..." part?


Does post-meta belong in header?

The template I used as a start for my own design places the metadata inside the header tag of the single-post.php. Is that a correct use of header, or should there only be h-tags in there? What about the post image? Could that be part of the header?


Register theme customizer settings when theme activates

I've been following this great tutorial (http://wp.tutsplus.com/tutorials/theme-development/digging-into-the-theme- customizer-overview/) and now I have set the Theme customizer. As far as I understand the settings I assign in the customizer are saved in the database every time the user "saves" in the theme customizer page. Which means that after activating the theme for the first time and before going to the customizer, the settings are not saved. My question is, How can I save the settings just after the user activates the theme? (the $wp_customize->add_setting default value) Pd. I've been looking for some time, and got this hooks: "after_setup_theme", "switch_theme", but I cant figure out how to do it. Edit: The "duplicate question" answers how to provide a fallback when there is no setting available. Although it might be a workaround, I would like to know how to save (register) the settings when activating the theme.


Downloadable content only for subscribers?

I'd like to use WordPress to set up a whitepapers site. Any user can check the main site with a list (blog format) of white papers available. But if a user wants to download any whitepaper, **he has to be registered**. So the process should be as follows:   1. Are you registered? 1.1. Type your email 1.2 The system checks if you're already registered. If so, it lets you download the whitepaper (the download starts inmediately or is sent by mail)   2. Aren't you registered? 2.1 Complete the form (several fields, **the normal WordPress registration form is not useful here** ) 2.2 First registration should be confirmed by email to avoid false users 2.3 The system lets you download the PDF whitepaper (the download starts inmediately or is sent by mail) The first part (check if the user is registered / subscribed) is the difficult one for me. The idea is to build a database of really interesting users in order to send them newsletters and valuable content, and to make **comfortable, easy and quick to register once** and forget about this step so they can download any whitepaper I publish later on. I would like to use phplist for this (I've got a phplist site working, but checking the registered users is a nightmare for me, I'm not a phplist expert and although I've asked on their forums there has been no luck) so WordPress is a nice alternative for me and I know something like this is more doable, maybe with some free **or even premium plugins**.


How can I allow users (subscribers) to download selected posts into a single PDF? (RESOLVED)

I currently have a members area for subscribers. I have already setup the ability for users to 'favourite' posts and add them to custom folders of their choice. Once they have added some posts to a specific folder, I want them to be able to click download where it will collate that folders posts into a pdf. Doesn't have to be perfect, it just has to be functional for now. I found a plugin Kalin's PDF creation station, which has an additional backend feature (Tools) which does this perfectly, even offering reordering of the posts before publishing. But I want to know if I can offer this option to a front end subscriber. Does anyone know if this can be done? Open to alternative solutions if anyone has any as well. Thanks **EDIT** Here is a screenshot to help. The blurred out titles are 3 seperate posts titles. When they click download, I want those 3 to be compiled into a pdf? Any suggestions?


Best place to call xdebug helper functions?

Right now I place the following code wherever I expect something to go wrong.               /** xdebug helper */         error_reporting(E_ERROR);         ini_set("display_errors", 1);         ini_set("html_errors", 1);      Where should I include this code so that it's always called on every page?


How can I open up my administrative panel to everyone?

I'm planning on running a open news site that I want everyone to be able to view the inside of the site without registration. I feel like it should exist a simple check for viewing the WordPress backend but I can't seem to find it. I don't want everyone to be able to create posts or edit things but to view things. Is this as simple as I think it is or do I have make big changes myself to the codebase?


how to find user ids of all commenters in a post

Is there a function in wordpress that grabs all the users(user ids) who have commented on a post? I have the post id available.


Retrive images from the_content()

I would like to get the images from the_content(), I know I could use a regex to get the images but I wanted to know if there is any other more 'wordpress way' for doing this? I have this within a plugin and I have a filter                add_filter('the_content', 'myTestContentFunction');      Thank you


Help with add_rewrite_rule solution

In my Wordpress blog, I configured permalinks > Category base to "magazine" with links having this format:   http://www.mydomain.com/magazine/news/europe/france The above link opens the France Category Archive page. For the record:   * France is a child of Europe   * Europe is a child of News My client wants the URL for the France Category Archive page to change and be like this: http://www.mydomain.com/europe/france/news The problem is of course that with the second link, Wordpress will NOT open the France category archive page but the News category archive page. I solved the problem by adding the below in my theme's functions.php file, hence redirecting "europe/france/news" to the index.php page with the correct querystring of the France Archives Page.               add_action( 'init', 'wpse12065_init' );          function wpse12065_init()     {         add_rewrite_rule('europe/france/news', 'index.php?category_name=news%2Feurope%2Ffrance', 'top');         }      I of course then saved the permalinks from wp admin to flush the rules. It works, but:   1. Is this a clean solution? How expensive is it in terms of performance?   2. Can I have 50 rules like this one?   3. Will this break any plugins?


Moved wordpress from localhost to live and wp-admin shows white screen

Hi I developed a website in wordpress on my localhost then moved it to a live server. Everything is working fine except wp-admin. When I go to domain/wp- admin it shows a white screen. Yet when I go to domain/wp-login.php it allows me to login to the admin. Also if I try to create new post or update any settings it keeps showing a blank white screen, yet when refreshed has saved the settings/added the post etc. The site is www.nuvogadgets.com. Any ideas? Thanks!


Change permalink when page category selected in admin

I'm using the Events Manager plugin which uses a custom post type of 'events' and a custom taxonomy of 'event-categories'. One of my events categories is 'Short courses'. When I check this category (in admin) I want the default of /events/page-title to change to /course/page-title, and revert when the category is unchecked. Does anyone know if this is possible?


Override Taxonomy Template

I'm trying to list all the products tied to a specific taxonomy. For some reason the template won't work when trying to access "http://www.myexample.com/product_categories/funiture/", I tried `taxonomy.php`, `taxonomy-term.php` and nothing. Here's my code: http://pastie.org/7934453               add_action('init', 'register_cpt_product');          function register_cpt_product() {              $labels = array(             'name' => _x('Products', 'product'),             'singular_name' => _x('Product', 'product'),             'add_new' => _x('Add New Product', 'product'),             'add_new_item' => _x('Add New Product', 'product'),             'edit_item' => _x('Edit Product', 'product'),             'new_item' => _x('New Product', 'product'),             'view_item' => _x('View Product', 'product'),             'search_items' => _x('Search Products', 'product'),             'not_found' => _x('No products found', 'product'),             'not_found_in_trash' => _x('No products found in Trash', 'product'),             'parent_item_colon' => _x('Parent Product:', 'product'),             'menu_name' => _x('Shop', 'shop'),         );              $args = array(             'labels' => $labels,             'hierarchical' => false,             'supports' => array('title', 'editor', 'thumbnail', 'custom-fields', 'revisions', 'page-attributes'),             'taxonomies' => array('Product Categories'),             'public' => true,             'show_ui' => true,             'show_in_menu' => true,             'menu_position' => 20,             'show_in_nav_menus' => true,             'publicly_queryable' => true,             'exclude_from_search' => false,             'has_archive' => true,             'query_var' => true,             'can_export' => true,             'rewrite' => true,             'capability_type' => 'post'         );              register_post_type('product', $args);     }          add_action('init', 'register_taxonomy_product_categories');          function register_taxonomy_product_categories() {              $labels = array(             'name' => _x('Product Categories', 'product_categories'),             'singular_name' => _x('Product Category', 'product_categories'),             'search_items' => _x('Search Product Categories', 'product_categories'),             'popular_items' => _x('Popular Product Categories', 'product_categories'),             'all_items' => _x('All Product Categories', 'product_categories'),             'parent_item' => _x('Parent Product Category', 'product_categories'),             'parent_item_colon' => _x('Parent Product Category:', 'product_categories'),             'edit_item' => _x('Edit Product Category', 'product_categories'),             'update_item' => _x('Update Product Category', 'product_categories'),             'add_new_item' => _x('Add New Product Category', 'product_categories'),             'new_item_name' => _x('New Product Category', 'product_categories'),             'separate_items_with_commas' => _x('Separate product categories with commas', 'product_categories'),             'add_or_remove_items' => _x('Add or remove product categories', 'product_categories'),             'choose_from_most_used' => _x('Choose from the most used product categories', 'product_categories'),             'menu_name' => _x('Product Categories', 'product_categories'),         );              $args = array(             'labels' => $labels,             'public' => true,             'show_in_nav_menus' => true,             'show_ui' => true,             'show_tagcloud' => false,             'show_admin_column' => false,             'hierarchical' => true,             'rewrite' => true,             'query_var' => true         );              register_taxonomy('product_categories', array('product'), $args);     }


How to set any theme setting from a custom WP_Customize_Image_Control?

I am using the Theme Customizer API to upload a logo for a WP theme. I also want to let the user set the css for the logo size via a number input in the same Customizer section. **What's the best way to automatically populate the the logo width and height settings with the logo's dimensions when the user uploads a image?** This is my control for the logo setting:               $wp_customize->add_control(         new WP_Customize_Image_Control(             $wp_customize,             'logo',             array(                 'label' => 'Upload a logo image',                 'section' => 'logo',                 'settings' => 'sst_logo'             )         )     );      Here is my custom control class where I have two number fields for the width and the height of the logo image:               class Logo_Size extends WP_Customize_Control {         public $type = 'text';         public function render_content() {             ?>                                      <?php echo esc_html( $this->label ); ?>                     <input class="sst-logo-width" type="number" data-customize-setting-link="sst_logo_width">                     <input class="sst-logo-height" type="number" data-customize-setting-link="sst_logo_height">                              <?php         }     }      Do I have to extend the WP_Customize_Image_Control class and modify the constructor somehow? Needless to say, OOP PHP is not my strength. Any advice will be greatly appreciated!


bypassing permission error for a plugin's page

i'm getting "You do not have sufficient permissions to access this page" error when trying to go to a plugin's settings. there's only one user which is the admin and has full access. this is the URL i'm getting this error on: store/wp-admin/options-general.php?page=wpb_vc_settings i tried to find the if statements which was about that error, like this:               if (!current_user_can('manage_options'))  {             wp_die( __('You do not have sufficient permissions to access this page.') );         }      and commented them, yet that error appeared again. even tried to delete the whole statement, nothing changed. I've searched through all the codes of the plugin with Dreamweaver but they weren't anywhere else. i'm looking for a way to bypass this.


Is it possible to import NextGen Galleries into Wordpress Galleries and convert embeds in all posts?

**Let me explain —** Until now, I have been using NextGen Gallery, and since I have a redesigned website that has image.php template (gallery attachments page), I would like to use Wordpress' built-in gallery feature instead. **Here's the problem —** I can't forever continue to monitor if NextGen Gallery plugin is working as intended on my website, even though my old posts still use it. Considering that, I would like to import and convert all NextGen galleries into Wordpress galleries. Is there a way to do this without all the hard work of having to upload gallery-by-gallery, post-by-post (I have close to 250 galleries!)?


How to customize the Categories meta box to allow only one category?

I'm trying to customize the Categories meta-box when adding a post. ![screenshot](http://i.stack.imgur.com/UkmL4.jpg) I have added a custom post and I need the administrator to post a new post without the ability to use the top level categories and also, he can just choose only one category, no more than one category!


How do I reset a rewrite?

I made a mistake in writing a previous rewrite in .htaccess. How do I reset it?   My home_url = http://basicsourcemassage.ca/bsmassage   My site_url = domain name   All pages work fine except for the home page/domain url that returns   http://basicsourcemassage.ca/bsm.basicsourcemassage.ca


Weird admin area

Everything works fine but it looks weird and I'm worried. See attached screen grab. Any ideas? ![screen grab](http://i.stack.imgur.com/V9Wj9.png)


Next and Previous links on a single taxonomy page only link to same term

I am currently using toolbox as a parent theme and have created a template file called single-projects.php where all posts of the custom post type 'projects' are shown. The previous and next buttons work well but they show the next posts in the same 'projects' post type and I need them to be in the same taxonomy as well. The code for the previous/next links now looks like this:
<?php previous_post_link( '%link', '' . _x( '←', 'Previous post link', 'toolbox' ) . ' Previous Post' ); ?>

<?php next_post_link( '%link', 'Next Post ' . _x( '→', 'Next post link', 'toolbox' ) . '' ); ?>
           This post seemed the closest to what I need http://stackoverflow.com/questions/5775197/wordpress-get-pages-taxonomy- parameter but I could not get it to work. Is there a way to only link to posts in the same taxonomy?


Wordpress ajax call returns a zero though die()

I am doing an request for a plugin. This works fine, on my testplatform (regular WP), but it makes problems on a WPMU (both latest wp versions.) This is my function:               function my_action_callback() {     $post = $_POST['shortcode'];     $post = str_replace('\"','"',$post);         echo do_shortcode($post);     die();      }      Whatcould be the issue?


Search Form Including Price

I've been searching through posts & tutorials for four days now without any luck. My background is front-end web design but the latest project calls for a little more in depth work. I'm looking to learn and code (or reverse engineer) this myself rather than installing a plug-in to do the work for me. The goal is to include a with price range options, such as $50 Under, $50-$100, $100-$150, ect (in $50 increments). The 'price' is stored in a custom field within each post (no custom post types). Any help is GREATLY appreciated, here is my current search form (as sad as it may be).               <form method="get" action="<?php bloginfo('url'); ?>">     <fieldset>          <!-- TEXT INPUT SELECTION -->     <input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />     <!-- END TEXT INPUT SELECTION -->               <!-- CATEGORY SELECTION -->     <select name="category_name">     <option value="">all categories</option>     <option value="audio">Audio</option>     <option value="computers">Computers</option>     <option value="gadgets">Gadgets</option>     <option value="gaming">Gaming</option>     <option value="movies">Movies</option>     <option value="smart-phones">Smart Phones</option>     <option value="photography">Photography</option>     <option value="tv">Television</option>          </select>     <!-- END CATEGORY SELECTION -->          <!-- CATEGORY SELECTION -->          <input type="text" value="price" name="price" id="price" />          <!-- END CATEGORY SELECTION -->                             <input type="submit" id="searchsubmit" value="Search" />     </fieldset>     </form>      Please remember I'm only a few weeks into php, so any "dumbed down" code would better help me reverse engineer! Thanks!


Prevent other editors from viewing images of other editors in Add Media Popup

Hi I have this code in my functions.php and its working well when the editor is viewing the Media library: http://example.com/wp-admin/upload.php               add_action('pre_get_posts','users_own_attachments');          function users_own_attachments( $wp_query_obj ) {          global $current_user, $pagenow;          if( !is_a( $current_user, 'WP_User') )         return;          if ( 'upload.php' != $pagenow )          return;          if( !current_user_can('delete_users') )         $wp_query_obj->set('author', $current_user->ID );          return;     }      The above code will prevent other editors from viewing the images uploaded by other editors in the media library. Only the administrator can see all images uploaded. The editor can only see the images uploaded by themselves (not others). Now here is the issue, when creating or editing a post, Wordpress has an "Add Media" button that will allow users to upload images to their gallery. But the code above does not work when the user will upload via "Add Media" popup. They can still see the images uploaded by other editors. How is it possible to modify the above code so that it will still work when users are viewing images via the "Add Media" popup and not the media library? Thank you so much for your help.


list pages only from master parent

I have a menu on a page that shows the children of a parent page, however, if a sub page is clicked on the children only of the sub page shows in this nav. is it possible to haver the direct children of the master parent page? I'm currently using the following:               $thispage = $wp_query->post;     if($thispage->post_parent!=0){         wp_list_pages("title_li=&child_of=".$thispage->post_parent);     }else{         wp_list_pages("title_li=&child_of=".$thispage->ID);     }


Random occurences of 502 Bad Gateway using Wordpress and Nginx

I am new to using Wordpress on Nginx and am seeing funny errors pop up here and there. For a while when I was searching for a new plugin through **/wp-admin/plugin- install.php?tab=search &s=captcha&plugin-search-input=Search+Plugins**, I get: **502 Bad Gateway** After a while, everything just started working again fine. However, now when I try to access anything inside **/wp-admin** I am getting a 502 error again. The front end of the site works fine. What are the steps to get things moving cleanly and to prevent this from constantly happening.


Wp_update_post: Infinite loop even with remove_action solution, OOP

I have a quite complex PHP class, reponsible for creating and printing meta_boxes, generating and saving meta fields, ... Each meta_box (object of class) has its own save function, that updates meta data of post (fields for them are instances of another class) as well as its `post_excerpt` and `post_content`. Yep, it's probably a little complicated, but as I'm only starting with OOP, I'm pretty happy with it so far. **TL;DR, THE PROBLEM** : With `wp_update_post()` called on `save_post` hook, I get an infinite loop. This issue is documented on WP codex as well as mentioned here on WPSE: How to avoid infinite loop in save_post callback. > If you are calling a function such as wp_update_post that includes the > save_post hook, your hooked function will create an infinite loop. To avoid > this, unhook your function before calling the function you need, then re- > hook it afterward. > >> Source: Codex This is a very simplified version of a code I am using:               class MetaBox {              public function __construct() {             // a lot of stuff, hooks and other function initiations             add_action('save_post',array($this,'save_box'), 20);         }              // more stuff              function save_box() {             // verify nonces, bail out on autosave, ajax, cron, ...                  switch ($this->id) {                 case 'editor':                 case 'postexcerpt':                          // remove action                     remove_action('save_post', array($this,'save_box'));                     // bail out on post_revision                     if (!wp_is_post_revision($post_id) ){                              $post = array(                             // post id                             'id'    => $post_id,                             // tosave: either post_content or post_excerpt                             // value: pulled from static associative multi-array inside MetaBox                             $tosave => self::$meta[$this->id][$this->id]                         );                         wp_update_post($post);                               }                          // add action back                       add_action('save_post', array($this, 'save_box'));                      break;                 default:                     // some saving functionality for meta values, that WORKS just fine                 break;             }         }     }      I am getting an infinite loop with PHP error notice: `Undefined index: ID in XXX/web/wp-includes/post.php on line 2987` Am I removing/adding save hook wrong? Does it have something in common with using the save function non-statically? I am of course happy to provide the rest of the relevant code, if there's no apparent problem with this structure. # EDIT The infinite loop problem is gone - as @TheDeadMedic mentioned, problem lied at not matching priority. > To remove a hook, the $function_to_remove and $priority arguments must match > when the hook was added. This goes for both filters and actions. No warning > will be given on removal failure. > > Codex: http://codex.wordpress.org/Function_Reference/remove_action # EDIT 2 As PHP is a case sensitive language, `Undefined index ID` notice problem lied in my $post array (parameter of `wp_update_meta`). The ID key must be specified uppercase.               $post = array(         'ID' => $post_id    // ID must be uppercase     )      ///// As my question turned out to be very localized, feel free to delete it. And thanks again for helping me! Thanks in advance!


What can I expect when moving from a hosted (WordPress.com) blog to one hosted by Page.ly

As I mentioned here, I'm planning to moving my blog to a new hosting provider from WordPress.com. I think I've settled on Page.ly as the new home for it, and I was hoping to get the benefit of experience from any of you who have transitioned an existing blog specifically from **WordPress.com** to **page.ly**. **Some examples of the potential issues I'm trying to ferret out:**   * Am I going to lose any WordPress.com specific features in the transition?   * Any new maintenance issues/headaches that weren't there on Wordpress.com?   * Any surprise "Upgrade" fees for things I'm used to getting for free?   * What information can I expect to lose in an export/import process (Site stats, dates on comments/posts/subscribed users/something else?)   * General tips, advice, whatever that you wish you knew before you did the move.


Conditional Query of Custom Post Type and custom taxonomy

I am working on a project that has   * a custom post type called 'Experience Statement'   * Custom Taxonomy attached to that post type called 'Expertise'   * 6 different terms for the custom taxonomy: Coastal, inland, marine, waterway, ship, telecommunications So, I have created this loop, that works great and I have created 6 different template pages with this loop in each (I just change the term for each) `<?php $page = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("post_type=experiencestatements&expertise=coastal&showposts=10&paged=$page"); if ( have_posts() ) : while ( have_posts() ) : the_post() ?>` So, this is working fine, but I have to create a different template page: i.e. page-exp-stmt-coastal.php for each term. I would like to have only one template page with conditional statements for each term instead of 6 (and counting) template pages. Having 6+ different pages means I have to go in and change each one every time the client wants a tweak. In summary, I need some help crafting a conditional tag that changes the loop depending on the taxonomy term. AND, I have no idea how to do that. Any help is greatly appreciated. Thanks, Larry


How can I create custom in-post templates?

I write posts about math and computer science. Many of those posts need some previous knowledge. I would like to create a box for some articles with links to these basics, simmilar to UbuntuUsers. In my articles I would like to add them like this               {{previousKnowledge|first|second}}      Does a plugin exist for this task? Can I create a custom template which does basically replace this text by the following?

first

second


When is admin_init Action ran?

I have this function below that is called with the `admin_init` Action               function my_flush_rewrites() {         global $wp_rewrite;         $wp_rewrite->flush_rules();     }      Like this               add_action('admin_init', 'my_flush_rewrites');      I am curious, when is this called? Is this called on every page load? Hopefully not


Recovering WP Login Credintials in Code?

Is there anyway to recover login credentials to Wordpress admin through the code somewhere? I just tried wp-config. I'm asking because my email is not primary on the account so using 'Forgot Password' wouldn't help much as I need to get in now? (I have FTP / Host access.)


Default Template infinite loop of Title

Pages which have no specific template assigned output an infinite amount of h2 page titles, which looks like this: ![enter image description here](http://i.stack.imgur.com/fcmRb.jpg) This is what my Themes index.php looks like:               get_header(); ?>         Hallo     get_footer(); ?>      Thanks for helping me out. I am new to Wordpress.


How to Emulate Default Navigation Menu Behaviour in a Custom Theme?

I'm trying my hand at developing a custom theme, and I've got navigation menus working (with the help of this walker, but only if they're explicitly defined in the menu settings. The default themes (twentyfourteen, twentythirteen) seem to be able to create a default menu solely from the existing pages hierarchy, without needing to create a separate menu structure. I've had a look around the source for the twentyfourteen theme, but as far as I can tell, the menu is generated with a standard `wp_nav_menu` call. I don't see anything that accounts for how it loads a menu when none are defined. Does anyone know how I can automatically populate my menus as the default themes do?


How can I determine where I want to edit in the backend (server)

My boss has a wordpress site and he wants me to give him the ability to add videos from a site called vzaar. I see the form, I see the main PHP file for editing posts. Unfortunately I can't track the form down to the backend file. How can I know which file I want to edit. The theme were using is called mercurial. All I need to do is add one select box and probably some backend logic. My background: I'm really familiar with Ruby on Rails, but have little experience with PHP. Seems simple enough, i'm just not super stoked about having to re-engineer the WP theme.


Wordpress Pagination not displaying posts after certain page

I'm having an issue with pagination. I have a media category, using a category-media.php template. I have a custom loop with a paged variable. There are 30 posts total. Sample:               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;          $args = array(        'posts_per_page'   =>  3,        'category_name' =>  'media',        'paged' => $paged     );          $my_loop = new WP_Query( $args );          echo $my_loop->max_num_pages . "

";          while ($my_loop->have_posts()) : $my_loop->the_post();            echo get_the_title() . "

";          endwhile;          wp_pagenavi( array( 'query' => $my_loop ) );      Pagination shows up fine and max_num_pages even echos out 10 pages. When I start clicking through the pagination links, nothing shows for pages past page 5. My reading setting are set at 6 per page. If I comment out the posts_per_page parameter, pagination works fine. I feel like it's something simple that I'm overlooking. Any ideas?


Using WP Rewrite, but just not "getting it"

I'm trying to use WP Rewrite to avoid having to enter anything into an htaccess file. So far, I have this one working just fine (it loads a post from a Custom Post Type):               $leader_structure = 'performance/leaders/%leader%';     $wp_rewrite->add_rewrite_tag("%leader%", '([^/]+)', "leader=");     $wp_rewrite->add_permastruct('leader', $leader_structure, false);      Basically, if you go to http://domain.com/performance/leaders/some-slug-here, it'll properly load the content from http://domain.com?leader=some-slug-here. However, when I try it again with a non-custom-post-type (just normal WP posts), I can't get it to work. Here's what I'm doing:               $scenarios_structure = 'our-thinking/scenarios/%post%';     $wp_rewrite->add_rewrite_tag("%post%", '([^/]+)', "name=");     $wp_rewrite->add_permastruct('scenarios', $scenarios_structure, false);      So here, I want it so that http://domain.com/our-thinking/scenarios/some-post- slug should load the single WP post. But it doesn't. When I go to that URL, it redirects to http://domain.com/some-post-slug. It's probably plainly obvious what I'm doing wrong to someone else, but I'm just not getting it. My WordPress permalink settings are set to "Post name". And my .htaccess file is untouched.


Setting up a Multisite WordPress for Wedding Websites?

I want a multi site WordPress website to make a wedding website in which the users can make their accounts for their websites, how will this actually be done in WordPress?


region selection

I'm developing a website, where the visitor has to choose it's region Europe / Asia, according to this choice the menu should be different, (most pages are the same). When I would develop this in any other environment my choice would be to put the selection in a cookie, and check the cookie in my templates. Is there another, better way to do this in wordpress? Also I think a nice way to do it would be to just put it in my .htaccess. So it would be `example.com/asia/aboutus` and `example.com/europe/aboutus`. The problem is I am also using qtranslate, so I might screw that up it would be, `/asia/en/aboutus`. So can I have this in my permalinks? * * * EDIT I have tried this method ( http://stackoverflow.com/questions/3256888/how-to- include-a-custom-string-in-a-wordpress-permalink ) and adapted it to my needs. But it doesn't seem to work. Can someone find my mistake? Thanks a lot. What happens now when i go to website.com/en/asia/about-us it changes into website.com/en/about-us and nothing else happens. **tldr** : I have, website.com/en/about-us and I want, website.com/en/asia/about-us so I can get 'asia' in my page, to change my menu accordingly. My code in functions.php               function my_rewrite_rules($rules)     {         global $wp_rewrite;              // the key is a regular expression         // the value maps matches into a query string         $my_rule = array(             '(.+)/(.+)/(.+)/?$' => 'index.php?pagename=matches[3]&my_action=$matches[2]&lang=$matches[1]'         );              return array_merge($my_rule, $rules);     }     add_filter('page_rewrite_rules', 'my_rewrite_rules');               function my_query_vars($vars)     {         // this value should match the rewrite rule query paramter above              // I recommend using something more unique than 'action', as you         // could collide with other plugins or WordPress core              $my_vars = array('my_action');         return array_merge($my_vars, $vars);     }     add_filter('query_vars', 'my_query_vars');      my code in index.php               echo esc_html(get_query_var('my_action'));       My .htaccess               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress     <IfModule mod_rewrite.c>       AddType video/ogg .ogv       AddType video/webm .webm       AddType video/mp4 .mp4     </IfModule>


Woocommerce custom email after order is submit

I want to create an custom function that can send an custom order email to an chosen supplier (in the checkout form). But when i try to get the data from the checkout in the email, the checkout form did not sent the order. I could also not complete the order. Hopefully someone could help me, and tell me what is wrong in my code. Code:               // Triggers for this email     add_action("woocommerce_checkout_order_processed", "my_awesome_publication_notification");          function my_awesome_publication_notification($post_id) {         global $woocommerce;              $post = get_post($post_id);         $checkout = $woocommerce->checkout();         $order = new WC_Order( $order_id );         $author = get_userdata($post->post_author);         $title = get_the_title();              $author_email = 'info@domain.nl';         $email_subject = 'New order recieved';         $site_title = get_bloginfo('name');         $customer_address = $woocommerce->customer->get_adress();         $customer_address_2 = $woocommerce->customer->get_adress_2();         $customer_postcode = $woocommerce->customer->get_postcode();         $customer_city = $woocommerce->customer->get_city();         $customer_country = $woocommerce->customer->get_country();              ob_start();              include("email_header.php");              ?>
             Hi, <?php //echo $author->display_name ?>. I've just published one of your articles              (<?php //echo $post->post_title ?>) on <?php echo $site_title; ?>!

Order informatie
         Adres:
 <?php echo $customer_address; ?>
         Adres (extra):
 <?php echo $customer_address_2; ?>
         Postcode:
 <?php echo $customer_postcode; ?>
         Plaatsnaam:
 <?php echo $customer_city; ?>
         Land:
 <?php echo $customer_country; ?>
                             <?php              include("email_footer.php");                   $message = ob_get_contents();              ob_end_clean();                   wp_mail($author_email, $email_subject, $message, $headers);          }          add_filter('wp_mail_content_type','set_content_type');          function set_content_type($content_type){     return 'text/html';     }


How to move wordpress blog under IIS 7 sub-folder

I have installed wordpress under wwwroot/mydomain.com/wordpress and bind it to mydomain.com port 80 under IIS 7. Then I change to bind wwwroot/mydomain.com to mydomain.com instead and change site url in wp_options to mydomain.com/wordpress. But when I try http://mydomain.com/wordpress I get 404 error from IIS. Why ? Note: I didn't change web.config               <configuration>         <system.webServer>             <rewrite>                 <rules>                     <rule name="wordpress" patternSyntax="Wildcard">                         <match url="*" />                             <conditions>                                 <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />                                 <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />                             </conditions>                         <action type="Rewrite" url="index.php" />                     </rule>                 </rules>             </rewrite>         </system.webServer>     </configuration>


How to change the path to a WP MU site?

My WP MU site is at `http://www.mydomain.com/mymu/`. I would like to change it to `http://www.mydomain.com/somethingelse/`. Can I just open up FTP and rename the folder or will that cause any issues?


WordPress XML-RPC attack

Yesterday I suffered a **DDoS attack** on my WordPress site. I had **21,443 hits** with HTTP Status code 404 and a Bandwidth of **711.85 MB**. Also, CPU usage went to 100%. Logs show a lot of this entries:               ...     119.71.5.44 - - [03/Sep/2014:18:34:57 -0700] "POST /xmlrpc.php HTTP/1.1" 404 34826 "-" "-"     197.149.17.195 - - [03/Sep/2014:18:35:01 -0700] "POST /xmlrpc.php HTTP/1.0" 404 34826 "-" "-"     210.206.226.130 - - [03/Sep/2014:18:35:04 -0700] "POST /xmlrpc.php HTTP/1.1" 404 34826 "-" "-"     ...      I'm trying to understand this log.   1. This was only a DDoS attack or they were trying to hack my site?   2. Was I under attack or they used my site to attack others? (all IPs entries are different)   3. What is the best way to stop this? Modify .htaccess file or Add a filter in functions.php


Conditional arguments  WP_Query for post custom fields

All in my case I want to get post result by Gender, Age, City etc... I am using this query. If i have any of variable like age, city, gender for that "AND" operation will perform and get only result for that variable. **Note:** Consider those case also where i have no variable like city but it should work for gender & state. My Query is               $gender = $_GET['gender'];                     $city = $_GET['city'];                     $state = $_GET['state'];                          $wp_query = new WP_Query( array(                          'post_type' => 'profile',                         'meta_query' => array(                                  'relation' => 'AND',                                 array('meta_key' => 'wpcf-gender', 'meta_value' => $_GET['gender'], 'meta_compare' => '=='),                                 array('meta_key' => 'wpcf-city', 'meta_value' => $_GET['city'], 'meta_compare' => '=='),                                 array('meta_key' => 'wpcf-state', 'meta_value' => $_GET['state'], 'meta_compare' => '==')                                                        ),                         'paged' => $paged )                      );


Change CSS on tag in tagcloud, if ther current post is tagged with the tag

My tagcloud are placed in the sidebar (outside the loop). I want to give the tags in the tagcloud a class if the current post is tagged with the tag. How do I do this? - something id wrong :( This is my PHP-code:               $tags = get_tags();     $post_tags = get_the_tags($currentid);          if ($tags) {       foreach ($tags as $tag) {         if( (is_tag($tag)) || ($tag->name == $post_tags) ){            echo 'term_id).'" title="'.$tag->name.'" class="currenttag">'.$tag->name.' ';            } else {           echo 'term_id).'" title="'.$tag->name.'"">'.$tag->name.' ';           }         }       }


Password protected posts redirects

I have a page associated with a custom template that list all password protected posts. > Let's name it **MyPage**. What I'm trying to achieve is when a user views **MyPage** to show only once the **password protected form** and when he/she enter a valid password -> to redirect back to **MyPage** so he can view the listing of the protected posts. I want on the listing template to show only one form and when the user entered his password to show only the posts with the same password (or the posts in the same category) that are unlocked. The password is the default post protection password from the publish meta box: > ![WordPress post publish meta box](http://i.stack.imgur.com/MU9tg.png)


Extra meta for a taxonomy list

I have a created a taxonomy for my wrdpress theme with check-box 3 parent each has 3 child and want to ad an extra input if user don't want my option then he can give his/her custom option can any one give me suggestion that how can i do that.               <?php          $terms = get_terms('petition',array('orderby' => 'term_group', 'parent' => 0 , 'hide_empty'=> '0' ));             $count = count($terms);         if( $count > 0 ){             foreach( $terms as $term ){                 echo ' slug.'"><input name="cb[]" value="'.$term->term_id.'" id="'.$term->term_id.'" type="checkbox"> '.$term->name.'
';                 $terms1 = get_terms('petition',array('parent' => $term->term_id , 'hide_empty'=> '0' ));                 $count1 = count($terms1);                 echo '
term_id.'_childs" style="display: none;margin-left: 20px;">';                 foreach ($terms1 as $term1){                     echo 'slug.'"><input name="cb[]" value="'.$term1->term_id.'" id="'.$term1->term_id.'" type="checkbox"> '.$term1->name.'
';                 }                 echo '<input type="text" name="'.$term->term_id.'_extra" placeholder="Or, enter a specific legislator\'s name" />';                 echo '
';             }          }     ?>      This is my code to get a custom terms and in the last i have added a static input where i want to add dynamic input or some times drop down list...


User: Editor, can't see edit taxonomy screen

For some reason the Editor role does not get access to the edit taxonomy screen on my site. Maybe that is expected behavior, I dont know - But how can I add this to the editor role capabilities?


Add mark-up after/before link in wp_list_categories

This is probably a trivia question, but I can't seem to find a simple solution. This is my wp_list_caterories php...               <?php wp_list_categories(array(         'orderby'   => 'name',         'show_count'    => 1,         'title_li'  => ''     )); ?>      This currently outputs this...
Uncategorized (8)
      I am trying to add this `<span>|</span>` before my link so the final output looks like this...
|Uncategorized (8)
      Is it possible to do this within the PHP. I could do it using jquery but I'd rather use the PHP. Many thanks for any help. Josh


Show custom taxonomy inside custom menu

I have a custom menu using `add_menu_page`:               add_menu_page('My menu' , 'Some text', 'read', 'nwcm');      Under it, I show a custom post type menu item;               // Create the news custom post type     register_post_type('nwcm_news', array(         'labels' => array(             'name' => __('News for clients', NWCM_TEXT_DOMAIN) ,             'singular_name' => __('News', NWCM_TEXT_DOMAIN)         ) ,         'public' => true,         'has_archive' => true,         'public' => true,         'show_ui' => true,         'show_in_menu' => 'nwcm',         'taxonomies' => array(             'nwcm_news_category'         ) ,     ));      Then I add a custom taxonomy hooked to that "nwcm_news" post type:               // register news taxonomy     register_taxonomy('nwcm_news_category', 'nwcm_news', array(         'label' => __('News categories') ,         'menu_name' => __('News categories') ,         'rewrite' => array(             'slug' => 'nwcm_news_category'         ) ,         'hierarchical' => true     ));      The parent menu and the custom post type both show correctly... but, the taxonomy menu isn't showing :( How can I solve this? I had checked this solution but the answer lacks the full code example..


Limit username to specific characters (A-Z and 0-9)

How do I limit the username field upon registration to `A-Z` and `0-9` for single site? So no spaces, hyphens, underscores, dots etc.


Apply Post Class to Custom Post Type

I am trying to add specific CSS post classes to the `services` custom post type. However, when I apply this function to the post class filter, it applies the function to all post types. My goal is to change the layout `services` archive page with CSS classes. Is the problem with the `if ( is_singular('services') )` portion or does it have to do with the `global $wp_query;` which might be querying every post? Any solution would be greatly appreciated. The full code:               add_filter( 'post_class', 'woo_custom_add_post_classes', 10);          function woo_custom_add_post_classes ( $classes ) {         if ( is_singular('services') ) { return $classes; }                   global $wp_query;               // Get the number of the current post in the loop.         $current_count = $wp_query->current_post + 1;              // Work out whether this post is the last in a row.              $iflast = 'last';              if ($current_count % 3 == 0 ) { $iflast = 'last'; } else { $iflast = '';}              // Add the classes to the array of CSS classes.         $classes[] = 'service-number-' . $current_count; // Service number.          $classes[] = 'threecol-one';         $classes[] = $iflast; // Last in the row or nothing               return $classes;          } // End woo_custom_add_post_classes()


accessing monthly archive from dashboard

I've been posting to my wordpress site the same way forever, not really knowing much about what I'm doing. It all seems easy. Recently I've started playing with the site and trying to access parts of the pages other than the actual posts. While in the dashboard I realized that there is no way to access the html in the monthly archive pages...or atleast I can't figure out how one does it. Can anyone tell me how I can access the html ofthe monthly archive pages from the dashboard? Thanks for any suggestions anyone can make.


How do I create a WP user outside of Wordpress and auto login?

I've built a directory of members on a non-WP site (using php and mysql). Each member can log in and update their details using a username and password. I want to be able to get this to automatically create a user on the Wordpress site using the details from the directory of members. Ideally, if they update their details on the directory of members the their user details on the WP site will update. I am not sure how this would work in terms of passwords. Both the WP and directory of members sites are on the same server and so can access each database. I'd also be able to have a link on the Directory of members that will take them to the WP site automatically logging them in. I'm not sure about this last point, particularly due to security, however I just want to avoid them having to re-enter their username and password. Is there a way to achieve the above, ideally using something that already exists?


wp_link_page - wrap current page element

I'm trying to make something more meaningful out of the `wp_link_pages()` result:               $paged_page_nav = wp_link_pages( array( 'echo' => false ) );     // Now let's wrap the nav inside
-elements     $paged_page_nav = str_replace( '<a', '
', '/a>
', $paged_page_nav );          // here I'd need to wrap the currently displayed page element          echo '
'.$pages_page_nav.'
';      Currently my link pages (numbered nav/pagination) displays like this:

1
         2
3

4

5


Why does my site flash white every time it changes page?

Any ideas? I've never had this problem before. Here is the site.


Getting a person's username from a wordpress cookie

My friend has a code that will allow users to receive a special key to gain access into into the closed/open beta event for any game they select. When a person is logged in, they can click on a link which will show them a key. If a person is logged logged in, the event page will tell them to login. What my friend needs is a way to get the person's username from the wordpress login cookie once the person has logged in. We found out that the wordpress cookie name is unique to each user that logs in (in other words it has a string of random letters and numbers in the cookie name). Any ideas? The piece of code we have on our page that we are using is this:               $username = $_COOKIE["nameofcookiehere"]      We need the $username variable so that every key that is given will be assigned to the username that is logged in based on the cookie and the key will be marked as "1" or "taken" in the database and the key will be assigned to that user in the database.


Jetpack plugin (ShareDaddy): Prevent share buttons showing on custom post types?

I noticed ShareDaddy has "Show sharing buttons on this post" for default post types but not for custom post types. I'm guessing I need to add something in `'supports' => array('title','editor','thumbnail')`. Does anybody know what I need to add in order for "Show sharing buttons on this post" to show up for custom post types?


window resizing problem

I have been working on a plugin of wordpress, in which i save the last reading position, the width and height of the browser at the time of closing the browser, I save the width and height with jquery height=$(window).height(); width=$(window).width(); and save the values in database so that when the page is loaded next time, the values are retrieved from database and the screen is scrolled to last reading position and the window get resized to the saved values. The problem that i m getting is that the window resizes to a very less value and window gets smaller, the jquery methods height=$(window).height(); width=$(window).width(); are saving lesser values, can anybody help me out in this?


Change author permalink

The original urls for users look like `/author/login/` **Is it possible to replace login by user's id?** In my dream urls should become to `/users/34/` (34 is user id). Thanks.


Display list of categories filtered by date?

I have a sidebar on our intranet which lists, hierarchically, posts by category. Such as:               -- HR     ---Events     ----Picnic      However, this list has gotten long, and some categories are no longer even used. I would like to only category links where there are posts less than a year old. Right now, I am using the default Categories Widget in the sidebar, but I can use a different widget or hand-code it. How would I best approach this?


How to setup a popup registeration page in wordpress with function.php

everyone: I wonder if there is existing tutorial on how to create a popup registration page in wordpress by utilizing function.php? or is there another way that can do with it? Thank you!


new WP_Query issues

My default wordpress set hold 10 posts per page. In category.php , I want to override this with 999 post per page, the problem is that isn't working at all. When I use the following code. it doesn't adjust alphabetically or shows 999 posts                   <?php get_header(); ?>

Selecciona el modelo de tu auto▾

Todos

Modelo

Version

Año

                 <?php                 global $query_string;                      $args = array(                   'post_per_archive_page' => '999' ,                   'orderby' => 'name',                   'order' => 'ASC'                   );                        $the_query = new WP_Query($query_string,$args); ?>                        <?php                   if ( $the_query->have_posts() ) :                     while ( $the_query->have_posts() ) : $the_query->the_post();                   ?>
<a href="#" data-filter=".<?php theSlug(); ?>-<?php getYearTire(); ?>">

<?php the_title(); ?>

<?php the_version(); ?>

<?php getYearTire(); ?>

                 <?php endwhile; endif; ?>                 <?php wp_reset_postdata(); ?>

Auto

Modelo

Version

Año

Medida

       <?php       global $query_string;            $args = array(         'post_per_archive_page' => '999' ,         'orderby' => 'name',         'order' => 'ASC'         );              $the_query = new WP_Query($query_string,$args); ?>         <?php         if ( $the_query->have_posts() ) :           while ( $the_query->have_posts() ) : $the_query->the_post();         ?>              <article class="<?php theSlug(); ?>-<?php getYearTire(); ?> <?php the_version(); ?> <?php the_options(); ?> clearfix">
<?php the_post_thumbnail(); ?>

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

<?php the_title(); ?>

<?php the_version(); ?>

<?php getYearTire(); ?>

<?php whohaveit(); ?>

<input class="btn" value="Busca" onclick="window.location='/tienda/product-tag/<?php simple_tag(); ?>'">

                 <?php endwhile; endif; ?>
               <?php wp_reset_postdata(); ?>

     <?php get_footer(); ?>      Thanks


How to improve WordPress search

I heard many times, that WordpPess's search doesn't work good. Are there any other search engines available for wordpress? I know about sphynx, seems its a good one, but available plugins are out of date. Thanks.


Event Organiser breaks the theme

I installed a plugin called Events organiser and somehow it breakes the theme when viewing an event page. Can someone help me out as I´m struggling with this and can´t find the mistake. http://throwholics.com/events/event/indoor-meeting-weltklasse-in-karlsruhe/ Thank you so much.


creating files for displaying different custom post type posts with paging

I have the following post types: Post - wordpress built in Documents - custom post type Videos - custom post type I am very new to wordpress and I do not understand the template structure. I am creating template from scratch. I have created static front-page that lists recent "posts", recent "documents" and recent "videos". SO I do not want to use front-page to display all posts. I am using %postype% permalink structure and I am also able to display single item from each custom post type. What I cannot do is:   1. I need to have link like mypage.com/posts (or very similar) to display a list of posts with paging (10 posts per page)   2. I need to have link like mypage.com/videos (or very similar) to display a list of videos with paging (10 posts per page)   3. I need to have link like mypage.com/documents (or very similar) to display a list of documents with paging (10 posts per page) I understand how to retrieve 10 posts and I will probably be able to create paging, but I do not understand template structure and heararchy and routing. **Questions** How to name the file(s) where I should add my php code (based on wordpress traditional naming)? Should I create some dummy pages? How to make routing work and take code from my newly created php file(s)? * * * Also I am not sure if this would be correct to call this archive or not taking into account that later I need to filter also posts by date combining all post types in the list.


Get specific repeater row (via advanced custom fields) based on Meta Query with Wildcards

I've used Example 5 of: http://www.advancedcustomfields.com/resources/how- to/how-to-query-posts-filtered-by-custom-field-values/ to query a post by a wildcard. However, my problem is I only want to display the row (from the repeater field) which is the same number as the wildcard within the meta query. To give this more context, here's a brief example. I have a meta query that's getting the availability of a property by the 'week' field, which is brought through via a form and $_POST data. For the example I've hard coded the value.               $search_args = array(         'numberposts' => -1,         'post_type' => 'property',         'meta_query' => array(             array(                 'key' => 'availability_%_week',                 'value' => '20140607',                 'compare' => '='             )         )     );      I need to find what the number of the Wildcard is so I can then use it to get the specific row. Any help would be greatly appreciated.


FIND and REPLACE wp_posts AND IGNORE custom post type mysql query

does exists some MYSQL query for FIND and REPLACE wp_posts AND IGNORE all other wordpress and buddypress posts (buddypress-docs) and also custom post type = portfolio ? I want to find and replace only wordpress blog content and I don't want to touch other posts. I use following MYSQL query:               UPDATE wp_posts SET post_content = REPLACE (post_content,'Item to replace here','Replacement text here');


In list with recent coments - only show one comment per page/post (latest comment)

I am trying to make a custum 'Recent Comments' code for use in the sidebar. I have come a long way, but there is just one thing that doesn't do what I'd like it to do. What I want is that, per page with comments that is found, only the last comment is shown. I was hoping post_per_page would do the trick, but it doesn't! This is my code:               <?php          $args=array(     'author_email' => '',     'ID' => '',     'karma' => '',     'number' => 5,     'offset' => '',     'orderby' => 'comment_date_gmt',     'order' => 'DESC',     'parent' => '',     'post_id' => '',     'post_author' => '',     'post_name' => '',     'post_parent' => '0',     'post_status' => 'publish',     'post_type' => 'page',     'posts_per_page' => 1,     'status' => 'approve',     'type' => '',     'user_id' => '',     'search' => '',     'count' => false     );     $comments = get_comments($args);          foreach($comments as $comment) :          ?>

     <a href="<?php echo get_author_posts_url($comment->user_id); ?>"><?php echo get_avatar(     $comment, 48 ); ?>

     <?php     $aantalcomments = get_comments_number( $comment->comment_post_ID );          ?>       <a href="<?php echo get_author_posts_url($comment->user_id); ?>"><?php echo($comment->comment_author) ?> op:
               <a href="<?php echo get_comment_link($comment->comment_ID); ?>">          <?php     echo($comment->post_name . " (" . $aantalcomments . ")
");     ?>          <?php          echo get_comment_date(' l, j F, Y ', $comment->comment_ID);          ?>

     <?php                    endforeach;          ?>


Hide page header on both index and author pages

I'm using the Roots theme which is tricky to start with. I'm trying to hide the page headers from both index and author pages. I got to do it on index by using the following code:               <?php if(!is_front_page() ){ ?>

         <?php echo roots_title(); ?>

     <?php } ?>      But when I try to add a second conditional to hide it also on author, it doesnt work. This is what I tried:               <?php if(!is_front_page() || !is_author() ) { ?>

         <?php echo roots_title(); ?>

     <?php } ?>      Any idea about what I'm doing wrong? Thanks! Eric


Plugin options not being saved or created

Having a lot of trouble with this config page. I have followed the documentation (which was sparse) and done a bit of searching for help. My problem is simple, my config options aren't being created or saved. Any help would be much appreciated! Here's the general set-up:                   public $view;              function __construct()         {             $this->view = new My_View;             // hook the settings menu             add_action('admin_menu', array($this, 'index'));             // hook the settings' settings             add_action('admin_init', array($this, 'registerSettings'));         }         /**          * setup the settings menu Page Title, Menu Title, Permissions, Menu Slug, View to render          */         public function index()         {             add_options_page("My Settings", "My menu", "manage_options", "My_Settings", array($this->view, 'index_view'));         }              public function registerSettings()         {             //options, name of option, validate function             register_setting('my_general_settings', 'my_general_settings');         }      next, the form:               public function index_view()     { ?>

Settings

                  <form method="POST" action="">
General Settings
                      <?php settings_fields('my_general_settings'); ?>                 <?php $settings = get_option('my_general_settings') ?>                      Enter your Publisher ID:                 <input type="text" name="my_general_settings[publisher_id]" value="<?php echo $settings['publisher_id']?>" />                 <input type="submit" value="Save Changes" />
Forgot your ID? Click here
             </form>
     <?php }


little help with a mySQL query to wp database

@t31os gave a very helpful response to: getting all values for a custom field key (cross-post) by providing this function               if ( ! function_exists( 'get_meta_values' ) ) {     function get_meta_values( $key = '', $type = 'post', $status = 'publish' ) {         global $wpdb;         if( empty( $key ) )             return;         $r = $wpdb->get_col( $wpdb->prepare( "             SELECT pm.meta_value FROM {$wpdb->postmeta} pm             LEFT JOIN {$wpdb->posts} p ON p.ID = pm.post_id             WHERE pm.meta_key = '%s'              AND p.post_status = '%s'              AND p.post_type = '%s'         ", $key, $status, $type ) );         return $r;     }     }      (slightly adapted) I need to adapt this function to retrieve not one but two columns; `meta_value` and `post_id`, both from the `postmeta` table and store these in an array. I'm not knowledgeable at all with `mySQL`. Any help is appreciated.


Loading Modernizr (or other JavaScript libraries) for use in a plugin

Download a copy of Modernizr, put it in your plugin’s directory and simply enqueue the script whenever needed. Done. The problem is that Modernizr **may already be loaded by another plugin**. You wouldn’t want to load it more than once. How can you find out if Modernizr is already available before enqueueing it yourself? This goes for any other JavaScript library really. You could check whether a script was loaded by using the `wp_script_is()` function. However, that function expects the **name of the handle** the script was registered by. You can only guess, right? Even if we assume the handle name is simply "modernizr", how do you check for a certain version (like 2.6.1)? Or worse, since custom Modernizr builds are possible, how do you check the features you need are included? The whole `wp_enqueue_script()` setup works fine for libraries that ship with WordPress by default, like jQuery, jQuery UI, Thickbox, etc. Their handle names are documented and you know which version to expect. WordPress doesn’t provide such master files for all JavaScript libraries, of course. Am I missing something here or is this just the messy situation you somehow have to deal with when developing plugins?


Override file in parent theme

Presumably a common question, but I'm having some difficulty as it's my first time editing WordPress themes. I'm trying to create child theme based on Zincious. This is all fine for CSS, but when it comes to editing HTML, it doesn't work. I have the same file name and path as the original. Any idea what could be going wrong? All I'm trying to do for now is comment out / delete a div. Thanks very much.


Switch to blog and get content from that blog

Anyone thinks this should not work? I can't make it work for some reason.               add_action( 'wp_head', function() {         switch_to_blog( $blog_id );         wp_query( 'p=' . $post_id );     });      The point is that instead of displaying whatever page I am about to display, I choose content from a different blog instead.


use add_action('wp_head') in a widget

Hi I cant seem to find an answer out there to solve my issue. what i am trying to do is fix this validation error 'Element link is missing required attribute property.' that is occurring because the style sheet isn't in the head. what i wanted to do was use the wp_head action to place it into the header but as soon as i add the code to the widget i have the javascript breaks completely so i dont know how to add a style to the head? this is the code i am using at the moment:               wp_register_script('piechart', get_template_directory_uri() . '/js/jquery.easypiechart.min.js', '', '2.0.4');                 wp_enqueue_script('piechart');                 wp_register_style('piechart-css', get_template_directory_uri() . '/css/jquery.easy-pie-chart.css');                 wp_enqueue_style('piechart-css');      what i am trying to do is get something like this: (this code is all in the widget function)               add_action('wp_head', 'pieChartScripts');                 function pieChartScripts() {                     wp_register_style('piechart-css', get_template_directory_uri() . '/css/jquery.easy-pie-chart.css');                     wp_enqueue_style('piechart-css');                 }      or i can write the whole link tag out etc but doing that would add it multiple times. EDIT: here is my widget function code:               public function widget( $args, $instance ) {             $title = apply_filters( 'widget_title', $instance['title'] );             $barOrPie = apply_filters( 'barOrPie', $instance['barOrPie'] );             $graphTitle = apply_filters( 'graph1_title', $instance['graph1_title'] );             $graphQuote = apply_filters( 'graph1_quote', $instance['graph1_quote'] );             $graph1Figure = apply_filters( 'graph1_figure', $instance['graph1_figure'] );             $graph1Colour = apply_filters( 'graph1_colour', $instance['graph1_colour'] );             $graph2Figure = apply_filters( 'graph2_figure', $instance['graph2_figure'] );             $graph2Colour = apply_filters( 'graph2_colour', $instance['graph2_colour'] );         ?>              <?php             $progressSlector = $args['widget_id'];                  echo $args['before_widget'];             if ( ! empty( $title ) ) {                 echo $args['before_title'] . $title . $args['after_title'];             }                  if($barOrPie == 'progressBar') { ?>                                   <?php                 echo '
';                 echo '

';                 if( !empty ($graph2Figure) )  {                     echo '

';                 ?>                                      <?php                 }                 echo '
';              } else {                 add_action('wp_head', 'pieChartScripts');                 function pieChartScripts() {                     wp_register_style('piechart-css', get_template_directory_uri() . '/css/jquery.easy-pie-chart.css');                     wp_enqueue_style('piechart-css');                 }                           wp_register_script('piechart', get_template_directory_uri() . '/js/jquery.easypiechart.min.js', '', '2.0.4');                 wp_enqueue_script('piechart');                           switch($graph1Colour) {                     case 'purple':                         $pieColor = '#78267B';                         break;                     case 'yellow':                         $pieColor = '#ffc000';                         break;                     case 'green':                         $pieColor = '#89bf3c';                         break;                     default:                         $pieColor = '#78267B';                 }                      echo '
' . $graph1Figure . '%
';                      if( !empty ($graph2Figure) )  {                     switch($graph2Colour) {                         case 'purple':                             $pieColor2 = '#78267B';                             break;                         case 'yellow':                             $pieColor2 = '#ffc000';                             break;                         case 'green':                             $pieColor2 = '#89bf3c';                             break;                         default:                             $pieColor2 = '#78267B';                     }                          echo '
' . $graph2Figure . '%
';                 }                 ?>                              <?php             }                  echo '
' . $graphTitle . '
';             echo '
"' . $graphQuote . '"
';                  echo $args['after_widget'];         }      Thanks for anyones help


Wordpress Rewrite: Ignore Specific Pattern

I want to make Wordpress Rewrite to ignore a specific pattern, here is what I mean: I have this lovely page               http://mysite.com/my-lovely-page      I want to ignore anything that contains the word "section" and comes after "my-lovely-page" to be ignored, for example this would be ignored:               http://mysite.com/my-lovely-page/section/about      By Ignored, I mean that Wordpress would return the same content as for "my- lovely-page". Is there a safe way to do it without directly modifying .htaccess ?


mysite.co.uk/wordpress redirects to mysite.co.uk?

I have seen many similar posts about similar problems, but they all seem to say delete the redirect plugin but the only plugin I have is google analytics. The site was working ok, but suddenly redirects to the main site if you enter or click a link to http://www.mysite.co.uk/wordpress it redirects to http://www.mysite.co.uk i can find no way to change this even with the .htaccess file any ideas?


Schedule a post without editing permissions

I want an user to schedule posts but I don't want the user to edit those. Is there a way to schedule draft or pending posts without the others editing permissions?


How wp_cache is supposed to work, and does it help with performance?

I was coding my recent comments widget, and using $wpdb->get_results and I wanted t use cache so it doesn't perform the query every time the page loads, so I used:               $comments = wp_cache_get('mycomments');     if ($comments == false) {         $query = //some sql stuff         $comments = $wpdb->get_results($query);         wp_cache_set('mycomments', $comments);     }     //then use $comments      and I used WP Cache Inspect plugin to check if it's working, I tried setting the $expire value in wp_cache_set in 2 ways '9999' and 9999 and deleted the cache between the 2 test but it doesn't seem to work for me, I commented on an article and it showed immediately in the recent comments so it seems that it's not caching the query for 9999 seconds, so is this how it's supposed to work or am I doing something wrong ? and thanks in advance. EDIT: I was checking the codex there's also Transients API but limited to 45 characters, so what's the difference between this and wp_cache ? this one seemd to store data in the database.


Captions for More Fields groups, not just individual fields

I'm using More Fields to create some meta boxes on my custom post type. Is it possible to have a caption for each "group" of fields in the More Fields options? I would like to provide some basic information on the post edit screen. I see you can enter a caption for each individual field but it would be handy to be able to give the group a caption also.


Custom admin_notices Messages Ignored During Redirects

I have a error handling mechanism setup in one of my plugins to add notices and errors to the admin area, just like the core does. It works fine in most cases, but there are some situations (like saving a custom post type) where it doesn't. I'm guessing that a redirect is happening behind the scenes, and the messages are being printed before the redirect happens, so that they appear to never show up. So, I'm guessing this is what's happening   1. User edits a custom post type and hits Publish   2. My post_updated callback is called, which validates and saves the custom fields   3. The callback adds an error message   4. Wordpress does a redirect to a some page to do some processing   5. My admin_notices callback is called, which prints and clears the messages   6. Wordpress redirects back to the post   7. My admin_notices callback is called again, but there are no messages to print because they were printed in step #5 Under normal circumstances steps 4 and 5 don't happen, so everything works fine, but I think when Wordpress saves posts it introduces the extra redirect. Is something I can do to make sure this always works? I was thinking I might be able to check something inside printMessages() and return immediately if it's at step 4, but I'm not sure what. These two questions may shed some light on the problem, but don't fully give a solution: Add validation and error handling when saving custom fields?, How to display admin error notice if settings saved succesfully?. Here's the code:               /**      * Constructor      * @author Ian Dunn <redacted@mpangodev.com>      */     public function __construct()     {         // Initialize variables         $defaultOptions         = array( 'updates' => array(), 'errors' => array() );         $this->options          = array_merge( get_option( self::PREFIX . 'options', array() ), $defaultOptions );         $this->updatedOptions   = false;         $this->userMessageCount = array( 'updates' => 0, 'errors' => 0 );         // more              add_action( 'admin_notices',    array($this, 'printMessages') );         add_action( 'post_updated',     array($this, 'saveCustomFields') );              // does other stuff     }          /**      * Saves values of the the custom post type's extra fields      * @author Ian Dunn <redacted@mpangodev.com>      */     public function saveCustomFields()     {         // does stuff              if( true ) // if there was an error             $this->enqueueMessage( 'foo', 'error' );     }          /**      * Displays updates and errors      * @author Ian Dunn <redacted@mpangodev.com>      */     public function printMessages()     {         foreach( array('updates', 'errors') as $type )         {             if( $this->options[$type] && ( self::DEBUG_MODE || $this->userMessageCount[$type] ) )             {                 echo '
';                 foreach($this->options[$type] as $message)                     if( $message['mode'] == 'user' || self::DEBUG_MODE )                         echo '
'. $message['message'] .'
';                 echo '
';                      $this->options[$type] = array();                 $this->updatedOptions = true;                 $this->userMessageCount[$type] = 0;             }         }     }          /**      * Queues up a message to be displayed to the user      * @author Ian Dunn <redacted@mpangodev.com>      * @param string $message The text to show the user      * @param string $type 'update' for a success or notification message, or 'error' for an error message      * @param string $mode 'user' if it's intended for the user, or 'debug' if it's intended for the developer      */     protected function enqueueMessage($message, $type = 'update', $mode = 'user')     {         array_push($this->options[$type .'s'], array(             'message' => $message,             'type' => $type,             'mode' => $mode         ) );              if($mode == 'user')             $this->userMessageCount[$type . 's']++;              $this->updatedOptions = true;     }          /**      * Destructor      * Writes options to the database      * @author Ian Dunn <redacted@mpangodev.com>      */     public function __destruct()     {         if($this->updatedOptions)             update_option(self::PREFIX . 'options', $this->options);     }         * * * ~~**Update:** The updated code with the accepted answer has been committed to core.php in the plugin's trunk in case anyone wants to see a full working copy. The next stable release that will have it is 1.2.~~ **Update 2:** I've abstracted this functionality into a self-contained library that you can include in your plugin. Core is discussing including similar functionality in #11515.


How can I just get content inside a shortcode or just outside

Suppose I have content like               [xxx]     Here is some content in xxx      [/xxx]          Here is content outside xxx ...      Can I somehow just get   1. content inside `[xxx]` ONLY   2. content outside `[xxx]` ONLY


Custom Theme With Custom Loops

There are so many different questions on how to make pages show page numbers at the bottom but I can't seem to use the concepts explained in those to solve my own problem. I know some PHP and I've used Wordpress for a few years, but this (that seems like it should be simple) is way over my head. I'm currently working with a pre-made template called Zine. I have nearly everything else how I want it but this page number thing is killing me. I'll admit that I've found a few things here and there that are inefficient or wrong in the code and certain features don't actually work. Furthermore, the support over at the creator's site is sub-par and they usually just direct you to a vague Codex article. The front page of the blog I'm working on shows the latest posts but it refuses to show page numbers. This gets confusing because it calls to a different part of the template which in turn calls to another, different part of the template (I think). The page in question is Chainsaw Creative So, here we go. The static page shown as the index is here: http://pastebin.com/zxZg1ZWd It works just fine, but, as I said, there are no page numbers but the loop can be found somewhere else. I don't use the custom post-types in that page so the code `<?php get_template_part('last', 'all'); ?>` seems to call back to this loop:               <?php      global $theme;     $args = array(      'post_type' =>  bd_post_types() ,     'orderby' => 'post_date',     'posts_per_page' => 5     );          $loop = new WP_Query($args);         if($loop->have_posts()): while ($loop->have_posts()) : $loop->the_post(); ?>             <?php get_template_part('loop', 'all'); ?>         <?php endwhile; ?>         <?php endif; ?>      Which in turn seems to call back to this loop:                   <?php if(get_post_type( $post->ID )=='post'): ?>                  <?php get_template_part('loop', 'post'); ?>              <?php elseif(get_post_type( $post->ID )=='music-reviews'): ?>                  <?php get_template_part('loop', 'music-reviews'); ?>              <?php elseif(get_post_type( $post->ID )=='movie-reviews'): ?>              <?php get_template_part('loop', 'movie-reviews') ?>          <?php elseif(get_post_type( $post->ID )=='game-reviews'): ?>              <?php get_template_part('loop', 'game-reviews') ?>          <?php elseif(get_post_type( $post->ID )=='book-reviews'): ?>              <?php get_template_part('loop', 'book-reviews') ?>          <?php endif; ?>      I've tried all that I can to edit the loop that I posted in here, but I can't make it show page numbers. The most success I've had is changing `'posts_per_page'` to -1 and making it show all posts. I've tried adding the $paged variable among other things, but none of those seem to work. An example of what I'm trying to do can be found on an author page of the same blog. Hopefully that's a good enough explanation as to why the rest of the "Custom Template Pagination" posts haven't been helping me. I've also created custom page templates to show posts from specific categories only but I feel like solving this problem will solve that one as well.


Typical wp_kses $allowed

I have a custom post textbox that I want to sanitize using `wp_kses` before I update my post meta. I was looking for examples of common `$allowed` settings, but I have only seen this example:               $allowed = array(               'a' => array( // on allow a tags                   'href' => array() // and those anchors can only have href attribute               )           );        What is a typical `wp_kses` `$allowed` setting? Can someone provide an example of what they normally filter for?


Page only shows when user is logged in (even with visibility set to public)

I'm trying to troubleshoot an issue on a client's site. There is one specific page which appears as "not found" unless you log in and then visit the front end, in which case it appears normally. The visibility on the page is set to public, and in every other way it's a normal boring wordpress page. Stranger still, it only started happening recently (after months of trouble-free use). Problem page: http://www.leecamp.net/schedule/ Any ideas why this would happen?


Add 1 category more to If_in_category statement

**Hey everyone, a simple question.** # Question I need to add one more category: Events in the if statement along with News which is stated in the code. How can I add it? **_Thank You very much :)_** # Code               <?php if (in_category('News')) : ?>


Why is WordPress changing my HTML code

I've been playing around with CSS and HTML code and I finally got to the point where the section I was working on works. I saved my CSS, and updated my post, and everything looked great, but when I returned to the post and switched from the HTML tab to the Visual tab WordPress altered/deleted my HTML code. I re-entered my HTML code in the post, saved it while still in HTML view and the post appears exactly the way I want it to look. My Post \- The Bobby Ore quote is what I was working on. I saved/updated while still in HTML view, so the code appears to work. Here's the HTML code that I entered into the HTML view of my post:
<quote class="open">&#8220</quote><quote class="font">Forget about style; worry about results.</quote><quote class="cite">~ Bobby Orr</quote><quote class="close">&#8221</quote>
      After switching to the Visual tab and back to the HTML tab, the HTML code now looks like this:
&#8220Forget about style; worry about results.~ Bobby Orr&#8221
      Help???


Hardcoding links to wp_nav_menu

I am currently trying to add a some links to the end of my wp_nav_menu but am having a hard time with the callback function that creates the list of languages I want to insert. The first function is from a WPML plugin and works correctly anywhere else.               function lang_selector_links(){          $languages=icl_get_languages('skip_missing=0&orderby=code');              if(!empty ($languages)){                  foreach ($languages as $language){                 echo '
<a href="' . $language['url'] . '" title="' . $language['translated_name'] . '"'. $language['language_code']. '
';             }              } else {             echo 'no languages';         }     }           function my_lang_links( $items, $args ) {             $lang_list= lang_selector_links();                  $items .= '
' . $lang_list . '
';              return $items;     }     add_filter('wp_nav_menu_items','my_lang_links', 10, 2);      If I call `lang_selector_links()`in any other context it works as expected and outputs a list of supported languages but I can't seem to call it within the filter. **Edit: It turns out that it is outputting them only I was expecting the links to be part of the unordered list that contains the other menu items. Instead it adds them before.**


Why do I need to register my custom post type a second time when flushing rewrite rules?

If I register my custom post type when the `init` action fires (which is before plugin activation) why do I need to register my custom post type a second time when flushing rewrite rules (on plugin activation)? See the following example.               add_action( 'init', 'my_cpt_init' );     function my_cpt_init() {         register_post_type( ... );     }          function my_rewrite_flush() {         my_cpt_init();         flush_rewrite_rules();     }     register_activation_hook( __FILE__, 'my_rewrite_flush' );


add an image field to wordpress category

i am trying to add an image field to the wp_term table in the database, I'll call it icon. I want that filed to contain a URL to an image that will be the thumb for the category. I have already added the field to the DB and I have also inserted it into the code in the admin panel :               <?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?>
         <?php _ex(' Icon', 'Taxonomy Icon'); ?>	         <input name="icon" id="icon" type="text" value="<?php if ( isset( $tag->icon ) ) echo esc_attr($tag->icon); ?>" size="40" />
<?php _e('The “icon” is the URL to the category icon. if it is an uploaded image it will be http://'.$_SERVER['SERVER_NAME'].'/wp-content/uploads/{your_file.name}.'); ?>

     <?php endif; // is_taxonomy_hierarchical() ?>      the code shows the content from the database if it is preset but doesnt update it. what/where do i need to add so that it will also update the DB icon field? thank you.


Allowing users to edit only their page and nobody else's

We currently have about 50 pages, each of which I want a user (eg, bob, rob, smith) to be able to edit only 1 page. For example, bob & smith each have their own page. I do not want bob to be able to edit smith's page. I want bob to ONLY be able to edit bob's page. I don't care if he can see other pages. Looking through the user roles, I don't see a way to currently to do this- I only see how to allow restrict access on a global scale. Are their any plugins to help restrict edit access per user, or roles restricted to editing specific pages and I can just add 1 user per role? Or was there a way to do this with default settings I missed.


Change default options on attachment page

I'm currently adjusting someone's plugin, and they're pulling data from the attachment page. Rather than edit the whole plugin entirely, I'm after a quick fix. Is it possible to change the wording on the attachment page? I'm ideally trying to change the word 'caption' to the word 'buy' — but I'm unsure how to override the wording shown? Any help would be great. Cheers.


My galleries are messed up

I am running wp 3.9.1. I am using jetpack and using the carousel option. Lately, when I click on an image, the carousel does not work, the black background appears, but to see the image, I need to scroll down where it appears (the background disappears while scrolling so when the photo appears, it overlaps with the rest of the post) and sometimes the picture is of very low quality. The caption and "comments" space appears much lower. it does not make any sense. I asked my theme support for help and they could not fix it. They suggested I deactivate my plugins and reactivate them (especially digg digg). That did not seem to work. I cleared my cache and all, but the issue is still there! What can I do? Thank you!


Custom post type - permalink

Is it possible to change the permalink of a custom posttype? I have a custom post type called "events", I have made a page called archive- event.php and this is reached by /event.php is it possible to change this into something else? Like /foo.php?


subdirectory install breaking existing links

I've had this issue several times now. While building a site, including some content, I keep wordpress in a subdirectory (say, `/wordpress/`). When putting it live, I move/copy 3 files out of the dir into the root, in accordance with the WordPress specifications here http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory#Using_a_pre- existing_subdirectory_install It works, but all the links already entered in content refer to /wordpress/bla/bla and will, after the move, return 'file not found'. Also, links previously sent in emails and links already indexed by Google will return file not found. My question is: is this behaviour as designed, or am I doing something wrong ? Please note: my question is not how to fix it. It's easy enough to add some lines to the root .htaccess to say 'for every request inside `/wordpress/`, if it doesnt exist, remove the word `/wordpress/` and try again', so I'm surprised wordpress doesn't do that by itself - this makes me think I'm doing something wrong ... *-pike


Get Comment Author ID on the fly while posting

I am adding custom data to custom table while author posting a comment. Please find my code in my own answer here http://wordpress.stackexchange.com/a/85109/9821 Now I want to add one more column of 'author_ID' and not able to get the comment author id on the fly. Can anyone help me to get comment author id on the fly and insert into custom table column `author_ID` Thanks a lot


wordpress apply filters and is singular()

I'd like to know whether anybody has heard of , or created a workaround to the following problem: let's say there is a plugin which has code like this,               add_filter('the_content'.'some_func');     some_func($content)     {         if(is_singular())         {         //do something and return the content         }         else         {         //just return the content,dont modify it in any way.         }     }      now in my plugin there is code like this                   $doggy = apply_filters('the_content',$content)      but because the author of the earlier plugin has specified the is_singular, my $doggy WILL NOT get the content with the changes that the earlier plugin would have applied otherwise. As a result i wont be able to use the actual final content to do whatever i want in my plugin. Any help is appreciated, since i just read an article where the author says, "the is singular has been designed so that the filters apply only within the main WP query." So i have an additional question - as to whether there is any way to intercept this. I would like to use this apply filters action inside my code like this,               wp_insert_post_data($data,$postarr)     {     $data["post_content"] = apply_filters('the_content',$data["post_content"])     $data["post_content"] = my_func($data["post_content"]);     return $data;     }      and manipulate the story content, after applying all the filters that would be eventually applied to the content, and then returning the data. I hope i have explained things clearly. I need a workaround, since i dont think an official solution exists. AND-- doing what i need to do ---using--- save post or publish post is NOT AN OPTION FOR MY PURPOSE. Also i cannot do this on the_content filter. I NEED A SOLUTION THAT WORKS BEFORE THE POST DATA IS INSERTED INTO THE DATABASE. SO please do not suggest that. Best Regards, app_maniac.


How do I render a navigation menu like my theme does?

I am using the theme suffusion, and I'm trying to add a custom navigation menu to only one of my pages.   I've managed to get it almost working using this in my page template:               if(is_page('123')     {         wp_nav_menu( array( 'menu' => 'my-menu' ) );     }      Where `'123'` is the page id of the page that I want, and `'my-menu'` is the menu I want. The page is using the correct template. The correct items are generated with appropriate links, but they are rendered as an unordered list like so: >   * Item 1 >   * Item 2 >   * Item 3 >   * Item 4 > If I have the menu bar rendered by my theme (by placing it in one of the slots in the dashboard), it renders this menu horizontally as attractive-looking buttons. When I do it this way, it correctly only shows up on the page that I want, but is rendered as a vertical bulletted list. What do I need to change so that the menu is rendered as if done by the theme?


contact form 7 database short codes

I am using contact form 7. I have successfully added to my page, Now I want to export the database onto a separate page with short code. I have the following code, but it results in the following error. **\Code**               <?php     echo do_shortcode('[cfdb-html form="Contact form 1" show="Submitted,your-name"]${your-name}${your-email}${your-message}[/cfdb-html]');     ?>      **\Error**               Fatal error: Call to undefined function is_plugin_active() in /Users/anderskitson/Sites/fiftyfity/wp-content/plugins/contact-form-7-to-database-extension/CF7DBPlugin.php on line 654


Proper use of option_page_capability_{$page_name}

I am having trouble giving access to an options page to Editors. I am pretty sure I need to use the filter `option_page_capability_{$page_name}` but it is not working for me. Is there a specific place to hook this? I am still getting the `Cheatin', uh?` error with this:                   function bf_ins_capability(){             return 'edit_posts';         }              add_filter( 'option_page_capability_brightfire-insurance-settings', 'bf_ins_capability' );


JSON API similar plugin can't set custom fields

I'm trying to use a similar plugin to JSON API, called ScrollBlog. I'm using two custom fields, an external link and an author's name. JSON API parses them ok, but when I try to use ScrollBlog (coding is fairly identical), it doesn't. This is the code in the post.php model for custom fields:                 function set_custom_fields_value() {         global $json_api;         if ($json_api->include_value('custom_fields') &&             $json_api->query->custom_fields) {           $keys = explode(',', $json_api->query->custom_fields);           $wp_custom_fields = get_post_custom($this->id);           $this->custom_fields = new stdClass();           foreach ($keys as $key) {             if (isset($wp_custom_fields[$key])) {               $this->custom_fields->$key = $wp_custom_fields[$key];             }           }         } else {           unset($this->custom_fields);         }       }      Any clues to why it doesn't work? Also, I'm new to JSON so bare with me! Thank you! Update: If I use the code from JSON API's file, the website doesn't work anymore (turns blank).               function set_custom_fields_value() {              global $json_api;         if ($json_api->include_value('custom_fields')) {           $wp_custom_fields = get_post_custom($this->id);           $this->custom_fields = new stdClass();           if ($json_api->query->custom_fields) {             $keys = explode(',', $json_api->query->custom_fields);           }           foreach ($wp_custom_fields as $key => $value) {             if ($json_api->query->custom_fields) {               if (in_array($key, $keys)) {                 $this->custom_fields->$key = $wp_custom_fields[$key];               }             } else if (substr($key, 0, 1) != '_') {               $this->custom_fields->$key = $wp_custom_fields[$key];             }           }         } else {           unset($this->custom_fields);         }       }


Ipad app: Need uploaded images to go into "Gallery" as well as "Media Library"

When I upload an image on my desktop, the image is added to   * Media Library   * Gallery Media Library shows all images that have been uploaded to date, while Gallery only shows images which are associated with this Post. Using the Wordpress ipad app, however, the image **only appears in the Media Library**. Is there any way to get new images uploaded to appear in the **Gallery** as well as the **Media Library**? * * * I need this functionality because I have a function which creates a nice javascript gallery from the items in the **Gallery** , and the users of the site are not HTML-aware. * * * I would be happy to get answers that include a different blogging or image app that will do this for me.