wp_query pagination links producing 404

I've searched thousands of related posts and can't seem to get the pagination to work on this loop. As soon as i click next page i get a 404               //get the search term     if (!empty($_GET["s"])){     $s = $_GET["s"];          //the search form will have an input value of "Search..." if nothing has been selected. We need to clear      if ($s=="Search..."){         $s='';     }     }          $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $limit = 10;          $args = array(         //the user inputed search term         's' => $s,         'post_type' => 'schools',            'posts_per_page' => 5,         'paged' => $paged,         //we use tax_query here to query the schools custom taxonomy.          'tax_query' => array(             'relation' => 'AND',             array(                 //name of school categories (custom taxonomy)                 'taxonomy' => 'school_category',                 //we are going to search by matching category ids                 'field' => 'id',                 //the array we created that contains all the category ids to be searched                 'terms' => $category_and,                 //we want to make sure only posts in all of the categories selected are shown.                 'operator' => 'AND'             ),             array(                 //name of school categories (custom taxonomy)                 'taxonomy' => 'school_moi',                 //we are going to search by matching category ids                 'field' => 'id',                 //the array we created that contains all the category ids to be searched                 'terms' => $category_MOI,                 //we want to make sure only posts in all of the categories selected are shown.                 'operator' => 'AND'             ),             array(                 //name of school categories (custom taxonomy)                 'taxonomy' => 'school_curriculum',                 //we are going to search by matching category ids                 'field' => 'id',                 //the array we created that contains all the category ids to be searched                 'terms' => $category_cur,                 //we want to make sure only posts in all of the categories selected are shown.                 'operator' => 'AND'             )              )          );          //The new query with our arguements     $wp_query = new WP_Query( $args );          woo_loop_before();          if ($wp_query->have_posts()) { $count = 0;          $title_before = '
';     $title_after = '
';          //echo $title_before . sprintf( __( 'Search results for "%s"', 'woothemes' ), get_search_query() ) . $title_after;             ?>

          <?php         //Make sure the search results take into account the categories chosen on the seach bar              while ($wp_query->have_posts()) {$wp_query->the_post(); $count++;                  if (get_option('woo_woo_tumblog_switch') == 'true') { $is_tumblog = woo_tumblog_test(); } else { $is_tumblog = false; }                  woo_get_template_part( 'content', 'search' );              } // End WHILE Loop                        next_posts_link('« Next');         previous_posts_link('Previous »');              //wp_reset_postdata();            } else {     get_template_part( 'content', 'noposts' );       } // End IF Statement                 woo_loop_after();      I have the **blog pages show at most option** set to 1. Help would be really appreciated! Thanks


Qtranslate Vs Theme My login

am facing a problem with Qtranslate and Theme my login plugin my default language is Ar, when i go to Edit Profile in English Lang, and i update my profile, its redirect me to the Arabic Language, example : my current url is :   websitename.com/your-profile/?lang=en After Updating Post : websitename.com/your-profile/?updated=true it should be   websitename.com/your-profile/?updated=true&lang=en ( If En)   websitename.com/your-profile/?updated=true&lang=ar ( If Ar) i tried lot of solutions online, but i can't find any solution work with me i tried this Patch and isn't working too :/ i need a code, plugin modification to detect language from Current URL and keep it after redirect.( i don't mind manual modification for the plugin ) i tried this solutions and none get worked :               <input type="hidden" value="<?php if(isset($_GET['lang']) && $_GET['lang']=="ar") echo "ar";else echo "en";?>" name="lang" id="lang"/>      so the output of my form is                 <form id="your-profile" action="/your-profile/" method="post">     <input type="hidden" value="en" name="lang" id="lang"/>     <input type="hidden" id="_wpnonce" name="_wpnonce" value="6982ecbbe4" />     <input type="hidden" name="_wp_http_referer" value="/your-profile/" />      I guess the problem is here it should be /your-profile/?lang=ar or ?lang=en


Why is Wordpress custom post type not showing in admin panel?

Every time I create a custom post type, the label never shows on the left admin panel, However, they do show when you click on manage post type.. Not sure what is going on.


How to disable (get rid of) home page main loop entirely?

I'm using a custom theme, the index page doesn't depend on the main loop for home (which by default get the latest 10 posts for example). How can I get rid of the home loop entirely, so the index doesn't request any additional data from the database?


How to add terms (without deleting others)

I have a form on my site that allows signed in users tag products from the front-end of the site in a basic form. I am using Woocommerce as the commerce platform. Woocommerce uses Custom Post Types to register its products. Product tags is a taxonomy (product_tag) Woocommerce uses for tagging products. I am using wp_set_object_terms to insert the terms the users submit. Problem is when they submit new "tags" it overwrites any existing "Tags" and replaces with their new ones. I just need a way for the form to add their tags and keep the existing tags of the product (post). here is what I have:               if (is_user_logged_in()) {                   if(isset($_POST['submitted']) && isset($_POST['post_nonce_field']) && wp_verify_nonce($_POST['post_nonce_field'], 'post_nonce')) {                   //Tagging         wp_set_object_terms( $post->ID, explode( ',', $_POST['postTags'] ), 'product_tag' );          }          ?>     <form name="primaryTagForm" action="#" id="primaryTagForm" method="POST" enctype="multipart/form-data" >         <fieldset class="tags">             <label for="post_tags">Tags:</label>             <input type="text" value="" tabindex="35" name="postTags" id="postTags" />         </fieldset>              <fieldset>             <input type="hidden" name="submitted" id="submitted" value="true" />             <?php wp_nonce_field( 'post_nonce', 'post_nonce_field' ); ?>             <button class="button" type="submit"><?php _e('Tag Product', 'framework') ?></button>         </fieldset>     </form>


Creating a WordPress admin page without a menu for a plugin

I am writing a plugin, that will list a number of entries from a custom set of tables. I added the main page for the plugin using the following WordPress functions:               // Add menu and pages to WordPress admin area     add_action('admin_menu', 'myplugin_create_top_level_menu');          function myplugin_create_top_level_menu() {         add_menu_page('MyPlugin', 'MyPlugin', 'manage_options', 'myplugin-top-level-admin-menu');         add_submenu_page('myplugin-top-level-admin-menu', 'MyPlugin Admin Page', 'Admin Page', 'manage_options', 'myplugin-top-level-admin-menu', 'myplugin_admin_page');     }          function myplugin_admin_page {         // Code to display the admin page for my plugin (both php and html code)         // This includes the following seudo code (in php)         foreach ($results_from_db as $result) {             // CODE TO DISPLAY RESULTS IN AN HTML TABLE *** I NEED HELP HERE ***         }     }      Now, if you read the above code closely, you note that there is a comment that states **'I NEED HELP HERE'** ; here are more details: I know how to display everything on the the admin page that I created. The admin page will read from the custom tables, and display results as HTML table rows. I only need to link each row to a page, lets call it **'Entry Details Page'**. The idea is, for each row in the HTML table, there will be a link, and when I click on that link, it will take me to another page that displays more details about that row. I was thinking of using add_submenu_page as described here, but honestly I did not understand how to use it and how to include it in my code. I tried something like this but I think it is wrong:               function myplugin_admin_page {         // Code to display the admin page for my plugin (both php and html code)         // This includes the following seudo code (in php)         foreach ($results_from_db as $result) {             // CODE TO DISPLAY RESULTS IN AN HTML TABLE *** I NEED HELP HERE ***                  // The following line of code is incorrect, but to show you the idea             echo 'View';              }     }          myplugin_details_page () {         // Code to display the details page     }      Now, the two problems I am facing are:   1. How to add the details page correctly (it is clear that what I am doing above in the second code snippet is incorrect)?   2. How to include params in the details page (I need to pass a row id to view the details)? I think I am really close to solving the problem, however I could not find enough documentation to finish it, so please help, and I really really thank you. Cheers.


Sorting posts by first letter of the last word in title

I have a CPT called `author` that has a first name and a last name as title. To alphabetically sort these posts by surname I use this filter:               function posts_orderby_lastname ($orderby_statement)      {       $orderby_statement = "RIGHT(post_title, LOCATE(' ', REVERSE(post_title)) - 1) DESC";         return $orderby_statement;     }      Works fine except for the few authors who have a nickname (only one word). Those are returned together first, then all the "normal" authors with first and last names come afterwards in alphabetical order. How to make it work with all authors including those with a one-word nickname?


How to create a Custom Meta Box with Name/Value Admin User Input Fields?

I have researched many tutorials on how to create/add Custom Meta Boxes using the `add_meta_box()` Wordpress function. I can not find any example where the finished Meta Box has the option for an Admin User to input both **key/value** pairs like Custom_Fields? EDIT: Removed plugin link URL as not enough rep points: I want to add this capability to my own Custom Meta Boxes and to the WebDevStudios/Custom-Metaboxes-and-Fields-for-WordPress plugin's Meta Box fields. To clarify, I want to create a Meta Box that Admin Users can add Name and Value to - like is shown in this image taken from the WP's own Custom Fields Meta Box : ![enter image description here](http://i.stack.imgur.com/EJnQK.jpg) Edit 19.06.14: My understanding of `Custom Fields` was incorrect, when querying on the front end:                       printf( '
%s
', var_export( get_post_meta($post->ID,"my_custom_filed_key"), true ) );      I see that `my_custom_field_key` produces an index array:               array (     0 => 'val  1',     1 => 'val  2',     2 => 'val  3',     )      I suppose what I am trying to achieve is an associative array?               array (     'my key name 1' => 'my val 1',     'my key name 2' => 'my val 2',     'my key name 3' => 'my val 3',     )      Here is the `add_meta_box` function part of my code:               function my_meta_boxes($post) {             add_meta_box(                 'my_meta',          // Unique ID                 esc_html__( 'Reviews', 'example' ), // Title                 'my_meta_box',  // Callback function                 'my-post',          // Admin page (or post type)                 'side',               // Context                 'default'             // Priority             );      }          /* Display the post meta box. */     function my_meta_box() {              wp_nonce_field( basename( __FILE__ ), 'my_post_nonce' );                   $meta = get_post_custom($post->ID);             $meta['my_meta'] = maybe_unserialize($meta['my_meta'][0]);             ?>

                     <textarea style="width:90%;" rows="1" name="my_meta[]"> <?php echo $meta['my_meta'][0] ?></textarea>

                     <textarea style="width:90%;" rows="1" name="my_meta[]"> <?php echo $meta['my_meta'][1] ?></textarea>

                     <textarea style="width:90%;" rows="1" name="my_meta[]"> <?php echo $meta['my_meta'][2] ?></textarea>

     <?php }      I am wondering if the `add_meta_box` $callbacks_args would help me here, but I am yet to full understand it? Thank you.


PHP help get_template_directory + PHP include

Sorry my PHP skills are lacking. I want to use a php include in WP but I'd like to get the file path with `<?php get_template_directory(); ?>` I can't figure out how that would look. My non WP file looks like this:               <?php include 'inc/social.php'; ?>      Basically I don't know how to string two PHP commands together `get_template_directory` \+ include.


Sidebar widget to show popular post not working?

This is the code to display popular post on front end, however the problem is the data is not saving from the back end. Like i want to show only 3 popular posts on front-end so i select the option 3 but its not saving. However when i pass the static value for `$popularpostcount` then this code works `echo $this->popularPosts($popularpostcount);` so i believe the problem is only saving the selected option. I am new to plugin development so please let me know what mistake i am making while the development.               <?php     /*     Plugin Name: Popular Post Widget     Plugin URI: http://demo.test.com     Author: Swapnesh Kumar Sinha     Description: This is a plugin to show popular posts in sidebar as a widget.     Version: 1.0     Author URI: http://swapneshsinha.wordpress.com     */                    class PopularPostWidget extends WP_Widget {          public function __construct() {         //Widget actual processes         $widget_options = array( 'Description' => 'Show Popular Posts' );         parent::__construct( 'PopularPostWidget', 'Popular Post Widget', $widget_options);      }          public function form( $instance ) {         //outputs the options form on admin     $instance = wp_parse_args( (array) $instance, array( 'popularpostcount' => '' ) );     $popularpostcount = $instance['popularpostcount'];       echo $popularpostcount;     echo "Number of post to show ";      echo "<select name='popularpostcount' id='popularpostcount'>";         for( $i =1; $i<=5; $i++ )         {             if ( $i == $instance['popularpostcount'] )             echo "<option value='".$i."' selected>".$i."</option>";             else             echo "<option value='".$i."'>".$i."</option>";         }      echo "</select>";     }          public function update( $new_instance, $old_instance ) {         //processes widget options to be saved         $instance = $old_instance;         $instance['popularpostcount'] = $new_instance['popularpostcount'];         return $instance;     }          public function widget( $args ,  $instance ) {         //outputs the content of widget         extract($args);         $popularpostcount = apply_filters('widget_title', $instance['popularpostcount']);         echo  "
Most Popular Posts
";         echo  "
";         echo $this->popularPosts($popularpostcount);         echo  "
";     }               public function popularPosts($num)     {          global $wpdb;              $posts = $wpdb->get_results("SELECT comment_count, ID, post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , $num");              foreach ($posts as $post) {             setup_postdata($post);             $id = $post->ID;             $title = $post->post_title;             $count = $post->comment_count;                  if ($count != 0) {                 $popular .= '
';                 $popular .= '' . $title.' '." - ".$count;                 $popular .= '
';             }         }         return $popular;     }               }          add_action( 'widgets_init' , create_function('', 'register_widget( "popularpostwidget" );' ) );


Adding custom cron_schedule prior to wp_schedule_event

I am trying to add a custom `cron_schedule` interval inside a plugin and then use that custom interval to schedule a cron event when the plugin is activated. It seems that the custom interval is not available though when the activate code is executed. Using any of the default intervals adds the scheduled event, but if I try to use the custom one, it doesn't get added. The custom interval is indeed added (I can see it by echoing `wp_get_schedules`) but isn't available when I try to add the scheduled event on activation. My problem seems to be fairly identical to this one: Using wp_cron with custom time interval and the register activation hook But, I've already tried removing underscores from my hooks and the event is still not scheduled using the custom interval. All the default intervals work, though. Any thoughts on how I can get this to work?               private function __construct() {       // Add custom cron schedule       add_filter( 'cron_schedules', array($this, 'add_custom_cron_schedule' ));     }          public function add_custom_cron_schedule( $schedules ) {       $schedules['minute'] = array(         'interval' => 60,         'display' => __( 'Every Minute', $this->plugin_slug )       );            return $schedules;     }          // Called from register_activation_hook, this doesn't get added     // when using 'minute', but will work if using a WP default like 'daily'     public static function single_activate() {        wp_schedule_event( time(), 'minute', 'cronFunction' );     }


How do I setup nested repeatable option fields?

I'm trying to wrap my head around how to create a set of option fields that should be able to repeat for as many times as possible. But I'm having a hard time to figure out how to proceed. Currently I've setup the visual interface for administering the options, but I have no idea how to save them into the options on save. How would a logic look like that will be able to differentiate between different sections? Keeping each section as a separate array within the options array (I guess?) so that you're able to add as many sections that you want, with as many nested data fields as you want. The idea is quite simple      1) Click add section to create a new section ![First Step](http://i.stack.imgur.com/LwdB1.jpg) ————      2) A javascript creates the input fields for the section, where you can name.. ![Second Step](http://i.stack.imgur.com/vBfcB.jpg) ————      3) ..and associate multiple input fields to the section ![Third Step](http://i.stack.imgur.com/IRwsv.jpg) ————      4) You can also add more sections ![Fourth Step](http://i.stack.imgur.com/Czxee.jpg)         The code I have atm is: **PHP**               <?php     function rd_settings_page() {         ?>

<?php _e( 'Settings', 'blog' ); ?>
             <form enctype="multipart/form-data" action="options.php" method="POST">                 <?php settings_fields( 'rd-settings-group' ); ?>                 <?php do_settings_sections( 'rd-settings' ); ?>                 <?php submit_button(); ?>             </form>
         <?php     }          function rd_settings_api_init() {         add_settings_section(             'rd_blog_info_section',             __( 'Blog info settings', 'blog' ),             'rd_blog_info_section_callback_function',             'rd-settings'         );              if ( 1 === get_current_blog_id() ) {                     register_setting( 'rd-settings-group', 'rd_fashion_list' );             register_setting( 'rd-settings-group', 'rd_blog_description' );         }              if ( 1 === get_current_blog_id() ) {                     add_settings_field(                 'rd_fashion_list',                 __( 'Fashion Blogs', 'blog' ),                 'rd_fashion_list_callback_function',                 'rd-settings',                 'rd_blog_info_section'             );         }     }          add_action( 'admin_init', 'rd_settings_api_init' );          function rd_blog_info_section_callback_function() {         echo '
Blog info settings
';     }          function rd_fashion_list_callback_function() {         $setting = get_option( 'rd_fashion_list' );?>

                      + Add Section                       <?php     }      **JS**               $(document).on('click', '.addsection', function () {         $(this).prev('.inner-wrap').append('
'+             '<input type="text" name="rd_facebook" id="rd-facebook" value=""/>'+             ' Name for section'+             '
'+             '
'+             '<select>'+             '<option value="" disabled="disabled" selected="selected">Please select a blog</option>'+             '<option value="1">One</option>'+             '<option value="2">Two</option>'+             '</select>'+             '×'+             '
'+             '
'+             '+ Add Blog'+             '
');     });          $(document).on('click', '.addblog', function () {         $(this).prev('ul').append('
'+             '<select>'+             '<option value="" disabled="disabled" selected="selected">Please select a blog</option>'+             '<option value="1">One</option>'+             '<option value="2">Two</option>'+             '</select>'+             '×'+             '
');     });


How to query posts from specific authors and categories using WP_query?

I currently have a WP_query where I am getting posts from a specific set of authors. To this, I want to add specific categories as well.               $args = array( 'author__in' => $authors, 'posts_per_page' => 12, 'paged' => $paged );      $authors is an array containing users' ids. So, I need to query posts from both, authors and categories. I was thinking about using something like this:               'tax_query' => array(         'relation' => 'OR',         array(             'taxonomy' => 'category',             'field' => 'id',             'terms' => array ( $cat_ids ),         ),         array(             'taxonomy', => 'user',             'field' => 'id',             'terms' => array( $user_ids ),         )     )      I know user is not a taxonomy; however, I am looking for something similar that works. ## EDIT Well, I tried this and it is working so far:               $args = array(       'author__in'     => $authors,       'category__in'   => $terms,       'posts_per_page' => 12,       'paged'          => $paged     );      Is there a better way? ## EDIT 2 My previous edit is not working the way I wanted. The caveat is that when only categories are specified, no posts show up. I need an OR relation. ## EDIT 3 I havent been able to find a solution. When I use author_ _in and category_ _in for the arguments, wordpress only shows posts from authors and not both. I need to show posts from authors AND categories. What am I doing wrong here?


How to disable Edit Post and Allow only Custom Field?

What I would like to know is if it is possible to disable the edit post function in wordpress based on User's roles. I try to explain better. Let's take an 'Editor' as role example: I would like Editors, Authors.... but NOT ADMIN to be able to write posts only using Custom Fields instead of the 'classic' built in edit post function of WordPress. Is there anyone who knows how to do it (maybe it is only a sentence or 2 in functions.php) or who as/know a plugin that will let me do it? Thank you very much!


How to store array in usermeta in wordpress

I have a custom user registration form and am trying to store multiple values in the usermeta. This is a sample code I am using, however it just stores the last option selected (i.e. if I select from Volvo to Opel, it will only store Opel in the database), whereas what I am wanting is all the values selected to be stored. Im not sure what Im doing wrong. Any help would be appreciated.               <select name="test" id="test" multiple>           <option value="volvo">Volvo</option>           <option value="saab">Saab</option>           <option value="opel">Opel</option>           <option value="audi">Audi</option>         </select>              update_usermeta( $new_user, 'test', $_POST['test'] );


Changing Post Permalink redirect

I am curious about something. Recently I changed my post permalink structure in wordpress. It used to be category/postname. I have changed it to postname. It seems that if I type http://mydomain.com/category/postname, it gets redirected to the new permalink of http://mydomain.com/postname. How do I prevent this redirect of url? Is it a default wordpress setting? I am using Seo by Yoast plugin. I want to prevent it because I totally want to delete the old permalink url. My website is very new, so I am not afraid to lose traffic. Thanks in advance!


Fetching Post based on date

I am creating a website for fetching post based on date, So when the page load it display the post of current date and in that page there are two button Previous and Next so when the user click on Previous button it should display the post of previous day and when click on next it should display the post of next date on the same page


How to associate an existing user to a site in a multisite setup programmatically

In a multisite setup, you can associate an existing user in the network to a site. The standard wp_insert_user function doesn't seem to have the proper logic to handle. How would I do this for multisite? Also, is there a way to see if a given user is already associated with a particular site?


How to send "Location" header on plugin form submit event?

How to redirect to specified page after form was submitted? > Warning: Cannot modify header information - headers already sent by (output > started at `wordpress\wp-admin\menu-header.php:94`) in `wordpress\wp- > content\plugins\test\test.php` on line 16               <?php     /*     Plugin Name: TEST     Plugin URI: http://localhost/     Description: TEST     Version: 0.0.1     Author: TEST     Author URI: http://localhost/     */     add_action('admin_menu', 'test');     function test() {          add_menu_page('test', 'test', 0, 'test/test.php', 'page');     }      function page() {         if(isset($_POST['submit'])) {             header('Location: /index.php');             exit;         }         echo '<form action="" method="post"><input type="submit" value="Submit form" name="submit" /></form>';         var_dump($_POST);     }


Adding first and last classes to three column layout in Bones boilerplate

I'm using the bones boilerplate theme in Wordpress and on the homepage am displaying a section containing three columns for the latest three posts in Wordpress. The bones theme uses the responsive 960 grid and in any grid usage, we need to add the class of `first` to the first element and the class of `last` to the last element. I've tried implementing the ability to do this from this answer at their support forum. Here is the code currently in use:-

             <hgroup class="">
What We Say
</hgroup>
                 <?php                 $temp = $wp_query; $wp_query= null;                 $wp_query = new WP_Query(); $wp_query->query('showposts=3' . '&paged='.$paged);                 while ($wp_query->have_posts()) : $wp_query->the_post(); ?>                 <?php $counter = 1; //counter tracks the number of the post we're on ?>                      <?php // This code uses the modulus operator to check the remainder of the $counter value in the current iteration and adds the 'first' or 'last' class based on either number sequence ?>                      <li class="blog-post fourcol <?php if ($counter % 3 == 0) { echo 'last';} elseif ($counter % 3 == 1) { echo 'first';} ?>">                      <article id="post-<?php the_ID(); ?>" <?php post_class( 'clearfix' ); ?> role="article" itemscope itemtype="http://schema.org/BlogPosting">
<a href="<?php the_permalink(); ?>" title="Read more"><?php the_title(); ?>

<?php printf( __( 'Posted <time class="updated" datetime="%1$s" pubdate>%2$s</time> by %3$s.', 'bonestheme' ), get_the_time( 'Y-m-j' ), get_the_time( __( 'F jS, Y', 'bonestheme' ) ), bones_get_the_author_posts_link() ); ?>

                         <?php the_excerpt(); ?>

<?php the_tags( '' . __( 'Tags:', 'bonestheme' ) . ' ', ', ', '' ); ?>

                 <?php $counter++; // This increases the value of $counter by 1 for every loop iteration ?>                 <?php endwhile; ?>                      <?php if ($paged > 1) { ?>
<?php next_posts_link('« Previous Posts'); ?>

<?php previous_posts_link('Newer Posts »'); ?>
                                       <?php } else { ?>
<?php next_posts_link('« Previous Posts'); ?>
                                       <?php } ?>                      <?php wp_reset_postdata(); ?>

      This however, is adding the class of `first` to each instead of `first` on the first (1st) column and `last` on the last (3rd) column. Can anyone see why my code may not be working as expected from the above? Thanks in advance.


Wordpress meta-box and checkbox-list

I have a trouble with a type of checkbox-list in meta-box. This is my code in **meta-box-config.php** :               $meta_boxes[] = array(     'id'        => 'poker_room_extension',     'title'     => 'Poker Room Options',     'pages'     => array( 'post', 'page' ),          'fields'    => array(              array(             'name'      => 'Sistema operativo supportato',             'id'        => $prefix . 'os_poker_room',             'clone'     => false,             'type'      => 'checkbox_list',             'options'   => array(                 'windows'     => 'Windows ',                 'mac' => 'Mac ',                 'linux' => 'Linux '             ),             'std'       => false         )     )      );      This is what I see in my post's options ![enter image description here](http://i.stack.imgur.com/teH5L.png) ![enter image description here](http://i.stack.imgur.com/G8S7u.png) Is it normal that variable omc_os_poker_room is the same? How I can show the values? Is omc_os_poker_room an array or not? I don't understand. If I run this code in my template it show only the first value (windows and not the other ones checked):               $omc_os_poker_room =  get_post_meta(get_the_ID(), 'omc_os_poker_room', true);     $conta = count($omc_os_poker_room);                  <?php if ($omc_os_poker_room != '') {                 echo '<p class="omc-info-one"><b>OS: </b>';                 for($i=0;$i<$conta;$i++) {                 echo $omc_os_poker_room[$i];                 } }?>      Can you help me? Thanks I replaced this line:               $omc_os_poker_room =  get_post_meta(get_the_ID(), 'omc_os_poker_room', true);      to               $omc_os_poker_room =  get_post_meta(get_the_ID(), 'omc_os_poker_room', false);      It's working now! ;)


access JSON results from wordpress database with wpdb

I have JSON results from Google API added to to wp_options table. At this point I just need to echo the specific elements. Namely, the coordinates. The option_name I have is py_menu_item. One of the option_value element is coords. That is what represents the JSON results. The code below yields this response: `array(o){}` The code:               global $wpdb;     $myrows = $wpdb->get_results("SELECT * FROM $wpdb->wp_options WHERE option_name = py_menu_item", ARRAY_A");     $lat = $myrows->results[0]->geometry->location->lat;    //latitude     $long = $myrows->results[0]->geometry->location->lng;   //longitude      echo $lat;     echo $long;     var_dump($myrows);      I am using this Codex page as a guide: Class_Reference/wpdb


How to fix thumb.php error

So I moved a site to a new URL and some post thumbnail images aren't showing up. What is strange is that some are pathing to the new /uploads folder without a problem. Others are producing this error > A TimThumb error has occured The following error(s) occured: You may not > fetch images from that site. To enable this site in timthumb, you can either > add it to $ALLOWED_SITES and set ALLOW EXTERNAL=true. Or you can set > ALLOW_ALL_EXTERNAL_SITES=true, depending on your security needs. Query String : src=http://community-paper.com/wp- content/uploads/2013/02/denise-head-shot.jpg&w=100&h=100&zc=1&q=90 TimThumb version : 2.8.11


How to configure Multisite Network with randomized hostnames?

I'm trying to convert a freshly-installed and functional WordPress into a multisite network. But I'm having problems because of our Apache configuration. We use Apache to randomly redirect requests for domain.com to one of two application servers: app1.domain.com or app2.domain.com. The problem is that WordPress redirects to DOMAIN_CURRENT_SITE (defined in wp-config.php) if the current browser domain differs from that. This results in a 310 redirect loop. Here's an example of what happens:   1. User requests domain.com/apps/wordpress/   2. Apache redirects to app1.domain.com/apps/wordpress/   3. Because redirect domain does not match DOMAIN_CURRENT_SITE, WordPress redirects to DOMAIN_CURRENT_SITE (domain.com/apps/wordpress/)   4. Return to step 1 and repeat What I'd like to do is set all WordPress links and URLs to **domain.com** and have WordPress ignore the fact that **app1.domain.com** or **app2.domain.com** is _actually_ being retrieved. Is this possible? Here are the relevant Apache conf files (simplified), in case I'm not being quite clear: **application_servers.conf:**               domain.com-prod-http  app1.domain.com:80|app2.domain.com:80      **httpd.conf:**               RewriteMap server rnd:conf/application_servers.conf     RewriteRule ^/apps/*([^/]*)/*(.*) http://${server:domain.com-prod-http}/apps/$1/$2 [P,L,QSA]


Force logged in users to still fill out name/address for commenting?

This is a bit of a weird request, but I'd like to force loggged-in users (one specifically) to fill out the standard not-logged-in name / email address fields before submitting a comment on the site. [EDIT: I'm realizing this is probably even more difficult than I thought. I not only don't want the comment form to show this one user as logged-in, I want it to actually submit the comment as a not-logged-in user. Ideally without logging out the user. Is there a way to remove the logged-in check altogether from the comment form and comment-form-submit code? I don't mind forcing all users to fill out a form every time they submit a comment if that's the easiest fix.] Is this possible? I would prefer not to hack core code but I'm not opposed to writing a static comment form, if that would help. I suspect not since the form-submit is still checking on logged-in status... Thanks for your help! [Edit - WHY I NEED THIS: The site is using the Member Access plugin to show select pages/posts to registered users only. However, my client didn't want anyone to actually have to register for a WordPress account - he wanted the login/signup forms to check against an external ESP to see if they were on an email list, and if so log them in automatically. From the user's perspective, they enter their email address and poof! can see the content. To achieve this, the code does the lookup againt the ESP and if the email addy exists, logs them into a dummy WordPress account I created. But once they're logged in, I want them to each be able to comment individually, not as this dummy account.]


How do you hide images from posts only

As the title says I want to keep images on pages and hide them from posts on my site . How can I do this? Thanks


How can one get page by pagename if it is a child page?

What I want to do is to dislay a description of a country if one of the categories is a country name. It do it like that                   <?php     if(in_category('afghanistan')) {         $recent = new WP_Query("page_id=25"); while($recent->have_posts()) : $recent->the_post();?>
<?php the_title(); ?>
             <?php the_content(); ?>         <?php endwhile;     }          elseif(in_category('albania')) {         $recent = new WP_Query("page_id=26"); while($recent->have_posts()) : $recent->the_post();?>
<?php the_title(); ?>
             <?php the_content(); ?>         <?php endwhile;     }          else {         echo "Error!";     }     ?>      I would like to replace `page_id=25` with `pagename=afghanistan`. Iif I do so it works well, but if page "afghanistan" is a child of a page "Asia" it doesn't display it anymore. If I use `page_id` it works, but `pagename` stops working as soon as I create page as a child of another page. How do I get the page by name if it has a parent? :)


Dynamically change Custom Post Type Template OR Change Permalink?

I have built a plugin that uses a custom post type and a single-.php file for a template. My issue is the custom post type template needs to take on the name of the post type and I need to change that. For example if my post type is called Movies then the template I call is single-movies.php. Also the permalink would be mydomain.com/movies. I am providing a plugin options page that allows the user to change the name from Movies to say Films. What is the best approach? Initially I thought about changing the custom post type name dynamically and renaming the file with the rename(). I kept getting an error "cURL wrapper does not support renaming" I got to thinking . Is it easier to just rename the permalink with a mod rewrite and if so how would I do that. I'm trying to avoid a naming issue. If the user already has a permalink of Movies then I want them to be able to rename the post type to film or what ever they want. The default of Movies will be stored as an option upon plugin activation and displayed in the options panel. If the user decides to change to "Films" the option is updated but how to I associate it to the custom post type template? Any help on this is greatly appreciated. Phil


Redirect to settings page after install

I can't find any info on this anywhere but i'm sure iv'e seen it done before. I would like to have a user taken to the settings page for my plugin after install, so either auto-redirected or change the "back to plugins" link to a custom link. Thanks in advance **SOLVED**               function myplugin_activate() {             // TODO: Install your plugin here.              // I don't know of any other redirect function, so this'll have to do.         wp_redirect(admin_url('options-general.php?page=myplugin_settings'));exit;         // You could use a header(sprintf('Location: %s', admin_url(...)); here instead too.     }     register_activation_hook(__FILE__, 'myplugin_activate');      @Zack - Your method works great however you forgot to exit after wp_redirect. (source http://codex.wordpress.org/Function_Reference/wp_redirect) Many thanks


Possible to make custom role in multisite that can add sites?

I am creating a network on MultiSite, and am wanting to keep the Super Admin privileges very tightly locked. This setup is hosed on WPengine, and they add their plugin in the dashboard that shows the super admin a menu area that gets access to some server stuff, I obviously want that blocked from folks who may go poking around. I am using the Premium version of the plugin User Role Editor to create a custom role, call it "Sub Admin". I am trying to find out, if it is possible, to give this role the ability to add new sites? I have added the `manage_sites` capability, but the _Add Site_ menu item is not showing up. I tried also adding capabilities for `manage_network` and `manage_network_options` to test if they were somehow requisite, but no. Has anyone done this, or know if it is possible? Or do I have to bite the bullet and dish out super admin rights?


WordPress - admin-ajax.php returns 502 Bad Gateway

I'm getting a 502 Bad Gateway error for wp-admin/admin-ajax.php -- this is a WP site, hosted on WebFaction, which is using nginx. Where it most obviously crops up is when adding a new post or page, clicking on "Insert Media", nothing in the library shows up. Inspector console is filled with these:               POST http://lightuphope.org/wp-admin/admin-ajax.php 502 (Bad Gateway) load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-u…:5     send load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-u…:5     x.extend.ajax load-scripts.php?c=1&load%5B%5D=jquery-core,jquery-migrate,jquery-ui-core,jquery-ui-widget,jquery-u…:5     i load-scripts.php?c=1&load%5B%5D=hoverIntent,common,admin-bar,schedule,wp-ajax-response,autosave,sug…:48     (anonymous function)


Enqueueing a code block from an options framework

I'm currently working with the Redux Framework to allow users of my theme to add additional CSS and JS code to their theme's header and footer, respectively. Redux stores this code in a global variable, so it's easy to access. However, this means I must call the global variable in the header.php or footer.php file and then echo the code from Redux there. This doesn't seem ideal. I was wondering if there is any way to enqueue these blocks of code in the function.php file rather than trying to code it directly into the template files. For example:               #header{         margin: 0 auto;     }      Is typed into my CSS box inside of Redux. I can then access it in header.php with something like:               global $redux_global;     echo $redux_global['css-block'];      ...and it'll spit out the above CSS. That's all well and good, but if I do this its not properly enqueued. Per my understanding I can only use a URL with wp_enqueue_style and wp_enqueue_script so I'm at a loss. Thank you for your help!


get_post_thumbnail_id() Doesn't return value

I'm changing a menu from a loop with `query_posts` to a "custom menu" using `wp_get_nav_menu_items`, but I can't seem to retrieve the `post_thumbnail`. The original code I had (snippet):               <?php     query_posts($args);     if (have_posts()) : while (have_posts()) : the_post();         $image = wp_get_attachment_image_src(get_post_thumbnail_id());     endwhile; endif;?>      My new code:               <?php     $menu = wp_get_nav_menu_items('Homepage blokken');     foreach($menu AS $m){          echo $m->ID; // this echoes the correct ID          $pThumbId = get_post_thumbnail_id($m->ID); // this returns empty     } ?>      Why is this not working?


Source code get entity escaped after migrating

I have a lot of posts with source code on it. After migrating my blog from wordpress.com to self-hosting, the source code all have HTML entity escaping, for example:               [code]       printf("hello");     [/code]      This causes the rendered source code become `printf("hello")` instead of `printf("hello")` I think this is because the export/import process was using xml file where all non-suitable characters get escaped. Is there anyway only normal content get escaped, but not `[code]` enclosed content when migrating wordpress?


Converting Menu Links to List Elements

I'm creating a theme from a template based on Wordpress 3.0. I've started with items like Starkers which is a completely bare theme, and even tried modifying something by default like Twenty Ten or Eleven. However, the thing that gets me is how can I adjust the css to covert a single line of PHP such as (used as default now for navigation):               <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>      Or:               <?php     wp_nav_menu(         array(             'container_class' => 'menu-header',             'theme_location'  => 'primary'         )     );     ?>      Into a stylized list element that can be adjusted to the length of the entire navigation menu? I'm not understanding how the PHP is turned into the right amount of `<li>`'s (which is the case in the generated html viewable in Firebug or another inspector) where I can modify them how I wish.


Is it possible to associate different kinds of custom post types one to the other?

I might be thinking too hard about this problem and i'm thinking the solution might be easier than we're i'm heading. Here's what i'm trying to accomplish: there a winery website built on wp and uses custom post types for "Wines" -> every wine has it's own description, picture, etc (cabarnet 2005, cabarnet 2006 etc...). Now, most wines have won medals - some of them even won up to 8 medals. i want to showcase all medal relevant to a specific wine in his specific page AND i want to have another page that showcases all medals, chronologically. I figured i might be able to accomplish this by creating a custom post type "medal" and to somehow associate the medal to the wine that won it. but can i associate the 'medal' object in a many to one relation to the 'wine' object? how can i do that? Any Ideas?


Site not found using subdomains

Hello i am having a few problems setting up subdomains on my multisite install. I was hoping someone could point out any ways that i have went wrong. Thanks. My website doesnt site on the root. Its in a subfolder public_html/onlinebanter.co.uk DNS setting- ![redirect](http://i.stack.imgur.com/1dwEw.jpg) public_html/onlinebanter.co.uk/wp-config.php               /* Multisite */     define('WP_ALLOW_MULTISITE', true);     define('MULTISITE', true);     define('SUBDOMAIN_INSTALL', true);     define('DOMAIN_CURRENT_SITE', 'onlinebanter.co.uk');     define('PATH_CURRENT_SITE', '/');     define('SITE_ID_CURRENT_SITE', 1);     define('BLOG_ID_CURRENT_SITE', 1);      htaccess               RewriteEngine On^M     RewriteBase /^M     RewriteRule ^index\.php$ - [L]^M     ^M     # add a trailing slash to /wp-admin^M     RewriteRule ^wp-admin$ wp-admin/ [R=301,L]^M     ^M     RewriteCond %{REQUEST_FILENAME} -f [OR]^M     RewriteCond %{REQUEST_FILENAME} -d^M     RewriteRule ^ - [L]^M     RewriteRule ^(wp-(content|admin|includes).*) $1 [L]^M     RewriteRule ^(.*\.php)$ wp/$1 [L]^M     RewriteRule . index.php [L]# BEGIN W3TC Browser Cache      getting a not found at this site address http://test.onlinebanter.co.uk/ Is there anything that i have done wrong? I only set up the wildcard thingy about 6hrs ago. Could it be waiting to propogate? thanks


Remove Post if Advanced Custom Field is checked to fix paging

I'm trying to setup a query that filters through posts and removes ones that have an ACF field "archived" checked. Post queries are pretty foreign to me.               query_posts("cat=10&posts_per_page=12&post_status=any&order=ASC"."&paged=".$paged);      How can I edit that string to check to see if the post has the `archived` checkbox checked? This is how I'm currently doing it, but because it's inside the loop, there are "phantom" posts that add to the pagination when they shouldn't. `if(get_field('archived')) { /* my code */ }` Thanks.


Why is WordPress' installer "phoning home" during the install script?

I noticed (using Little Snitch) that WordPress' installer calls a distant Web page when installing (`api.wordpress.org`), why is that?


Developing mobile version of WordPress site

I would like to build a mobile version of my WordPress site. To avoid the problems and costs with developing for native platforms, I'd like to go for an HTML/CSS/jQuery approach that would be accessible from the Webkit browsers. The main site is already developed in WordPress, and content can be directly taken from the CMS. I'd like the mobile version to be available from a specific URL such as www.mysite.com/mobile or mobile.mysite.com How can I set this new URL to point to this version of the site? And how will this new URL change as I browse through the mobile site? And how can I load this URL by default when a user accesses the site from a mobile device? Am I right to think that I can then develop this as I would make a normal theme for WordPress, with no other worry about this being meant for mobile devices rather than desktop?


Giving Wordpress it's own directory and using .htaccess Directory Index

Would this be a bad idea for any reason? - installing Wordpress in a sub- directory (ie: http:// example.com/wordpress) alongside the current website (ie: http:// example.com) that is not using Wordpress...and still running Wordpress from the root by Giving Wordpress It's Own Directory and using .htaccess to change the Directory Index (so http:// example.com still points to the non-Wordpress website's home page). This would allow all the content to be added to the Wordpress website and when it's ready to replace the non-Wordpress website, it's just a matter of deleting the non-Wordpress files and re-pointing the Directory Index back to the Wordpress index.php with the .htaccess. P.S. - this seems like an option for my current project because the non- Wordpress website uses different page names than we will be using with the new Wordpress website, so there will be no conflicts there. **UPDATE: Attempted this and it will not work because Wordpress returns the 404 page when trying to load the non-Wordpress pages (ie: http:// example.com/Non-Wordpress-Page)**


Post processing of uploaded file

When a file with the `.xml` extension has been uploaded on my blog (via the Add Media uploader) I would like to automatically replace some attributes. For example, if I upload a file with this content:               <content creator="foo"></content>      I would like that Wordpress modifies it automatically in:               <content creator="bar"></content>      What hook should I use and how?


Resize photo on wordpress

Based on Function add_image_resize in wordpress http://codex.wordpress.org/Function_Reference/add_image_size if i have rule in functions.php like this > add_image_size('featured-slider', 940, 260, true); It means all of image resize and hard croping to 940px (width) and 260px (height), right ? the problem is when i'am uploading an image file that have a small dimension than rule. for example i have image with 303px (width) and 405px(height) and that images have uploaded can't resize to 960px and 260px, but only 303px (width) and 260px(height). It posssible in wordpress resize image to 960px x 260px although dimension of my source image smaller than my rule ?


Importing demo content from plugin

I need to create "Import demo content" button on frontend, when the user clicks it, import demo content including attachments. What would be the best way to achieve that? Import XML somehow? Import db? Create all the content in the plugin manually? Thanks


Null value given when confirming email's

**Fixed the problem by adding`if ( 'email' == $type || 'email2' == $type ) {` to the top of the snippet below and changing the first elseif to a if statment** I have created a WordPress register form on the homepage of my WordPress but I am having a little problem with verifying the email address match. This is the code I am using to do that.               elseif ( !is_email($userdata['user_email'], true) )     $error = __('You must enter a valid email address.', 'frontendprofile');     elseif ( email_exists($userdata['user_email']) )     $error = __('Sorry, that email address is already used!',     'frontendprofile');     elseif ( !empty($_POST['email'] ) && !empty( $_POST['email2'] ) ) {         if ( $_POST['email'] == $_POST['email2'] )             wp_update_user( array( 'ID' => $current_user->id,      'user_email' =>     esc_attr( $_POST['email'] ) ) );         else             $error = __('The emails you entered do not match.  Your    email was not updated.', 'frontendprofile');     }      But I keep getting this error when I hit the register button               Warning: get_object_vars() expects parameter 1 to be object, null given in       I take it that some how the verfication process isn't working fully so it is not taking the email address and instead showing a null value in the form submit, but I can't see where this is happening.


Different templates for parent and children categories/taxonomies

I would like to know what is the best way to create a different template for parent and children categories and/or taxonomies. Example: I have a taxonomy called region, which I want to divide in countries, and cities inside countries. So, I will have a parent taxonomy term called Italy, and it's children taxonomy terms, Rome, Milan, Napoli, whatever. Is it possible to have different templates for country and city? How can I achieve this? Thanks in advance.


How to Make infinite loop of post

I am using Post contents as a slider contents, i need to make the post infinite number of loop, ie, If i view the last post after that first post should display and before first post the last post. Please suggest


Advanced custom fields - taxonomy terms images

I used the Advanced Custom Fields plugin to add a custom field to my taxonomy. That custom field is an image which is associated with the term. Now I have a page where I display a list of all terms (for example, car manufacturers):               $terms = get_terms("manufacturer_tax", array(         'hide_empty' => 0     ));     $count = count($terms);     if ( $count > 0 ){         foreach ( $terms as $term ) {             echo $term->name;             echo "<img src='" . $term->manufacturer_logo . "'>"; /* NOT WORKING */          }     }      I wish to display the image associated with each term. How can I accomplish this? **EDIT** Here is the example result for one term: `stdClass Object ( [term_id] => 5 [name] => Honda [slug] => honda [term_group] => 0 [term_taxonomy_id] => 5 [taxonomy] => manufacturer_tax [description] => [parent] => 0 [count] => 0 )` Looks like there is no image associated with this term. However, I can see the image in the backoffice.


Add error message on password protected page

I protected a page with password. I’d like to add a short error message when the inserted password is incorrect. How can I do this? I add this code to show and customize the form on my page. My `functions.php`               add_filter( 'the_password_form', 'custom_password_form' );     function custom_password_form() {     global $post;     $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID );     $o = '<form class="protected-post-form" action="' . get_option('siteurl') . '/wp-pass.php" method="post">' .      '<p class="glossar-form-p">Alle weiteren Glossarbeiträge sind durch ein Passwort geschützt. </p>' .      ' <label for="' . $label . '">' . ' </label><input name="post_password" id="' . $label . '" type="password" size="20" />     <input type="submit" name="Submit" value="' . esc_attr__( "Login" ) . '" />     </form>     ';     return $o;     }


Widgets in the loop if active

I'm trying to put a widget as "first post" if it's active.. and let the posts continue after that.. It works, but the first post disappears and the second post becomes the first in line after the widget.. Can't see what i'm doing wrong.. I already have a widget that shows in between the posts as you can see.               <?php if (have_posts()) : ?>     <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>     <?php $i=1;?>     <?php while (have_posts()) : the_post(); ?>                    <?php if ( is_active_sidebar('post_widget_area') && $i==1 ) { ?>          <?php dynamic_sidebar('post_widget_area'); ?>          <? } else { ?>               <?php the_title(); ?><br>         <?php the_excerpt(); ?>              <?php } if($i==3): ?>         <?php get_sidebar('bottom'); ?>              <?php endif; ?>         <?php $i++; ?>         <?php endwhile; ?>         <?php if($i<4): ?>         <?php get_sidebar('bottom'); ?>            <?php endif; ?>     <?php endif; ?>


Should a SEO plugin be necessary?

I'm using the All in One SEO plugin for my site. The extra fields and options it supplies seem like they could be handled via a theme, possibly negating the use for a plugin. Should SEO considerations be handled by a theme, rather than delegating the work to a separate plugin? It could reduce maintenance issues, takes up less space, and be more integrated.


Jquery conflict

I have been trying and trying to fix jquery issues. i have in my header lots of jquery. I use it for slider and other things that are built into this premade theme. I am unable to add anything that uses jquery because of conflict. i need some help. The board is www.cgwhat.com. The forgot password is jquery and the slider is controlled by jquery also. I wanted to add another plugin but can not because of the conflict. Also with the forgot password that is jquery. I need to know what is wrong and how to fix it . If i remove calls to javascript in header it is fixed. The forgot password works but everything else breaks.               <?php wp_enqueue_script("jquery"); ?>     <?php wp_head(); ?>          <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.equalHeight.js"></script>     <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/flashobject.js"></script>     <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery.js"></script>     <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery.jcarousel.js"></script>     <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery.actions.js"></script>     <script type="text/javascript">      jQuery(document).ready(function($){     var fC=$('#features-nav .features-nav-item').length;     curS=1;     var cInt=0;         cInt=setInterval(function(){             $('#features-nav .features-nav-item:eq('+curS+')').addClass('current').trigger('click');             curS++;             if(curS>=fC) curS=0;         },10000);});          </script>                     </head>


What is the ideal setup to address security concerns?

I'm aware of the requirements WP has for certain directories and files to be writable. I'm also aware that making permissions too loose can open security holes. Finally, I know that the user that (insert your server here) runs as on Linux systems can be a factor. Security aside, I like being able to download themes and plugins to my blog, and update them when necessary. Proper permissions seem to be a bit at odds with this preference. I've collected little bits of detail here and there, but I'd like to see a more definitive answer, if there is one: what is the preferred setup with a nod to security? What permissions should be in place, what user should the site run as, etc.


How to get site homepage from plugin?

I am creating a plugin that has a preview, kind of like the theme customizer preview. It displays the users site in an Iframe. The issue is that I can't seem to be able to get the users homepage using the standard way of grabbing them, such as:               <iframe id="preview_frame" src="<?php get_bloginfo('url'); ?>">      Or:               <iframe id="preview_frame" src="<?php get_home_url(); ?>">      Can anyone shed some light on the proper way of doing this? Is their a specific way to display the site as a preview? I am using a hook to disable the admin bar in the preview, so if there is an elegant way to create a preview without the admin bar, it would be very good to know. Thanks.


paginate_links on custom query in admin - 'sufficient permissions' error

I have created a page in my admin with this custom query:               $rows = $wpdb->get_results("SELECT * FROM ej_feedback ORDER BY createdtime ASC");      I have made it successfully paginate as required in that the right amount of posts show on first page and the right amount of pagination links show up. Awesome! However when I click on one of the pagination links to go onto page 2, I get an admin error: **You do not have sufficient permissions to access this page** The url looks like this: > /wp-admin/admin.php?page=user-feedback/user-feedback.php/page/2/ I really don't know why I'm getting this error in the admin. Is it a more general issue with the admin or is it related to using pagination in the admin area? Any help would be much appreciated. The script works perfectly on the frontend - I just think Wordpress has a problem with the URL generated.


Removing the 1st line in a post snippit showing on homepage AND leave it on the internal post

I have a magazine blog where different writers of each post is credited (i.e. by Larry Hamilton, Sr. Writer). The problem that I am having is that on the homepage the snippit should look like this: (Title and 1st sentence of 1st paragraph) _**The Trouble With News_** **In today's world, we get news much faster than...** My problem is when I add the persons' name for the byline, the home page snippet looks like this: _**The Trouble With News_** **by Larry Hamilton, Sr. Writer** This leaves out the first sentance. No one wants to read a title and the byline. How do I remove the byline ONLY from my Homepage snippit and leave the byline in tact on the post/page?


flush_rewrite_rules not working on plugin deactivation, invalid URLs not showing 404

i'm just about to release a community plug-in and have a few last anoying issues. First, whenever i visit a page that would not be valid for the plugin, www.mydomain.com/forms/tester it will take me to a different page. What should happen, is the plugin code try and use the path 'tester', find there is no such file, and then return a page not found error. Second, i am using AskApache RewriteRules viewer plugin to see my rules, and can see that even though i have deactivated my plug-in, rewrite rules remain 'index.php?formid=$matches[1]'. I cant understand as i am flushing rewrite rules on plugin deactivation, and i know the function is being called. This gives the same affect as above, with incorrect URLs not going to 404 but instead going to other pages. Is there anyway to fix this, so that if a wrong page is visited, 404 are thrown? Code is currently hosted here: . http://www.unifiedmicrosystems.com/products- and-services/software-development/wordpress/jformer-for-wordpress/. I am just waiting for wordpress.org access to upload the source there for general use. I have tried to copy a cut down version with relevant parts below. Many thanks in advance, Chris               class JFormerForWP     {     static $errors = false; /* for debugging */     static $pluginPath;       static $pluginUrl;            public static function makeFormFactory($id,$class)     {         $classPath = self::$pluginPath . "/forms/{$class}.php";         require_once $classPath;      }          /* called each request */     public static function init()     {         self::$pluginPath = dirname(__FILE__);  // Set Plugin Path           self::$pluginUrl = WP_PLUGIN_URL . '/jformer-for-wp/'; // Set Plugin URL                self::addRewriteRules();         add_filter( 'query_vars', array(__CLASS__, 'addQueryVars'));         add_action( 'template_redirect', array(__CLASS__, 'formDisplay'));              add_action('wp_print_styles', array(__CLASS__, 'styles'));         add_action('wp_print_scripts', array(__CLASS__, 'scripts') );         add_shortcode('jformer', array(__CLASS__, 'shortcodeHandler'));              add_action('wp_ajax_nopriv_jFormerForWp', array(__CLASS__, 'ajaxHandler'));         add_action('wp_ajax_jFormerForWp', array(__CLASS__, 'ajaxHandler'));         self::$errors = new WP_Error();     }          public static function ajaxHandler()     {            $formID = $_POST['jFormerId'];         echo self::getForm($formID);     }          public static function shortcodeHandler($atts, $content)     {         extract( shortcode_atts( array(         'id' => '0',         'class' => '',         'text' => ''         ), $atts ) );              // echo 'dumping shortcode values. content: ' . $content . ', id: ' . $id . ', class: ' . $class . '
';              $options = self::getOptions();         $permastructString = $options['url_string'];     }          public static function getOptions()     {         $options = get_option('jformer_options',array('url_string' => 'forms'));         return $options;     }          public static function addRewriteRules()     {         $options = self::getOptions();         add_rewrite_rule( $options['url_string'] . '/?([^/]*)','index.php?formid=$matches[1]', 'top' );      }          public static function addQueryVars($vars)     {         $vars[] = 'formid';         return $vars;     }          public static function formDisplay()     {     }          public static function activate()      {         if (version_compare(PHP_VERSION, '5', '<'))         {             deactivate_plugins(basename(__FILE__));         }              self::addRewriteRules();         flush_rewrite_rules(true);     }          public static function deactivate()     {              delete_option('jformer_options');         //$wp_rewrite->flush_rules(true);           flush_rewrite_rules(true);     }          public static function addAdminPage()     {         add_options_page( 'jFormer', 'jFormer Plugin', 'manage_options', 'jFormerForWP', array( __CLASS__ , 'displayAdminPageHtml' ));     }          public static function adminInit()     {         register_setting( 'jformer_options', 'jformer_options', array(__CLASS__,'validateOptions') );         add_settings_section('jformer_main', 'jFormer Settings', array(__CLASS__,'sectionText'), 'jformer_main_options');         add_settings_field('jformer_url_string', 'Rewrite String', array(__CLASS__,'displayUrlStringSetting'), 'jformer_main_options', 'jformer_main');         add_action('admin_notices', array(__CLASS__,'displayAdminNotices'));       }          public static function sectionText()     {         echo '
Main description
';     }          public static function displayUrlStringSetting()     {         $options = self::getOptions();         echo "<input id='jformer_url_string' name='jformer_options[url_string]' size='40' type='text' value='{$options['url_string']}' />";     }          public static function validateOptions($input)     {         $input['url_string'] = trim($input['url_string']);              if(!preg_match('/^[a-z0-9]{1,}$/i', $input['url_string']))         {             add_settings_error('jFormerForWP', 'url_string_error', 'Invalid URL string, please fix ensure string consists of alphanumeric characters only and is at least 1 character long', 'error' );         }         else         {             // add_settings_error('jFormerForWP', 'url_string_updated', 'String updated', 'updated' );             $validatedOptions['url_string'] = $input['url_string'];         }              return $validatedOptions;     }          public static function registerAdminSettings()     {             register_setting('JFormerForWPSettings', 'JFormerForWPSettings_option1');          }          public static function displayAdminPageHtml()     {            ?>

jFormer for WordPress Plugin Options
             Options relating to the Custom Plugin.             <form action="options.php" method="post">                 <?php                    settings_fields('jformer_options'); ?>                 <?php do_settings_sections('jformer_main_options'); ?>                 <input name="Submit" type="submit" value="<?php esc_attr_e('Save Changes'); ?>" />             </form>
         <?php     }          function showMessage($message, $msgclass = 'updated')     {           echo "
$message
";       }            public static function insertSettingsLink($links)     {         $settings_link = ''.__('Settings','JFormerForWP').'';           array_unshift( $links, $settings_link );           return $links;      }          public static function styles()     {                wp_enqueue_style('jformer', self::$pluginUrl. 'css/style.css');     }          public static function scripts()     {         wp_enqueue_script('jformer', self::$pluginUrl . 'jFormer/jFormer.js',array('jquery'));     }     }          register_activation_hook(__FILE__, array('JFormerForWP','activate'));     register_deactivation_hook(__FILE__, array('JFormerForWP','deactivate'));     add_action('init', 'JFormerForWP::init');     add_action('admin_init', 'JFormerForWP::adminInit');     add_action('admin_menu', 'JFormerForWP::addAdminPage');     ?>


Can't see where my get_posts custom post type query is wrong

Can someone please help point out how I need to correct my post_type query here? I've searched all around for an answer and I can't get it right. It's driving me crazy! Thank you...               function get_related_author_posts() {         global $authordata, $post;              $authors_posts = get_posts( array( 'author' => $authordata->ID, 'post_type' => 'webarticle', 'post__not_in' => array( $post->ID ), 'posts_per_page' => 5 ) );              $output = '';         foreach ( $authors_posts as $authors_post ) {             $output .= '
' . 'ID ) . '">' . apply_filters( 'the_title', $authors_post->post_title, $authors_post->ID ) . '' . '
' ;         }         $output .= '';              return $output;     }


How to make a call to DO_ACTION on Select List Change

Within a wordpress page (that is using a default template), I have a select/drop-down field that, when the user selects an item, I would like to somehow have it trigger a do_action call, right at this point, but unsure how to do this/approach? Any help would be great. Thanks.


Does all editing of Wordpress occur within the dashboard, or can we use our own text editor?

I've recently ventured into the world of CMS, and I'm used to editing everything by hand with an editor like Sublime Text 2, my personal favorite. Do we do this in Wordpress, if I wanted to customize a theme? Or do we do it all through the Dashboard?


How to limit character length in BuddyPress function output

BuddyPress has a function (bp_member_profile_data) that pulls profile data into a members loop which looks like this:               <?php     bp_member_profile_data( 'field=Organization' );     bp_member_profile_data( 'field=Brief Biography' );            /***     * If you want to show specific profile fields here you can,     * but it'll add an extra query for each member in the loop     * (only one regardless of the number of fields you show):     * bp_member_profile_data( 'field=the field name' );   */      ?>      I'm wondering how to limit the echoed length of Brief Biography. I've looked at the Bavatosan example and substr but they're kind of beyond me at this point in terms of knowing where to modify them.


WP_Query with "post_title LIKE 'something%'"?

I need to do a `WP_Query` with a `LIKE` on the `post_title`. I started with this regular `WP_Query`:               $wp_query = new WP_Query(          array (             'post_type'        => 'wp_exposants',             'posts_per_page'   => '1',             'post_status'      => 'publish',             'orderby'          => 'title',              'order'            => 'ASC',             'paged'            => $paged         )     );       But what I actually want to do looks like this in SQL:               $query = "             SELECT      *             FROM        $wpdb->posts             WHERE       $wpdb->posts.post_title LIKE '$param2%'             AND         $wpdb->posts.post_type = 'wp_exposants'             ORDER BY    $wpdb->posts.post_title     ";     $wpdb->get_results($query);      The output prints the results i'm excpecting, but I use the regular `<?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?>` to display the results.   And that is not working with `$wpdb->get_results()`. How can I achieve what I described here?


Building a store locator with google maps

I have a business site hosted on wordpress. Now, we are planning to have a store locator page. We are looking to build something similar to Apple store locator. My question is how do we go about creating this? Should I build a plugin or is it possible to embed a php application and have the same "look & feel" as the site? Or can I make use of custom post types? Please note that, the address info, working hours and images will be stored on the DB.Ideas and suggests are welcome. Thanks in advance.


How to migrate a WordPress installation from one site to another, including all images?

I need to move a WordPress site hosted on Dream Host to the companies servers. To do so I used the built in import and export feature that comes with WordPress (using a WordPress export file). However, it did not copy over images from the site, and didn't preserve the featured images. Using import/export, is it possible to copy over the images and featured images as well? If not, is there another method I could use?


How do i put a per page theme in a special box/div?

I am using 20-11 theme and i have the sidebar on the left, the main content center and now i would like to edit a php file (or not) to make a 3rd div to the right of the content. I'm unsure how i'll edit/style that. But my bigger question is after i get that part done, how do i say on this page use this image in that box? For some reason i suspect i specify the image on a per page bases so i may can this feature. Do you guys have any ideas? (i dont know what to tag this so feel free to change/fix it)


how to get shortcodes to work inside the text of custom fields

I am building a learning management system using Wordpress, custom fields, and various plugins, especially SIMPLE FIELDS by Par Thernstrom. My shortcode plugins, such as Shortcode Exec PHP and Custom Field Value, work fine in the main editing box, but if I put any of my course information shortcodes into a custom field, they don't work in the custom field. I know that prevents "circular reference" problems, but it also prevents me form building a more streamlined system. Do you know of any workarounds that would allow plugins to operate on the contents of custom fields, so that custom fields could contain shortcodes? The specific configuration that I most need is for shortcodes from Shortcode Exec PHP to work on the wysiwyg textarea input boxes of SIMPLE FIELDS. The problem is that right now, the custom field text managed by the SIMPLE FIELDS plugin is not evaluated by Wordpress for the presence of shortcodes of any sort, or for the presence of PHP code, as far as I can see from my experiments. Just as you might want to put shortcodes for teacher-name or text-book1 in the main edit box, one might also want to insert such local or global data strings into one or more custom fields. There are a variety of text replacement plugins available, and so far as I can see they all work fine in the main edit window or a page or post, and none of them work if inserted into the text of a custom field.


How to end the excerpt with a sentence rather than a word?

Here is the excerpt of the post on my home page. I want to end the excerpt with a sentence. In this case it is ' opportunities. '. I know how to modify the length but it won't do what i want. ![enter image description here](http://i.stack.imgur.com/5vtS0.png) Here is excerpt from other website. Here you see excerpt ending with a proper sentence unlike the above which ends with the first word of next sentence 'Proactively'. ![enter image description here](http://i.stack.imgur.com/6WlbL.png) **After Implementing thesolution by G.M. :-** ![enter image description here](http://i.stack.imgur.com/DgEaT.png)


Query and get meta as object(stdClass) on wp postmeta table?

I want to get a groups of data from postmeta table. The postmeta table have 4 colums, meta_id, post_id, meta_key,meta_value. Each post_id has a list of meta_keys. I want to run a query and get a result of               arry(number of results)(                           [0]=>object(stdClass)#1(                                                  [post_id] => 123,                                                  [key1]    => x,                                                  [key2]    => y,                                                  [key3]    => z                                                  )                           [1]=>=>object(stdClass)#2(                                                  [post_id] => 456,                                                  [key1]    => x,                                                  [key2]    => y,                                                  [key3]    => z                                                  )                           )      How to do it?


What is the best method to close off the backend?

**The goal** : Completely remove the ability to access the WordPress backend on the production domain. Ex. return a 404 for http://example.com/wp-admin **Purpose** : I don't want any possibility of WordPress' backend being accessed across the Internet. Instead, it will only be accessibly via VPN on an internal domain (i.e. http://example.internal/wp-admin. _This ensures that no one could ever brute force attack the login page._ I could restrict logins to a given IP address, but I don't want to keep up with a list of IPs. I'd prefer to use the security my VPN already offers. Consider that `wp-admin` still has to be accessible in some fashion because there could be resources that the frontend calls. Are there any solutions beyond redirecting `wp-login.php` somewhere else?


Reordering Buddy Press profile navigation

I am using this code to reorder the positions of the menu items for BuddyPress profile. I am using the xprofile (not sure if that makes a difference). Here is the code that I am trying to use:               <?php     /*     Plugin name: BP custom     Plugin URI: http://pittbullweb.com     Description: Customs for Buddy Press     Version: 0.1     Author URI: http://pittbullweb.com     */          function bbg_change_profile_tab_order() {     global $bp;              $bp->bp_nav['profile']['position'] = 10;         $bp->bp_nav['activity']['position'] = 20;         $bp->bp_nav['blogs']['position'] = 30;         $bp->bp_nav['friends']['position'] = 40;         $bp->bp_nav['messages']['position'] = 50;         $bp->bp_nav['groups']['position'] = 60;         $bp->bp_nav['settings']['position'] = 70;     }     add_action('bp_setup_nav', 'bbg_change_profile_tab_order', 999 );     ?>      I am going by the instructions given here to be able to do this. However when I go to activate the plugin i get a fatal error: **Fatal error:** Cannot redeclare bbg_change_profile_tab_order() (previously declared in /var/www/vhosts/giftcardswapping.com/demo/wp-content/plugins/bp- custom.php:11) **in /var/www/vhosts/giftcardswapping.com/demo/wp- content/plugins/bp-custom.php on line 20** I have also tried renaming the function as well and still receive the same fatal error. I do not understand how it is redeclared anywhere. I would appreciate any help to figure this out. Thank you.


Wrong page displays as home page

My website www.makowerarchitects.com loads up 'something' (for lack of a better word), whereas the correct Home page that needs to show upon visiting the site shows under www.makowerarchitects.com/website...which is the folder where my wordpress installation is. I'm using a template and I never went into changing anything on the template, except add two additional pages (different from the Home Page, which is there by default from the template I'm using). My `.htaccess` file looks like this:               RewriteEngine on     RewriteCond %{HTTP_HOST} ^(www.)?makowerarchitects.com$     RewriteCond %{REQUEST_URI} !^/website/     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule ^(.*)$ /website/$1     RewriteCond %{HTTP_HOST} ^(www.)?makowerarchitects.com$     RewriteRule ^(/)?$ /website/index.php [L]      I'm sure it's just something wrong with some redirecting somewhere, just don't know where. Please help. Thanks.


How can I make my custom posts appear in their assigned category url?

I am trying to solve this problem: I created new custom post types. When I create a post and assign a category (lets say category-1) to it, and when I try to visit the category-1 url, it appears "There has been an error." I tried solving the issue based on the Michal Mau post (How to display regular posts & custom post types that fall under a category using just the generic category template?). My edited code after adding Michal Mau suggestion looks like this:               <?php if (have_posts()) :     global $wp_query;     $args = array_merge( $wp_query->query, array( 'post_type' => 'any' ) );     query_posts( $args );          while (have_posts()) : the_post(); ?>       <article id="post-<?php the_ID(); ?>" <?php post_class('post-holder'); ?>>         <?php if(has_post_thumbnail()) {                     echo '
';                     echo the_post_thumbnail();                     echo '
';                     }                 ?>      **The problem wasn't solved. I don't know if there is a mistake pasting the code or any other mistake.**


Active theme responds to theme change request to alert user

I'm trying to intercept the install themes routine in order to alert the user from the active theme. I'm cobbling together a crude javascript alert below. What are some other options?               if ( is_admin() && $pagenow == 'theme-install.php' && $_GET['tab']=="upload"){     ?>     <script type="text/javascript">         alert('Message here');     </script>     <?php     }      The reason for this is to make sure that the user is not attempting to install my theme's upgrader.zip upgrade file as a theme (which results in a broken theme).


I'm trying to use the Group Extension API in BuddyPress but keep getting a fatal error

I'm trying to use the example code found at http://codex.buddypress.org/developer-docs/group-extension-api/ to use in a plugin, but when I try to use it I keep getting the following error: Fatal error: Class 'BP_Group_Extension' not found in /home/httpd/html/wearewomenmarch.net/public_html/wp- content/plugins/buddypress-group-documents/index.php on line 53 The line 53 in question is as follows:               class BP_Group_Document_List_Extension extends BP_Group_Extension {        And the whole chunk of code I'm trying to use is               class BP_Group_Document_List_Extension extends BP_Group_Extension {       var $visibility = 'private';     var $enable_create_step = false;     var $enable_nav_item = false;     var $enable_edit_item = false;          function bp_group_document_list_extension() {             $this->name = 'Documents List';             $this->slug = 'group-document-list';                  $this->create_step_position = 21;             $this->nav_item_position = 31;         }              function create_screen() { }              function create_screen_save() { }              function edit_screen() {  }              function edit_screen_save() { }              function display() {             display_group_document_list();         }              function widget_display() {  }     }     bp_register_group_extension( 'BP_Group_Document_List_Extension' );      Groups are active on the site, and the BP Group Calendar plugin is active. I see it uses the Group Extension API as well and it works, so I'm sure I'm making some mistake. I'd appreciate any advice on where to go from here so I can resolve that fatal error.


Contact form do not find submit.php file

I added a contact form to the footer. Apparently it works fine in the main page, but if I go to any of the categories, lets say myblog.com/category/, the contact form is looking for submit.php at myblog.com/category/submit.php. Where I should put physically submit.php in order for contact form to find it in any category page?


Admin: Custom Query Returning Permissions Error

Our current WordPress install has a few custom tables we've placed into the WP database that hold misc. information. We've created custom option pages for the WP admin panel for our WP admin users to be able to access the information from the DB through the admin. One option we want is for users to be able to delete some of these records through the WP admin panel, so I've initially setup a custom query to just UPDATE or DELETE the records from the table. However, when I try to submit the query, WP returns the error: "You do not have sufficient permissions to access this page.". Should I be avoiding the MySQL query "UPDATE table_name... etc."?


How do you get thumbnails to show up in the admin edit post?

I tried to add thumbnail support to my theme               add_theme_support( 'post-thumbnails' );     set_post_thumbnail_size(133, 133, true);     add_theme_support( 'post-thumbnails', array( 'post' ) );     add_theme_support( 'post-thumbnails', array( 'page' ) );      So this isnt working, or at least I'm not sure how this should work, help!


Anyone know why wordpress converts some html entities to their numeric equivalents?

Does anyone know why wordpress converts some html entities to their numeric equivalents? I've found that in some posts, where a non-breaking space ` ` entity would be appropriate, wordpress uses ` ` instead. Seems to me that using the symbolic version of the entity would be better than a numeric version. The routine that this is being done in (appears to be) ent2ncr in wp- includes/formatting.php. When I converted my blog from a single site to multi-site (different install & database), the numeric entities were not converted properly (possibly due to a database difference). Had the symbolic entities been used, I doubt this would have been a problem.


redirect users to the login page

I create a template page as seen below to check if user is logged in or not. If user is not logged in, I want to redirect user to first login page and after login I want him to redirect previous page. With the code below, Login redirection function redirects to login page again after user login. How can I fix that code? In my template page :                   <?php         if(!is_user_logged_in())          {              wp_redirect( 'http://....../wp-login.php', 302 );         }         else         {              wp_redirect('----------otherpage---',302 );           exit;         }         ?>      in functions.php :                   function directtorequest( $redirect_to, $request, $user )         {             // instead of using $redirect_to we're redirecting back to $request             return $request;         }         add_filter('login_redirect', 'directtorequest', 10, 3);


New Topic in bbPress

How can I create a new topic from PHP or from a URL Post? I need to post some topic from a mobile app. I am a newbie and don't know much about bbPress API.


How to use github to update my plugin

I am trying to use github for my plugin updates, i have looked around I found this WordPress-GitHub-Plugin-Updater. I am now stuck and cannot get it to work. I have created the simplest plugin to test it and to see how it works before I add it to my plugin but I cant get it to work. The plugin I have put together to test this is here I would really appreciate it if anyone could have a look and let me know what I am doing wrong.


Make next post button link to random post

The normal behavior of this code is move to next post in order by id. Need to change this ascendent order to go instead to a random post (published).
             <?php if (!empty($prevID)) { ?>
                 <a href="<?php echo get_permalink($prevID); ?>"                     title="<?php echo get_the_title($prevID); ?>">Previous
                 <?php }                 if (!empty($nextID)) { ?>
                     <a href="<?php echo get_permalink($nextID); ?>"                         title="<?php echo get_the_title($nextID); ?>">Next
                     <?php } ?>


Theme Functions run a function upon activation or preview

My theme currently has the following line in the function.php file: ` if ( $_GET['activated'] == 'true' || $_GET['preview'] == 1 )` If this statement is true the code runs a function. I am getting a php error that says Notice: Undefined index: activated in and Notice: Undefined index: preview in. I am sure in wordrpess there is another way to do this "if statement" to prevent the Undefined index: error I am getting. Any suggestions? Thank you! Here is the full code:                  //ADD OPTION PAGE                              add_action('admin_menu', 'ddthemes_admin');                                    //UPON ACTIVATION OR PREVIEWED           if ( $_GET['activated'] == 'true'  || $_GET['preview'] == 1 )      { ddthemes_setup(); } function ddthemes_admin() { /* PROCESS OPTION SAVING HERE */ if ( 'save' == $_REQUEST['action'] ) { if ( $_REQUEST['savetype'] == 'header' ) { update_option( 'ddthemes_header', $_REQUEST['ddthemes_header']); } } /* SHOW THEME CUSTOMIZE PAGE HERE */ `add_theme_page(__('Logo Options'), __('Logo Options'), 'edit_themes', basename(__FILE__), 'ddthemes_headeropt_page');} ` `


Internal Server Error 500 with Custom PHP file

I am trying to create a gallery with multiple sortable albums since there are so many pictures. I am doing this by enabling categories on media items, looking up a specific category, gettings all the appropriate IDs, and loading the images into 's. The issue is when I try getting my php file. When I setup the php as an different file Firefox reports... "HTTP/1.1 500 Internal Server Error" However, when the php is inline with the page it works fine. So this leads me to believe that it simply is having trouble getting the file. However I am at a loss as to how to remedy that. Here are my files. All of which are in my theme folder page-gallery.php               <?php get_header(); ?>

          <?php get_footer(); ?>                gallery-loader.php               <?php     $term = get_term_by('slug', 'category-to-look-for', 'category');     $id = $term->term_id;     $images = get_objects_in_term( $id, 'category' );          $gallery_content = '
';     foreach ($images as $image){         $gallery_content .= wp_get_attachment_image( $image, thumb);     }     $gallery_content .= '
';     echo $gallery_content;          ?>      And the jQuery to activate the gallery-loader.php                 $.get("gallery-loader.php", function(data){             alert("got the gallery!");         $("#content").html(data);       });


Multiple Queries and Loops within CPT Archive

I have a Custom Post Type called 'properties', and have set up an Archive page to display posts within that category. Essentially, the Archive page needs to contain 3 different query types; the first to display search results of posts within the CPT, the second to make results sortable (queried through a drop-down menu that interrogates Custom Field meta values), and the third to display all posts within the CPT. I'm not sure how to structure the queries and loops though - all the queries work individually, but I'm struggling how to set up the If/Else statements to make them work within one archive page, so would be grateful for any advice you might have! **Query 1: Search Results**               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;              $args = array(              'post_type' => 'properties',         'meta_query' => array(         'relation' => 'AND',         array(             'key' => 'property_size',         'value' => $_GET['size'],         'compare' => '>='         ),         array(             'key' => 'property_rent',         'value' => $_GET['budget-from'],         'compare' => '>=',         'type' => 'NUMERIC'         ),         array(             'key' => 'property_rent',             'value' => $_GET['budget-to'],         'compare' => '<=',         'type' => 'NUMERIC'         )                 ),        'paged' => $paged           );          $query = new WP_Query( $args );      **Query 2: Sortable Posts within CPT**               if($_POST['square-sort-select'] == 0):          $select = $_POST['square-sort-select'];     $query = new WP_Query(array(         'post_type'=> 'properties',         'post_status' => 'publish',         'meta_key' => 'property_rent',         'orderby' => 'property_rent',         'order' => DESC     ));          ; elseif($_POST['square-sort-select'] == 1):              $select = $_POST['square-sort-select'];         $query = new WP_Query(array(         'post_type'=> 'properties',         'post_status' => 'publish',         'meta_key' => 'property_rent',         'orderby' => 'property_rent',         'order' => ASC     ));          ; elseif($_POST['square-sort-select'] == 2):              $select = $_POST['square-sort-select'];         $query = new WP_Query(array(             'post_type'=> 'properties',         'post_status' => 'publish',         'order' => DESC     ));      **Query 3: All Posts within CPT**               $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $query = new WP_Query();     $query->query('post_type=properties&posts_per_page=6&paged='.$paged);


Multiple domains for multiple single installs

I've done my share of searching, but apparently my search-fu is failing me, because I haven't found anything that really seems to fit my circumstance. **Also, I don't want to just try random solutions and end up bricking everything.** I have a client who has previously managed her site and installations herself and has now hired me on to take things over. Currently there is **one hosting account** with **two domains**. **The host is GoDaddy. It's a Deluxe linux account.**   * There is a Wordpress installation in the root directory of the account, currently serving **domain1.com**   * There is a **second Wordpress installation** in a directory (domain1.com/domain2). This install is suppose to be serving **domain2.com**. Which it does, but it's also posing a bunch of problems. Under the installation for domain2.com ( installed in domain1.com/domain2 ), I **can't change the permalink settings** to anything but default with out breaking the entire site.   * **Changing the permalink settings** results in the warning that Wordpress can't write to .htaccess. **Despite** the .htaccess permissions being set to 644 (I even tried 777).   * So I **manually edited** the .htaccess file to Wordpress's generated content.   * **This results in the site 'breaking'**. The front page shows some default content that I don't recognize and none of the links result in pages being loaded. Just the default 'page not found'. Under the General settings the install is set to:               WordPress Address (URL) : http://www.domain1.com/domain2     Site Address (URL) : http://www.domain2.com      **IS it possible to successfully run two separate domains from two separate Wordpress installs, under the same hosting account, with out switching everything over to a network?**


Show snippets in a category feed but full post in other feeds

Is it possibile to have different feed settings for my main RSS feed and the feed for a category? For example, I want to have a category `foo` that shows only snippets and the post's featured image (using the Featured Image in RSS Feed plugin). I also want to have a feed for all posts, including `foo`, that shows the full content of each post. How can this be accomplished?


Add blog languages to blog-name inside my-site-list in admin-bar

I would like to add the language of every blog to the blogname inside the my- site-list inside the admin-bar. The result should look like this: ![enter image description here](http://i.stack.imgur.com/siKuI.jpg) For adding the languages to to the site-name in (1) I use this code:               add_action('wp_before_admin_bar_render', 'add_language_to_blog_name');     function add_language_to_blog_name( $wp_admin_bar ) {              global $wp_admin_bar;              $wp_admin_bar->add_menu( array(             'id'    => 'site-name',             'title' => get_bloginfo( 'name' ) . ' | ' . get_bloginfo( 'language' ),         ) );          } How can I edit the blognames inside the my-site-list?


Strip $before & $after strings from a page title

So I have plugin that pulls remote data (real estate listings) into a wordpress site. I have been asked by a client to allow the page title for each listing to be set based upon that information and formatted the way they want. I can use the_title filter to change the content of the title easily enough, but I am running into a problem with the $before and $after elements impacting the formatting. For example, twentyfourteen uses this to output a page title:               the_title( '
', '
' );      So if I run the_title filter and do something like this (greatly simplified):               add_filter( 'the_title', 'fls_mls_listing_title_filter', 30, 2 );     function fls_mls_listing_title_filter( $title, $id ) {        if ( in_the_loop() ) {           $new_title = 'Something:
Main Title

Subtitle
'           return $new_title;        }           return $title;     }      I end up with this:
Something

Main Title

Subtitle
           But I would like to end up with this:               Something
Main Title

Subtitle
      Obviously this is not a very logical example, but I wrote it just to keep it simple. I need to do this from within the plugin and without creating a custom page template so it will work with any theme if possible. Any insights would be greatly appreciated.


Custom Meta Boxes and Fields Multicheck Issue

I'm using Custom Meta Boxes and Fields by Justin Sternberg and its pretty great, however there's been a huge issue with using the multicheck checkbox options for me. This is what the plugin's code returns:               '_cmb_seostats_multicheckbox' =>          array (size=22)           0 => string 'alexa_tr' (length=8)           1 => string 'alexa_bl' (length=8)           2 => string 'google_pr' (length=9)           3 => string 'google_bl' (length=9)           4 => string 'indexed_x' (length=9)      How do I test those checkbox options within an if statement?


All images from posts of specific category

I'm photographer and am developing my own portfolio, it's in the final stage. I'm trying to get all images from posts in a specific category. I can actually get all images from all posts, but they just grab everything, published posts, drafts, private etc. And from all categories. And then I could loop in every post attachment to check if it feeds my conditions, but I think it's resource consuming to later discard more than half of the results. So I guess the best option would be the SQL JOIN, which I always get confused. If anyone can provide me some help on this, the logic is as follows:   * Category wanted: Portifas.   * **$wpdb->terms** is the table where I get the Portifas category's ID, 79. But it can be a defined value in my SQL query, so I don't need to open this table for the query.   * **$wpdb->term_relationships** is the table containing six posts with category Portifas. This gotta be dynamic so I can post more stuff inside the category.   * With these results (six now), I gotta loop inside **$wpdb->posts** to check every post inside Portifas category, see if it's published to, finally...   * Loop inside **$wpdb->posts** again and grab all the attachments (images) inside each post that is published inside Portifas. I just can't construct the SQL query to do all of this. All help will be appreciated. Thanks!