Using multiple settings_fields() on 1 settings page

I have been struggling with this one for about a week now. I would like to have 2 variables available on a settings page, but I cannot figure out how to do this using the Settings API. Perhaps there is a better way to do this. What I am trying to do is have one variable that stores a list of sortable values which I am outputting in a table and using jQuery sortable to allow the user to sort. But I also have some related options (such as title for the section) that are not sortable, so I want to store them in a separate variable and output them normally using add_settings_field which is where things break down. The minute I add a second settings_fields() call in the callback function below, it will allow me to set the options covered by the last settings_fields() call. Obviously since the settings_fields() adds the nonce, action, and option_page fields tot he page the second one is overriding the first call. So how do I include a second options variable on a settings page? Here is my code so far: Adding the submenu page:                   add_submenu_page(             'crest_feed_admin',             'Gallery View Options',             'Gallery View',             'manage_options',             'crest_feed_admin_gallery_view',             'crest_feed_menu_gallery_view_page'         );      Register the settings variable:               register_setting( 'crest-feed-gallery-group', 'crest_gv_options' );  // need to add validation!      Callback function for submenu page creation:               function crest_feed_menu_gallery_view_page() {              $options = get_option('crest_gv_options');         ?>

                 <img src="<?php echo CREST_PLUGIN_DIR . '/images/admin-icon-large.png'; ?>" height=32 width=32 />

<?php _e('Gallery List Items & Options'); ?>
             <form method="post" action="options.php">                   <?php             submit_button('Save Gallery View Options');              settings_fields( 'crest-feed-gallery-group' );                   crest_drag_and_drop($options, 'gv');  // this function creates the table of sortable values                  submit_button('Save Gallery View Options');                   ?>             </form>
         <?php        }


Using Apply Filters in the-bootstrap parent theme

In the-bootstrap parent theme there is the following function:               function the_bootstrap_custom_background_setup() {          $args = apply_filters( 'the_bootstrap_custom_background_args',  array(         'default-color' =>  'efefef',     ) );          add_theme_support( 'custom-background', $args );          if ( ! function_exists( 'wp_get_theme' ) ) {         // Compat: Versions of WordPress prior to 3.4.         define( 'BACKGROUND_COLOR', $args['default-color'] );         add_custom_background();     }     }     add_action( 'after_setup_theme', 'the_bootstrap_custom_background_setup' );      I would like to change default-color and add additional defaults including: 'default-image', 'wp-head-callback', 'admin-head-callback', 'admin-preview- callback'. I've read the Codex and some tutorials, but I am having difficulties understanding how to make use of apply_filters to change the defaults. Any guidance would be greatly appreciated! Thank you


Display posts of child category in template

I have a custom post type called freebies. I want to use the archive- freebies.php for the child categories also. I have added in my functions.php the following:               function inherit_template() {         if (is_category()) {             $catid = get_query_var('cat');             $cat = &get_category($catid);             $parent = $cat->category_parent;             $cat = &get_category($parent);             if ($cat->cat_ID == 45){                 include (TEMPLATEPATH . '/archive-freebies.php');                 exit;             }         }     }     add_action('template_redirect', 'inherit_template', 1);      It's working fine so far, it loads the correct archive template, but shows me that there are no posts. What do I have to change? I'd like the template also to display the category name. I looked in the conditional tags, but there are none for custom post types? This is my achive-freebies.php               <?php get_header(); ?>
         <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>" data-lightbox-type="ajax"><?php the_title(); ?>

                     <?php the_content(); ?>
                 <?php do_quickshare_output(); ?>
         <?php endwhile; ?>
<?php next_posts_link( 'Older posts' ); ?>

<?php previous_posts_link( 'Newer posts' ); ?>
              <?php else : ?>
<?php _e('Sorry, no posts matched your criteria in freebies.'); ?>
              <?php endif; ?>
         <?php get_sidebar('2'); ?>
     <?php get_footer(); ?>      I tried also another template loading function               add_filter( 'template_include', 'freebie_page_template', 99 );          function freebie_page_template( $template ) {              if ( is_post_type_archive( 'freebies' )  ) {             $new_template = locate_template( array( 'archive-freebies.php' ) );             if ( '' != $new_template ) {                 return $new_template ;             }         }              return $template;     }      But this is not working at all


Customizing Home Page with Pagelines Platform

I am finding someone who is familiar with Pagelines and could give me a little help in locating the file to edit. I am running my Word Press blog with Pagelines Platform Free Version and have encountered some difficulties in customizing my home page and the search results page. By default, Platform shows 30 most recent posts in the first page of the home page and 30 search results as well in the first page of search results. However, the page is too long and I would like to cut the page to only showing 10 results / posts per page. There isn't a home.php for me to edit and I have found postloop.php but no luck. Does anyone knows how to customize the home page and search results page? Thanks in advance.


Add page-link after post content. Before plugin

I want to add page-link before Facebook Comment plugin. Currently the sequence is:   1. Post content,    2. Facebook Comment,    3. Page link In my `single.php`:               the_content();     wp_link_pages( array(          'before' => '
'.__( 'Pages:', 'themejunkie' ),         'after' => '
'     ) );      In my plugin:                  add_filter ( 'the_content', 'fbcommentbox', 100 );      How to get the following order                1. Post content,      2. Page link,      3. Facebook Comment


Issue with recent custom post type permalink

I'm using the following code in my footer to get the latest posts from specific custom post type.               <?php     //WordPress loop for custom post type with taxonomy      $my_query = new WP_Query('post_type=res&registered_taxonomy=res-cl&posts_per_page=3');           while ($my_query->have_posts()) : $my_query->the_post(); ?>                      <?php the_title( '
', '
' ); ?>               <?php endwhile;  wp_reset_query(); ?>      But whenever I go to any page, the result is different. When I go to another custom post, the footer gets the current page posts, although the number of post is totally different. Any idea what is wrong with my code? PS: I've used reset query at the beginning of the above code.


How to get custom metabox image field?

i have custom metabox with the image field, i can upload image from wp-admin to this metabox, metabox code               array(                 'name' => 'Burst Image',                 'desc' => 'Crop your image to exact dimension before upload!',                 'id' => 'burst_img',                 'type' => 'image'             )      i have code like `$burst_img= get_post_meta( $post->ID, 'burst_img', true );` to get the metabox , but it doesn't work, how can i get the metabox image ?


Wordpress post search shows not related results for search query

First, sorry I cannot show any code because I do not know where the actual problem is. I did not modify anything nor install any plugins, but when I search for a post globally with the default search, I am getting a few correct results back, but the problem is it shows a lot of posts results what are actually not related to the search query. So if I search for example 'Hello World'. I get the Hello World post back and under it I get results like: Football, Basketball related posts and neither the content or title contains Hello World for example. I searched a lot did not find any solution, did anyone else have this problem? Is there a fix for it?


Unable to manipulate rewrite rules without calling flush_rewrite_rules() each time

I am trying to make a small portfolio website in multiple languages. Just a few pages (the actual blog doesn't need to be in multiple languages), mainly pages that are generated by a own-made plugin. (Using template_redirect, couldn't find a cleaner way?) Using this SO post about rewriting rules, I am trying to append /%lang%/ to my urls. Everything works fine while having flush_rewrite_rules() in my init, but as soon as I remove it $wp_rewrite->rules is completely empty. I have the following filters in init:               // Register multilanguage urls     add_rewrite_tag('%lang%', '(nl|en)');          // Filters for url rewriting     add_filter('root_rewrite_rules', array(&$this, 'root_rewrite_rules'));     add_filter('page_rewrite_rules', array(&$this, 'page_rewrite_rules'));     add_filter('rewrite_rules_array', array(&$this, 'final_rules_correction'), PHP_INT_MAX, 1);          add_filter('page_link', array(&$this, 'rewrite_lang_in_permalink'), 11, 3);     add_filter('request', array(&$this, 'default_language'), 9);      All these methods basically do the same thing as from the SO post. I know doing flush_rewrite_rules() every time is bad practice, so I would love to avoid that. On a small related note, is it possible to rewrite custom urls in the menu that point to the website? (some sort of str_replace(base_url, base_url/%lang%/) way?) **EDIT: Added the methods just in case**               public function root_rewrite_rules($rules)     {         global $wp_rewrite;              $struct = ltrim($wp_rewrite->get_date_permastruct(), '/');         $struct = preg_replace('#^%lang%/?#', '', $struct);              $root_structure = '/%lang%/'.$struct;              return $wp_rewrite->generate_rewrite_rules($root_structure, EP_DATE) + $rules;     }          public function page_rewrite_rules($rules)     {         global $wp_rewrite;              if (empty($wp_rewrite->permalink_structure))         {             $wp_rewrite->page_structure = '';             $page_structure = false;         }         else         {             $struct = ltrim($wp_rewrite->root.'%pagename%', '/');             $struct = preg_replace('#^%lang%/?#', '', $struct);                  $wp_rewrite->page_structure = '/%lang%/'.$struct;             $page_structure = $wp_rewrite->page_structure;         }              return $wp_rewrite->generate_rewrite_rules($page_structure, EP_PAGES, true, true, false, false) + $rules;     }          public function final_rules_correction($rules)     {         global $wp_rewrite;              $new_rules = array();         $find = "nl|en";         $find_find = '#(?<!\()('.preg_quote($find, '#').')#';         $preg_node = str_replace('%%%', '(\d+)', preg_quote($wp_rewrite->preg_index('%%%'), '#'));              foreach ($rules as $k => $v)         {             if (preg_match($find_find, $k))             {                 $nk = preg_replace($find_find, '('.$find.')', $k);                 $parts = explode('?', $v);                 $index = array_shift($parts);                 $pv = implode('?', $parts);                 $pv = preg_replace_callback('#'.$preg_node.'#', function ($matches) use ($wp_rewrite) {                     return $wp_rewrite->preg_index($matches[1]+1);                 }, $pv);                 $nv = $index.'?lang='.$wp_rewrite->preg_index(1).(!empty($pv) ? '&'.$pv : '');                 $new_rules[$nk] = $nv;             }             else             {                 $new_rules[$k] = $v;             }         }              return $new_rules;     }          public function rewrite_lang_in_permalink($permalink, $post = 0, $leavename = false)     {         return str_replace('%lang%', DatabaseHelper::get_active_language(), $permalink);     }          public function default_language($vars)     {         if (array_diff(array_keys($vars), array('preview', 'page', 'paged', 'cpage')))             $vars['lang'] = !empty($vars['lang']) ? $vars['lang'] : DatabaseHelper::Dutch;              return $vars;     }


wp_localize_script, variable is not defined in jquery

I try to load a post with Ajax. `functions.php`:               function my_action_callback() {             wp_localize_script('jscustom', 'ajax_custom', array(                 'ajaxurl' => admin_url('admin-ajax.php')             ));             wp_enqueue_script('jscustom');     }     add_action('wp_ajax_my_action', 'my_action_callback');      jQuery code in `custom.js`:               jQuery(window).load(function() {         var morebutton = jQuery('#load-more'),             archive = morebutton.rel,             deftext = morebutton.text(),             page = 1;              morebutton.click(function(e){             e.preventDefault();             page++;               morebutton.text(ajax_custom.loading);         jQuery.post(ajax_custom.ajaxurl, {action:'load_more', page:page, archive:archive}, function(data){...      When I press the "load more" button, I get an error: > ReferenceError: ajax_custom is not defined What is wrong?


Register scripts located in child theme?

I'm having a lot of trouble registering scripts located in a child theme folder: This works fine:               function register_scripts() {         wp_register_script( 'newsletter', get_template_directory_uri() . '/scripts/scripts.js', array( 'jquery-migrate' ), null );     }     add_action( 'init', 'register_scripts' );      However it points to the parent theme folder and not the child, when I try to point to the child theme folder, nothing at all happens:               function register_scripts() {         wp_register_script( 'newsletter', get_stylesheet_directory_uri() . '/scripts/scripts.js', array( 'jquery-migrate' ), null );     }     add_action( 'init', 'register_scripts' );      What am I doing wrong?


Save checkbox value in metabox

I created metabox for specific page template. Now I need to save checked or unchecked value of my checkbox. How can I do that? This is my code:                   add_action('add_meta_boxes', 'add_home_meta');     function add_home_meta()     {         global $post;              if(!empty($post))         {             $pageTemplate = get_post_meta($post->ID, '_wp_page_template', true);                  if($pageTemplate == 'template-home.php' )             {                 add_meta_box(                     'home_meta', // $id                     'Homepage Options', // $title                     'display_home_meta', // $callback                     'page', // $page                     'normal', // $context                     'high'); // $priority             }         }     }          function display_home_meta() {       global $post;         // Add the HTML for the post meta     wp_nonce_field( 'avt_homepage_meta_box', 'avt_homepage_meta_box_nonce' );                /*            * Use get_post_meta() to retrieve an existing value            * from the database and use the value for the form.            */           $value = get_post_meta( $post->ID, 'home_slider_display', true );            ?>
                              <?php _e( 'Display slider on homepage:', 'avt' ); ?>                          <input type="checkbox" name="home_slider_display" value="true" />
     <?php    }          function avt_homepage_save_meta_box_data( $post_id ) {                // Check if our nonce is set.           if ( ! isset( $_POST['avt_homepage_meta_box_nonce'] ) ) {             return;           }                // Verify that the nonce is valid.           if ( ! wp_verify_nonce( $_POST['avt_homepage_meta_box_nonce'], 'avt_homepage_meta_box' ) ) {             return;           }                // If this is an autosave, our form has not been submitted, so we don't want to do anything.           if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {             return;           }                // Check the user's permissions.           if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {                  if ( ! current_user_can( 'edit_page', $post_id ) ) {               return;             }                } else {                  if ( ! current_user_can( 'edit_post', $post_id ) ) {               return;             }           }                /* OK, its safe for us to save the data now. */                // Make sure that it is set.           if ( ! isset( $_POST['home_slider_display'] ) ) {             return;           }                // Sanitize user input.           $my_data = sanitize_text_field( $_POST['home_slider_display'] );                // Update the meta field in the database.           update_post_meta( $post_id, 'home_slider_display', $my_data );         }         add_action( 'save_post', 'avt_homepage_save_meta_box_data' );


Google map that plot's several markers - each one with custom data

I'm looking to create a custom Google map that plots several markers on it that then shows custom data in the popup when the marker is clicked. I've setup the pages in WP in this manner: Map (parent page)   * Company one (child)   * Company two (child)   * Company three (child) ...and so on. I want the map to be on the map page and each marker to be of the child pages. I use this plugin to create custom fields as it allows me to easily create the 20 or so fields (each one consists of various checkboxes, drop downs, image fields etc etc) per page. **How would I loop through each child page and plot the marker based on their post code?**


Redux framework wordpress calling variable [echo]

Can anyone who successfully used this framework help me? Redux states that it utilizes a global variable for referencing all of the saved options in the database. My goal is to access these stored options, so I can figure out how to call them.                array(                         'id' => 'logo',                         'type' => 'media',                         'url' => true,                         'title' => __('Logo w/ URL', 'redux-framework-demo'),                         'compiler' => 'true',                         //'mode' => false, // Can be set to false to allow any media type, or can also be set to any mime type.                         'desc' => __('Basic media uploader with disabled URL input field.', 'redux-framework-demo'),                         'subtitle' => __('Upload any media using the WordPress native uploader', 'redux-framework-demo'),                         'default' => array('url' => 'http://s.wordpress.org/style/images/codeispoetry.png'),                         'hint' => array(                             'title'     => 'Hint Title',                             'content'   => 'This is a <b>hint</b> for the media field with a Title.',                         )                     ),


Pulling in content from another page

I'm using advanced custom fields and Im trying to pull content from sub pages onto the homepage The below works but I was wondering whether it was possible to do this automatically and not write static ids on the fields?               <ul>         <li>             <?php the_field('content', 5); ?>         </li>              <li>             <?php the_field('content', 6); ?>         </li>     </ul>      The page setup is like: home -parent page --sub page --sub page Any ideas would be much appreciated


How to display custom post types using single-[post_type] and archive-[post-type]?

I'm having a bit of a problem with my custom post types... My post type is called 'videos'. I have all of the posts showing on their single page using the 'single.php' template. But when I take the post name out of the url and keep /videos/, I get a 404 - but I want to list all of the 'videos' here. I tried using archive-videos.php file as the codex reccomends: http://codex.wordpress.org/Post_Types, still with no luck. It also says you can do single-videos.php for custom post types, but this doesn't work either. I'll display the code I use to register my post type below, am I doing something wrong?               add_action('init', 'videos_register');     function videos_register() {         $labels = array(             'name' => _x('Videos', 'post type general name'),             'singular_name' => _x('Video', 'post type singular name'),             'add_new' => _x('Add New', 'question'),             'add_new_item' => __('Add New Video'),             'edit_item' => __('Edit Video'),             'new_item' => __('New Video'),             'view_item' => __('View Video'),             'search_items' => __('Search Videos'),             'not_found' =>  __('Nothing found'),             'not_found_in_trash' => __('Nothing found in Trash'),             'parent_item_colon' => ''         );         $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => null,             'supports' => array('title','editor','thumbnail')           );          register_post_type( 'videos' , $args );         flush_rewrite_rules();     }


How to set a custom path, for ajax image upload folder in admin?

I am coding my first Wordpress plugin that handles some data for a custom (shop-like) post type. It also has an image uploader within a metabox, where you simply drag in your images and it automatically handles the uploads, filename and media-library integration without reloading the page. (AJAX) To do this I use Javascript for drag and drop and an AJAX submit to send the images to a wp-function in the backend. I use the `media_handle_upload()` that wordpress offers. It creates my thumbnails and does the upload process using `wp_handle_upload()` it also does the db-part for me which is pretty comfortable. **Code for this Part:**               //// WP AJAX: UPLOAD FILES ////     add_action('wp_ajax_save_attachments', function ($post) {         $file = $_FILES['file'];              if(!empty($file) && $file['size'] > 0) {                  if(isset($_POST['apt_post_id'])) {                 $post_id = $_POST['apt_post_id'];                 // retrieve the filetype & check if is allowed for upload                 $filetype = wp_check_filetype(basename($file['name']));                 $allowed_filetypes = array(                     'image/jpeg',                     'image/png',                     'image/gif',                 );                 if(in_array($filetype['type'], $allowed_filetypes)) {                     // Set up options array to add this file as an attachment                     $post_data = array(                         "post_title"        => 'Testimage',                         "post_content"      => "",                         "post_status"       => "inherit",                     );                     $overrides = array( 'test_form' => false );                          if( $attachment_id = media_handle_upload('file', $post_id, $post_data, $overrides) ) {                         $attachments = get_attached_media('image', $post_id);                         $attachment = get_object_vars($attachments[$attachment_id]);                         $data = array(                             'ID'        => $attachment['ID'],                             'thumbnail' => wp_get_attachment_thumb_url($attachment['ID']),                             'name'      => $attachment['post_title'],                         );                         echo json_encode(array(                             'success'       => true,                             'message'       => 'Image successfully uploaded!',                             'attachment'    => $data,                         ));                         die;                     }                 } else {                     // errorhandling                 }             } else {                     // errorhandling         } else {                     // errorhandling         }     });      Now I want to upload the images to a specific folder like `/wp-root/wp- content/uploads/apartments/` to do this I found out that one can set a filter: `add_filter( 'upload_dir', array($this, 'wpUploadDir') );`which I did and tested with the "normal" (non-ajax) upload and it worked fine. But doing the same with an AJAX upload has no effect at all. It always loads the images to the `../2014/07/` folder. Is there any way to change this? I tried to put the filter-call in the 'admin_init' or 'init' or even before, but nothing seems to work. I can't find anything on google that could solve my question, so I am here. Thank you for any hint and solution! **EDIT: The way how I integrated the filter call:** At this state my class is pretty chaotic, but works fine so far... (the cleanup will follow). I try to only show necessary code because it would be more than 1000 lines of code if I'd post it all. As I already mentioned, I tried 3 calls of the filter. Here you can see them all as comments.               new Zap('zap_apartments');               class Zap     {         // some privates...              /**          *  Stores the upload folder for this post type          */         private $_upload_dir = '/apartments';              public function __construct($post_type_id)         {             // set post_type_id by argument             $this->post_type_id = $post_type_id;                  // set post_type as a new object from Fixture             $this->post_type = new wpObjectsData($this->post_type_id);                  // ONE TRY TO ADD THE FILTER CALL:             //add_filter( 'upload_dir', array($this, 'wpUploadDir') );                  // runs on plugin activation             $this->wpPluginActivation();                  // run global wp init             $this->wpInit();                  // run wp admin init             $this->wpAdminInit();         }                   public function wpInit($post)         {                    add_action('init', function($post) {                      // register post-type to wordpress                 $this->post_type->registerPostType();                      // register taxonomies to wordpress                 $this->post_type->registerAllTaxonomies();                      // ANOTHER TRY TO ADD THE FILTER CALL:                 //add_filter( 'upload_dir', array($this, 'wpUploadDir') );             });         }                   public function wpAdminInit()         {             add_action('admin_init', function() {                      // ANOTHER TRY TO ADD THE FILTER CALL:                 //add_filter( 'upload_dir', array($this, 'wpUploadDir') );                      // register wp scripts                 add_action( 'admin_enqueue_scripts', array($this, 'wpRegisterScripts') );                      // call the metaboxes                 $this->metaboxes();             });         }                   /**          *  Set new wp upload directory for custom post type          *            *  @param  []  (required) array with _FILE structure          *  @return []  array with new _FILE structure          */         public function wpUploadDir($param)         {             global $post;                  if($post->post_type == $this->post_type_id) {                 $param['path'] = $param['basedir'] . $this->_upload_dir;                 $param['url']  = $param['baseurl'] . $this->_upload_dir;             }                  return $param;         }                   /**          *  Register all metaboxes for the plugin          */         public function metaboxes()         {             add_action('add_meta_boxes', function() {                         //   $id (css),      $title,        $callback,              $post_type,         $context,   $priority,  $callback_args                 add_meta_box('zap_coredata', 'Stammdaten',  'apt_coredata',         'zap_apartments',   'normal',   'high');                 add_meta_box('zap_features', 'Merkmale',    'apartment_features',   'zap_apartments',   'normal',   'high');                 add_meta_box('zap_images',   'Bilder',      'apt_images',           'zap_apartments',   'normal',   'high');             });                  // tons of code here                  //// WP AJAX: UPLOAD FILES             add_action('wp_ajax_save_attachments', function () {                      // THE CODE YOU CAN INSPECT ABOVE                  });                  // tons of code here... yes i need to clean up soon, I know! ;-)         }     }      ![Here's a Picture of the callback right after the dropped image has uploaded](http://i.stack.imgur.com/mSzsx.png)


Capabilities don't add

I've wrote this code.               function wpo_install() {         update_option( 'wpo_version', WPO_VERSION );              wpo_add_caps();         wpo_add_roles();              set_transient( '_wpo_activation_redirect', true );     }     register_activation_hook( WPO_ROOT, 'wpo_install' );      In another file:               global $wpo_shared_caps;     $wpo_shared_caps = array(         'edit_wp_orders',         'edit_wp_order',         'edit_others_wp_orders',         'read_wp_order',         'read_private_wp_orders',         'delete_wp_order'     );          function wpo_add_caps() {         global $wpo_shared_caps;              $admin_caps = array(             'backup_settings',             'view_full_reports',             'get_report_output'         );         $admin_caps = array_merge( $admin_caps, $wpo_shared_caps );         $admin = get_role( 'administrator' );              foreach( $admin_caps as $admin_cap )              $admin->add_cap( 'administrator', $admin_cap );          }          function wpo_add_roles() {         remove_role( 'accountant' );         remove_role( 'employer' );              global $wpo_shared_caps;              $read_caps = array(             'read_wp_order'              => true,             'read_private_wp_orders'     => true         );              $acc_caps = array();         foreach( $wpo_shared_caps as $cap )             $acc_caps[ $cap ] = true;              add_role( 'accountant', __( 'Accountant', 'wpo' ), $acc_caps );         add_role( 'employer', __( 'Employer', 'wpo' ), $read_caps );     }      But these aren't working. Please help me. I've confused!


Processing form post data using database queries to construct custom query string

I have a form on my wordpress site. On form submission I want to: 1) Capture the form data 2) Run database queries using these data 3) Process the results and use these to construct a query string 4) Redirect user to site root + query string Outside wordpress, I'd solve this by making the form action="my_query_string_constructor.php" and just do all the necessary processing of the post data there. I considered doing something analogous in wordpress by making the form action some like "single- my_query_string_constructor_posts.php" but this feels very hacky and I'd much rather have a solution which fits with best practice. I want to make sure that my solution is secure but I'm unsure of the best way to use the nonce system here. I'm also unsure whether I should put my database queries and query string construction code in the page itself, or in functions.php, or indeed somewhere else. Would really appreciate your advice on the best approach to take (I'm not asking you to write the code for me!)


Use is_category(), is_tag(), ... in functions.php

I want to check in `functions.php` if actual page is a category page, tag page, ... but the functions to check it (`is_category()`, `is_tag()`, ...) doesn't seem to work, as this condition:               if(is_category() || is_tag() || is_home())      never pass. E.g. is_category() doesn't seem to need to be called on the loop. Any idea of why it's not working and how to solve it? **Edit:** The complete example for my case is: _inside functions.php_               /* Add hentry class to body */           if(! function_exists( 'one_function' )) {         function one_function( $classes ) {             $classes[] = get_classes(); //this is a custom theme function which put the classes into an array.             $classes[] = 'hentry';                   return $classes;         }         if(is_category() || is_tag() || is_home())             add_filter( 'body_class', 'one_function' );  //this is executed if removing the "if" condition          }


'Trying to get property of non-object' when using WP_Query with 'fields' => 'ids'

In an attempt to speed up my query, I'm using the following arguments:               $args = array(         'post_type' => 'product',         'fields' => 'ids',     );          $query = new WP_Query($args);      While this does return an array of IDs as expected, I keep getting multiple `Trying to get property of non-object in /wp-includes/query.php` notices. This happens even when I have nothing inside my `while` other than `the_post()`:               if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();     endwhile;     endif;      Is `the_post()` causing this? Any idea why I'm getting these notices?


Optimised Code for Pulling Taxonomy Posts

I have created a CPT called 'stores', each store has a taxonomy registered to it called 'store-type' (i.e. whether it's a fashion store, or kids etc). There is a third taxonomy 'floor'. A store can be on multiple floors like a large department store. I have been asked by the client to list all the 'stores' by 'store type' and on each floor. So far I have an idea to create a horrible loop like: (only pseudo-code at the moment)               foreach storeLevel as level     {        foreach storeType as type        {           get_posts_by_store_type() /* Note this would be a new WP_Query() */           list_stores();        }     }      As you can imagine, this would create hundreds of queries. There is also some custom fields on each post I need to pull through. Could anyone point me in the direction of a better method to list posts by taxonomy? edit: I have tested a similar bit of code on just listing the stores without going through each level and it's created around 80 queries and only a 5th of the stores have been added. :/


Site migration - some images not displaying in Media Library

After migrating a site from the live server to my test server (different URL), some of the images (not all) are not displaying. The src is correct, image is in the uploads folder, and everything looks good in the database. However, the image does not appear. Again it's only "some" of the images and not all. Other images within the same folders, e.g. wp-content/uploads/2013/09/, are being loaded correctly. Ideas? P.S. And the rest of the content is correct. UPDATE: Found out that all images that are affected include é within the image's filename. Once I copied the filename into the post and meta tables, it worked. Not sure why?


"Print to printer" functionality in a plugin

I want to add "print" button to print simple reports in a plugin. The basic idea I have is to generate a printer friendly html page and redirect user to that page where he/she can use browser's print functionality. How good is that solution? Is there any other alternative?


Add Element as a Filter to the_content

Can I and How would I add a filter in the function.php that would add a HTML element around the content when the_content is used? This would be similar to what you can do with the_title. i.e:               the_title( '
', '
' );      What I need is to add a section element around the content containing a class similar to:               the_content('
', '
');      I know I can:
         <?php the_content ?>
      But if I can filter it in, it would GREATLY reduce the number of php open and close tags by minimizing a lot of the code in the template files [and also i can mindlessly code more w/o having to remember to add the tags - LOL]. Any help will be greatly appreciated. Thnx! EDIT This is what i needed:               function content_filter($content) {         return '
' . $content . '
';     }     add_filter( 'the_content', 'content_filter', 6);


How to make changes to style.php

I am working from a Wordpress theme called Dynamix. The site is located here... If you scroll down to the post with a comment, you'll see a comment bubble, with a solid black background. If you hover over it, you'll notice it turns red. **In Chrome's debugger, I found this line of code...** (It's long, but it starts with this) `#content ul li.socialinit, #content` **and it ends with this background tag...** `background-color: #252525;` (in the debugger). In style.php, which is **here** , I found the code, but I have no idea how to change it. Looks like this: `background-color:#<?php echo $linkcol; ?>;` I don't want the black background. I want it to say `background: none;`, which should fix my issues. **I'm lost on what to do here...**


query post limits

function posts_limit_fn($limit, $query, $custom_limit = ''){         if($custom_limit !== ''){             return $custom_limit;         }         return $limit;     }      this piece of code is executed into an AJAX function `add_action('wp_ajax_search_query', 'search_query');`               $queryString = array( 's' => $searchTerm, 'cat' => $categoriesIDs, 'post__not_in' => array($excludedPost));          if($queryString != ''){         add_filter('post_limits', 'posts_limit_fn',10, 3);         $custom_limit = 'LIMIT 0,4';         apply_filters('post_limits', '', '', $custom_limit);              $query = new WP_Query($queryString);     }      For some kinda of reasons the `apply_filters` doesn't work so the query is returning all posts. What would be the problem ? UPDATE: Seems that If I have something like this :               function posts_limit_fn($limit,$query,$custom_limit = ''){         echo $custom_limit.">>>>>>>";         if($custom_limit !== ''){             return 'LIMIT 0,3';         }         return $limit;     }      the output is `LIMIT 0,4>>>>>>>>>LIMIT 0,10>>>>>>>>>post1,post2,post3`


Display and Update User Custom Meta via user-edit.php

Is there a For/Loop available to display all the available WordPress User Custom Meta Data so that when on the user.edit.php screen you can see and update all custom metadata? I understand methods exist on a per item basis.


Custom Type add Transitions

I have created a custom post type for a slider (namely Piecemaker). I can add posts with featured images and descriptions, that can be used with the slider. Also, I have added a taxonomy for actually creating the sliders(sort of like a category that represents the slider ID, used for creating multiple sliders). My problem is setting the transitions, though. The slider transitions are separate from a slider image, so they cannot be specified as meta values of posts. So, I am thinking, what is the best way to do that. Can I somehow add the ability to specify transitions ? Notice that i don't really want to create a new custom post type to do that. It would be great to have the ability to easily add/remove and edit transitions in the same context of the custom guest post, without them being actual posts (there is no need for that really, they are just simple options). How would you go about that ? Is there a resource that can help me with that, or a Wordpress preferred way of doing something similar ? I know that i can always write my own implementation, like a settings panel, but apart from being an overkill, it will be kinda separated from the custom post type. I would really like a way to connect those.


Plugin option default value

Hi I am making plugin default option sets.I put my code like this.Basically I want to give an image path in plugin folder.I did this .               function add_scroll_default() {     $tmp = get_option('scroll_options');     if((!is_array($tmp))) {         $arr = array("top_image"=>"echo'plugins_url( '/image/top.png', __FILE__ )'");         update_option('scroll_options', $arr);     }      } Upon inspection on database I found that the value stored               echo'plugins_url( '/image/top.png', __FILE__ )'      But I want to put the image url? Thanks


Image still linked as attachment to page even though it has been deleted

I have been working on an image gallery feature where I grab images which are attached to pages and display them in various places via the `get_posts()` function. However, I am finding that when I remove images from the page that they have been placed that they still seem to be set as attachments. I'm just wondering if there's something I'm mis-understanding about attachments or if this is buggy behaviour? It may be worth me adding that I am getting images as attachments of pages because I need to be able to categorise the images and display them via categories in different places on the site. If I was able to categorise images directly I realise I wouldn't need to worry about this problem I'm encountering!


Wordpress use of @ in core files

I am studying twenty_eleven theme and have some quesions. What is                * @package WordPress      * @subpackage Twenty_Eleven      * @since Twenty Eleven 1.0      */      What is the use of @ mean. And again.                * @uses load_theme_textdomain() For translation/localization support.      * @uses add_editor_style() To style the visual editor.      * @uses add_theme_support() To add support for post thumbnails, automatic feed links, custom headers      *  and backgrounds, and post formats.      * @uses register_nav_menus() To add support for navigation menus.      * @uses register_default_headers() To register the default custom header images provided with the theme.      * @uses set_post_thumbnail_size() To set a custom post thumbnail size.      *      * @since Twenty Eleven 1.0      */


Depth > 2 possible with multisite?

Is there anyway to create blogs with 2 depths using multisite? I want to have an installation in root and blogs with 2 depths. Something like:               /         - WP installation: root aggregate      /foo      - WP installation: aggregate for a topic     /foo/item - WP installation: blog for an item      Trouble is that multisite only goes in one level. Other problem is that if I install in root, then I'm afraid that this blog takes everything bellow. So my questions are:   * Is it possible to do an installation of a blog inside another blog? or   * Is it possible to get multisite to allow for 2 depth levels?  Thank you.


Natural URL Design and static front page

A static front page and other pages which are children of it are used on a blog. To give an example: www.example.com The slug for that page shows up in the permalink for sub pages like www.example.com/long-slug-from-static-front-page/sub-page-slug.html. The question now is how to make the URL Design more natural? Since the parent page is the frontpage, it's slug should be the sites homepage-URL (e.g. none as in http://www.example.com/) but the static pages slug is added instead. I smell that this is a shortcoming in WordPress, any ideas? I was asked to make the scenario more concrete by an Illustration because it was quite akward describben. Sorry. Aim is to use WordPress as a CMS to reflect the following structure (please not the other way round): **Illustration:** _Logical Data and it's Structure:_   * Start      * Blue     * Red        * Dark Red       * Light Red       * Burned Red     * Yellow _Mapping of Data to Pages:_   * Start: Home-Page      * Blue: Blue-Page     * Red: Red-Page        * Dark Red: Dark Red-Page       * Light Red: Light Red-Page       * Burned Red: Burned Red-Page     * Yellow: Yellow-Page _URL Layout:_   * Home-Page: http://example.com/     * Blue-Page: http://example.com/blue/     * Red-Page: http://example.com/red/       * Dark Red-Page: http://example.com/red/dark/       * Light Red-Page: http://example.com/red/light/       * Burned Red-Page: http://example.com/red/burned/     * Yellow-Page: http://example.com/yellow/ Is WordPress the tool for the job? Or does using page hierarchy and static front-page contradicts the URL layout?


Wordpress image width top banner background

In http://chuaquanam.ca/wordpress/, would anyone know how to make the image banner in the top of the screen to cover the whole width of the screen which is 1350px (and not 920 px) ? I would like to make it become like this http://chuaquanam.ca/ When I put 1350 as width in the .css file, the image becomes repeatable which is not good. Thanks, Vinh


Can I use a number for a post/page slug?

Is it possible to use a number for a post/page slug? I have tried to use e.g. '123' for my page slug, but each time WordPress converts it to '123-2'. I'm guessing that any number is perhaps interpreted by WP as an ID. The number I want to use has nothing to do with post/page IDs. Can I get around this? And yes, I have a good reason for using a number in stead of text in this case :-) Edit: On a related, more general note, what restrictions are there on what you can put in a slug? I have found that I also can't use the + sign, though I've had that character in file names working just fine.


How to add anchor tag at the top of posts, past the header and nav bar?

my site is here: http://wedding.chloe-nguyen.com/ I am using the default Twenty Fourteen theme, modifying in a child theme (my first). Scroll down and click one of the featured posts. You get taken to the single post page at the top of the page. I would like it to scroll down past the castle, past the nav bar, to the top of the title of the post. I would like my readers to get to the content while keeping the full-screen announcement on every page. I'll add a secondary nav in the right sidebar via a widget. I found this: http://wordpress.org/support/topic/automatically-scroll-down-to- content?replies=6 but I don't know JS and the OP's site is no longer a header followed by the post(s). On my site, the div that holds the content is `<div id="main" class="site- main">` (I did not change this; it is the default code in the Twenty Fourteen theme) Therefore, I think the answer is to make the links that go to posts have #main at the end, but I don't know how. Here's the featured-content.php code:               <?php     /**      * The template for displaying featured content      *      * @package WordPress      * @subpackage Twenty_Fourteen      * @since Twenty Fourteen 1.0      */     ?>

         <?php             /**              * Fires before the Twenty Fourteen featured content.              *              * @since Twenty Fourteen 1.0              */             do_action( 'twentyfourteen_featured_posts_before' );                  $featured_posts = twentyfourteen_get_featured_posts();             foreach ( (array) $featured_posts as $order => $post ) :                 setup_postdata( $post );                       // Include the featured content template.                 get_template_part( 'content', 'featured-post' );             endforeach;                  /**              * Fires after the Twenty Fourteen featured content.              *              * @since Twenty Fourteen 1.0              */             do_action( 'twentyfourteen_featured_posts_after' );                  wp_reset_postdata();         ?>

      Of course, this doesn't include the next post / previous post links, links to posts from the calendar, etc. I just thought I would start with the ft posts. How do I say, "on every post link, add #main at the end"? Am I looking in the wrong place? I saw this: Appending anchor tag to next post which is the closest discussion thread I can find to what I need. I found the add_filter function in the WP Codex but I am unsure about what to put in the parentheses and single quote marks. Thank you in advance. Sincerely, Chloe


Get array value

I want to get a custom post value from post ID PHP code :               $custom_field = get_post_meta(2055, the_field('titdesc'));     var_dump($custom_field);`      Output :               array(6) {       ["_edit_last"]=>       array(1) {         [0]=>         string(1) "1"       }       ["_edit_lock"]=>       array(1) {         [0]=>         string(12) "1373450528:1"       }       ["_wp_page_template"]=>       array(1) {         [0]=>         string(8) "work.php"       }       ["titdesc"]=>       array(1) {         [0]=>         string(34) "and some experience, coffee & fun."       }       ["_titdesc"]=>       array(1) {         [0]=>         string(19) "field_51baf57155c20"       }       ["dsq_thread_id"]=>       array(1) {         [0]=>         string(0) ""       }     }      I want `["titdesc"]` value but not able to get what to write in PHP to get `["titdesc"]`'s value.


display posts from category within a custom taxonomy

I am trying to listing posts from a single category of my custom taxonomy. I have created a custom post type called "news" and a custom taxonomy called "instituteName". I then created a number of categories using the "instituteName" taxonomy. I would now like to display the posts from only a single category. e.g. i have created a category "businessSchool" underneath "instituteName" taxonomy. Now I want to display the four latest post the "businessSchool" category only. ![screenshot](http://i.stack.imgur.com/zlzbw.jpg) Any help would be greatly appreciated!


wordpress plugin to manage the layout/design of a theme

I want to use a plugin that will allow me to manage the layout/design of a wordpress site. Is there such a plugin?


Theme and Plugins sharing common libraries

I have seen a number of similar questions here on WP_SE but I believe my situation is a little different because the common libraries I'm creating are frameworks that I'd certainly like to be able to update and maintain, but are not decorations - ie: I can't author a theme that depends on the library and then degrade the theme nicely if the library isn't found. **Common Libraries** I have a set of utility functions and some classes that I have developed to really speed up certain aspects of WordPress customization. I have been using them extensively in custom themes, and they are then usually bundled in some subdirectory of the theme. Now I'm writing a plugin and I want to use those libraries in the plugin. The logical place for them in the case of plugins would be inside some kind of lib/ or include/ folder inside my plugin's directory structure. The problem of course is that if I'm using both the plugin and the theme, the functions and classes are all being declared twice and that throws an error. Require_once doesn't realize these are the same codebase because of the different paths. One solution would be to bundle all these libs into a separate plugin, and have the theme and the plugin leverage this utility plugin. But because these libs are **essential** to the theme/plugin's operation, the plugin **must** be installed when the theme/plugin is in use. Thinking forward, I don't want someone to have to download and install my theme and then download and install a plugin so that the theme will work. So that solution seems out of the question for me. Can a theme or plugin go and fetch another plugin and install it? Can the theme installation process write to a directory other than `wp- content/themes`? same with the plugin activation process?


Can I create my own "Recent Posts" widget or customize the existing one?

I'd like to enable the Recent posts widget with the ability to show a "View All" link when there are more posts than I've currently got the widget set to show. I'd also like to be able to exclude certain categories or posts from it. Is it possible to do either via my theme's functions.php? (1) Customize the existing widget or (2) Create a copy of it that I can customize?


Change image name during uploading sequentially

Is there any way to change the image name during uploading in Wordpress, but with one requirement - the new file names should be going sequentially, not in hash? There was a very similar question with a fine answer here, but the new characters are going in hash there, not in order. Thank you for any help!


Make three menus with three category levels

I want to have 3 menus of categories, and each menu with diferent level of categories. First menu with First level categories:   * category 1   * category 2    * category 3 If I go to the first category, I want to show a second menu under de first one with child categories of current category:   * subcategory 1.1    * subcategory 1.2    * subcategory 1.3 And finally, if I go to subcategory 1.1, I want to show a new menu with child categories of current subcategory:   * subsubcategory 1.1.1    * subsubcategory 1.1.2    * subsubcategory 1.1.3


How can I reuse the code to capture a param in a URL and place in a value in a hidden form?

I have a form that will be re-used in different posts. I also have php code that will be reused to populate the form with the value in the URL. I tried to use php shortcode and wp php exec, but it doesn't appear to work:                  value = "[exec]echo htmlentities($_GET['source'])[/exec]"      I basically want a simple, reusable way to grab parameters and have it as the value in a hidden field on a form.


Modifying admin sidebar contents to show pending posts indicator

Hey, I've been trying to get a pending count to appear on the admin sidebar, for pending posts, like the little bubble that appears for pending comments: ![Comments pending bubble](http://i.stack.imgur.com/XKhzj.jpg) _Offtopic_ : Am I the only one that thinks this should be core behaviour? Where should I suggest this feature? Anyhow, I found this plugin, but I noticed it didn't always worked. Sometimes the notifier appears on Pages or other item. The code it uses to add the pending count goes something like this:               $menu[5][0] .= " " . number_format_i18n($pending_count) . '';      So, clearly the problem is the hard-coded 5 there, but how can I update it so it always points to Posts? I'll be glad to commit this change to the plugin if we know the answer. Thanks!


Is there plugin to show recent posts from one website in the widget area of another?

I would like to take the titles of recent posts or content related posts from one website and display them in the widget area of another website. I'm sure there must be a way to do this, perhaps some adaptation to the standard 'recent posts' widget? I did something similar before using an rss feed from one site and displaying their titles in a module on another. However this was in a non-wordpress site and I am not quite sure how to achieve the same result here. Ideally I would like to do it without using an rss feed and also be able to control specifically which posts are shown, perhaps being able to define them manually or by other criteria than just 'recent'.


How to add a post from a custom post type as the static page?

I have created a custom post type and added some custom metaboxes to the page edit screen. My objective was to provide specific metaboxes which a user can edit which in turn would allow a user to modify specific content areas of a websites homepage. Everything described above works perfectly except that I seem to be unable to set the page created from this custom post type as the "static page" within the wordpress admin "settings" area. It seems the dropdown which lets your select a static page only shows pages located within the default wordpress "page" post_type. How would I be able to change these settings to achieve my goal?


Synchronize WordPress user accounts across multiple domains and installations without using WordPress MU

As the title suggests, If you had to synchronize WordPress user accounts across multiple domains and installations without using WordPress MU how would you do it?


wp_insert_post not working for custom post type?

For whatever reason `wp_insert_post` doesn't work for a custom post type. Here's the code snippet I'm using.               $new_post = array(         'post_type' => 'rsp_synonym',         'post_title' => wp_strip_all_tags( $row['word'] ),         'post_date' => date('Y-m-d H:i:s'),         'post_author' => 2,         'post_content' => '',         'post_status' => 'publish',         'comment_status' => 'open',         'ping_status' => 'open'     );          $post_id = wp_insert_post( $new_post );          if (is_wp_error($post_id)) {         $errors = $post_id->get_error_messages();         foreach ($errors as $error) {             echo "- " . $error . "<br />";         }     }      Strange enough, it doesn't even return a WP_Error using the `if (is_wp_error($post_id))` conditional. But still, no posts are being added. The custom post type named as `rsp_synonym` has been registered before using this call.


How to add a "policy text" just before the comments?

Is there any plugin that can do that?


Can you have a single set of "canonical" categories shared by all blogs?

When a site gets to a certain scale, storing categories on a per-blog basis starts to get a little messy. Assuming someone would want all WPMU blogs to share a single set of categories, how might one go about that? My gut it so store a set of "cannonical" categories in the root blog. Is there a more elegant or standardized solution?


Sorting get_post_ancestors array

I have written this code for my breadcrumbs (i'll give only the part that I have problem with):               } elseif (is_page()) {         if($post->post_parent){             $anc = get_post_ancestors( $post->ID );                  foreach ( $anc as $ancestor ) {                 $output = '
'.get_the_title($ancestor).'

';                 echo $output;             }      So for a page I'm getting the array of ancestors and it works fine if I have single ancestor. When I have two of them or more then (by default as the codex states): `The direct parent is returned as the first value in the array. The highest level ancestor is returned as the last value in the array.` And that echoes out `HOME > PARENT 2 > PARENT 1 > PAGE TITLE` How can I sort the $anc array so I could reverse it?


How do I paginate a custom post type listing on a custom template page?

I've got a page template called tpl-memos.php which is attached to a page called 'Memos' with a parent page called 'About', the permalink for the page therefor is example.com/about/memos. On this page a custom post type called 'info' is listing its posts, and this custom post type has a rewrite of '/about/memos' – the same as the page structure. This is working pretty good: the posts from the CPT is listed and they get the correct URL, example.com/about/memos/%post_name% and of course it's a single- info.php file that is used to output the posts. My only problem is that I can't seem to get the pagination correct, when clicking 'Previous posts' all I get is a 404 error. Here's some code from tpl-memos.php, nothing special:               <?php     query_posts(array('post_type' => 'info', 'posts_per_page' => 10, 'paged' => $paged));          if (have_posts()):         while (have_posts()): the_post();             // Some content         endwhile; ?>
             <?php previous_posts_link(); ?>             <?php next_posts_link(); ?>
     <?php endif; ?>


Saving checkbox/option list status?

my self-made admin panel works just fine, but it doesn't save values of form inputs. When I type something into textbox and click "save" it is still there after refreshing, thanks to PHP:               <input type="text" name="header" value="<?php echo get_option('header'); ?>" />       So the PHP echoes its own value to a input and everything is just fine. But what to do when I have list of 10 radio buttons or just a checkbox? For now I have a checkbox like this:               <input type="checkbox" name="showS" value="true">      And after clicking on it and saving - it's still "unclicked". Any helping had?


Home page: using custom fields for posts and pages

in my home page I'd like to display some pages and posts title using the custom fields. Unfortunately my code prints only posts title. If there is a key "highlights" print the title. Here my code:               <?php while (have_posts()) : the_post(); ?>              <?php if ( get_post_meta($post->ID, 'highlights', true)) { ?>                  <?php the_title() . "<br>"; ?>              <?php } ?>          <?php endwhile; ?>      How can I print both? Posts and pages title? Thank you


How can I use a file in my plugin as a replacement for single.php on custom-post-type query?

I am creating a Custom Post Type using a custom plugin. One of the requirement of the custom post type is to be presented in a table layout for print / email purpose. It seems that the logical solution for this situation is to include a specific template file in the plugin which will be used on single Custom Post Type query instead of the single.php / index.php provided in the theme. How can I use a file in my plugin as a replacement for single.php / index.php on single custom-post-type query? Thank you in advance.


Get wp_logout_url function to work on external (non-Wordpress) page

I have blog and forum, and I need to put wordpress external logout link. What files do I need to add to make wp_logout_url(); work? Thank you.


WXR XML import is stripping php tags that I need to keep

When I import my `WXR XML` file it appears that wp_insert_post (or another function) is applying filters to strip php tags that I need to keep in my content. I have searched the various wp-include php files to locate: `wp_insert_post`, `sanitize_post`, `wp_strip_all_tags` But I have no clue as to what files to edit and what edits to make to keep from stripping the php tags. Advice and assistance greatly appreciated. Thanks in advance.


finding sidebar content in wordpress

Hey all i have been trying to find the content that loads up for a page for a few days now and can not seem to find where its located. This is the WP code that seems to populate the content:               if ( function_exists('register_sidebar') ) {       register_sidebar(array(         'id' => 'home-top-sidebar',         'name' => 'Home Top Sidebar',         'before_widget' => '

',         'after_widget' => '

',         'before_title' => '
',         'after_title' => '
'     ));      However, like i stated above, i am unable to find where its pulling that data from?!!? The content doesn't seem to be located in any page on the site nor is it in the database? The content that i am interested in goes inbetween the **before_widget** and the **after_widget** The html code when rendered on the page that loads up looks like this (the part where i am trying to find the content from):

State-of-the-art technologies

in the most experienced hands.

      Could anyone point me to the area where this is being pulled from??


meta_query results not the same with and without spaces

I have a meta_query that gets all the items with a price range between 2 variables. My problem is that 10 000 is not the same as 10000. How can I fix this? I have been googling but I'n not sure what to google so I'm not really getting anywhere. Help would be appreciated Thanks Hanè Edit - Code Added                   $kw_min = mysql_real_escape_string($_GET['kw_min']);         $kw_max = mysql_real_escape_string($_GET['kw_max']);         $pr_min = mysql_real_escape_string($_GET['pr_min']);         $pr_max = mysql_real_escape_string($_GET['pr_max']);         if ( !empty( $kw_min ) && !empty( $kw_max ) && !empty( $pr_min ) && !empty( $pr_max ) ) {             $args = array(                 'post_type' => 'exc_agriq_equipment',                  'exc_equipment_cat' => $term->slug,                 'order' => 'DESC',                 'posts_per_page' => 12,                  'paged'=>$paged,                 'meta_query' => array(                     array(                         'key' => 'exc_agriq_equipment_kw',                         'value' => array( $kw_min, $kw_max ),                         'type' => 'numeric',                         'compare' => 'BETWEEN'                     ),                     array(                         'key' => 'exc_agriq_equipment_price',                         'value' => array( $pr_min, $pr_max ),                         'type' => 'numeric',                         'compare' => 'BETWEEN'                     ),                   ),              );         }


Making the wordpress login form a jQuery dropdown

I'm using a plugin called `sidebar-login` to display a wordpress login form (it uses `wp_login_form`) in my sidebar. However, I feel like it the actual form (textboxes and labels) take up too much space and I'd like to hide it all in a slide-down jQuery div. Basically, the user would click on a link called `"Login"`, which would make the login form fade in and slide down for the user to use. The problem is I need to add that link and wrap up the whole form in a div that I can apply a jQuery rule to. What is the recommended way of doing this so I don't break any existing login procedures?


Query all posts which do not have tags assigned to them

Is there a way to query posts which **do not** have tags assigned to them?               query_posts('tag='tag_exmaple'&posts_per_page=-1');            Ty very much!


posts_where Fails with More than One Custom Field in Query

Querying either of the 2 fields individually gives the expected result (posts are displayed). But, when both fields are included in the query (ex = 'foo' and 'bar' shown in below example), then no posts are displayed.               function do_stuff( ) {         global $wpdb;         return "         AND ($wpdb->postmeta.meta_key = 'foo'          AND $wpdb->postmeta.meta_value = '1')          AND ($wpdb->postmeta.meta_key = 'bar'          AND $wpdb->postmeta.meta_value = '1')";     }          add_filter( 'posts_where', 'do_stuff' );      Here is a print_r of the WP_Query:               [query] => Array         (             [post_type] => testPostType             [pagination] => 1             [posts_per_page] => 10             [paged] => 1         )          [request] => SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts  LEFT JOIN wp_postmeta ON wp_posts.ID = wp_postmeta.post_id  WHERE 1=1      AND (wp_postmeta.meta_key = 'foo'     AND wp_postmeta.meta_value = '1')     AND (wp_postmeta.meta_key = 'bar'     AND wp_postmeta.meta_value = '1')  ORDER BY wp_posts.post_date DESC LIMIT 0, 10     [posts] => Array         (         )      ) Have I made a logic error in the sql? How can I get the posts to display as expected?


Post list display year wise

It's possible wordpress single category post display year wise   for example: **2014**   Post1   Post2   Post3   **2013**   Post4   post5   **2012**   Post6   Post7   Thanks


Using media files from RSS feed

I am using the stock "feed" widget to draw an RSS feed from the following adress : http://mouvementdemocrate.fr/rubrique/actualites/feed.xml As you will notice, the feed contains "Media files". These are images to illustrate each post. These do not display in the stock "feed" widget, or in any of the various plugins which I have tried. Is there an easy way to add this image to my widget ? Or, alternatively : Could I create / edit a php function to draw all the elements from the RSS feed and build my own reader to include the image ?


Turning on output buffering in a wordpress plugin

My wordpress plugin uses sessions for handling various things, and on the production site I'm testing it on output buffering is not on by default so I'm getting a lot of messages such as these:               Warning: session_start() [function.session-start]:      Cannot send session cookie -      headers already sent by      (output started at /blah/wp-content/themes/Starkers/header.php:12)      in /blah/wp-content/plugins/rsq/store.php on line 4      Is there a hook or something I can latch on to in order to turn on output buffering? Am I going about this in entirely the wrong way? Thanks, John.


Efficient Taxonomy Intersection

I have many uses for this but I want to know the most performant way of doing what is going to be an expensive operation. As an example I will use a shop. Given:   * A product brand taxonomy   * A product group taxonomy   * A product post type   * Archive templates for the above taxonomies What is the most efficient, performant method, of showing a brand menu when in a product type archive, and a product type when in a brand archive, but, only show the terms that apply to the posts in that group. So for example, if I am in the product group 'womens', it would show brands on the left hand side, but only the brands that are specified for products in the 'womens' product group. E.g. the brand 'Fancy womens clothes Inc' would show, but not 'Manly mens Manly ltd'. I need a generic answer, though I'm happy for the clothing products example to be used, and I know how to do this with a greedy algorithm by brute force, but that's incredibly wasteful, and I'm not interested in a solution that would increase every page load by several seconds and load all the posts in full from the DB in the process edit: Example 2: Pikachu is a yellow pokemon, and is in the yellow tag, but Pikachu is also an electric pokemon, so it's in the electric tag of the type taxonomy. How would I show only the types of pokemon that are yellow when in the yellow tag archive? e.g. all grass pokemon being green means that there would not be a grass menu item when in the yellow archive but there would in the green ( yes I know there are grass pokemon that aren't green )


Check user logged in with JS

I use FaceBook JS SDK to check whether the user has permission to log in to my site or not. If user has permission I log him into the WP site. **It is possible to check with JS whether the user already logged in or not?** Possible to check existance of `wordpress_logged_in_` cookie, and how? I am trying with this code, but doesn't work:               if (document.cookie.search(/^wordpress_logged_in_\w*/) >= 0) {       // Cookei exsist.       alert("Cookie");     }      thanks,


Should I store my Facebook access tokens?

I've built a custom login page for a Wordpress site which uses Facebook for authentication. Is there any reason to store the Facebook access token in my WP database, or does it make more sense to use a PHP session? Are there any benefits to storing these values on my server?


How do I create predefined menus for my theme?

This is my code thus far:               function register_my_menus() {         register_nav_menus(             array(                  'header-menu' => __( 'Header Menu' ),                  'extra-menu' => __( 'Extra Menu' )             )         );     }     add_action( 'init', 'register_my_menus' );      But this seems to only register 'locations' in which to place custom menus. What I want is for all the custom menus (and menu items) to be fully setup on `after_theme_setup` or `init`. Thanks


Adminbar Missing "Edit Page"

I'm encountering a problem that involves that my Admin bar doesn't show the "Edit Page" on pages I visit on my site. Instead for some odd reason it show "Edit Category" instead on supposed page. Does anyone know what might cause this? I checked on another thread about putting `<?php wp_reset_query(); ?>` in the `footer.php` but this didn't work for me. I did it like this:               <?php endif; ?>     <?php wp_footer(); ?>     <?php wp_reset_query(); ?>                Update: I forgot to mention, that I first created a template which was a copy of another one, the only change was that it called a different function. That function was a copy from another, basically what it did was how much text it showed in a post. I also created a different loop.php(named loop2.php) so it could work with this template. So the conclusion of this was that you could choose now a new different template for your page (imagine that the original name was: _template_ and I created _template2_. The changes in **query.php** for the function **wp_reset_query()** which I did after the bug emerged was: **from:**               function wp_reset_query() {              $GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];         wp_reset_postdata();     }      **to:**               function wp_reset_query() {     unset($GLOBALS['wp_query']);     $GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];     wp_reset_postdata();      } I read somewhere on a forum that `unset($GLOBALS['wp_query']);` would help me.. Update #2: The code for the original template:                  <?php          /*         Template Name: Blog List         */         <?php get_header(); ?>

             <?php tie_breadcrumbs() ?>                  <?php if ( ! have_posts() ) : ?>

<?php _e( 'Ej hittad', 'tie' ); ?>

<?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'tie' ); ?>
                         <?php get_search_form(); ?>

             <?php endif; ?>

                     <?php the_title(); ?>

                  <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>             <?php $get_meta = get_post_custom($post->ID);  ?>             <?php tie_include( 'post-head' ); // Get Post Head template ?>
<?php the_content(); ?>
             <?php endwhile; ?>                  <?php //Above Post Banner             if( empty( $get_meta["tie_hide_above"][0] ) ){                 if( !empty( $get_meta["tie_banner_above"][0] ) ) echo '
' .htmlspecialchars_decode($get_meta["tie_banner_above"][0]) .'
';                 else tie_banner('banner_above' , '
' , '
' );             }             ?>                  <?php $cat_query = '';             if ( !empty( $get_meta["tie_blog_cats"][0] ) ) $cat_query = '&cat=' . $get_meta["tie_blog_cats"][0] ; ?>             <?php query_posts('paged='.$paged.'&posts_per_page='. $cat_query); ?>             <?php get_template_part( 'loop', 'category' );  ?>             <?php if ($wp_query->max_num_pages > 1) tie_pagenavi(); ?>                  <?php //Below Post Banner             if( empty( $get_meta["tie_hide_below"][0] ) ){                 if( !empty( $get_meta["tie_banner_below"][0] ) ) echo '
' .htmlspecialchars_decode($get_meta["tie_banner_below"][0]) .'
';                 else tie_banner('banner_below' , '
' , '
' );             }             ?>                  <?php comments_template( '', true ); ?>
          <?php get_sidebar(); ?>     <?php get_footer(); ?>      As I mentioned in the text I did a copy of this one to create a second template.. The copy used a different function. So instead of `the_content();` it used `blog();` which was a copy of `the_content();` except that it had a different value, the value determined how much text it would show in a post in my site.


unexpected   added in HTML at each update

I'm using the last update of Wordpress and I'm not using Tiny MCE. I found many posts about it, but each time it was a bug from a previous version (closed) or linked to Tiny MCE. I modify my pages only in HTML because I'm using complicated CSS and DIVs. Each time I update my code lots of `$nbsp;` are added everywhere even if I remove every spaces between my tags and even at the begining. Here is an example : **before** _(it's the beginning of the page, there's no space or line before`<aside>`)_:               [...]
[...]      **after** :               $nbsp;          [...]          $nbsp;
[...]      And next update each ` ` is duplicated, and next ones again (2,4,8,16...) I tried to add this to function.php, and it didn't work:               remove_filter( 'the_content', 'wpautop' ); remove_filter( 'the_excerpt', 'wpautop' );


How to choose a sort order (for posts) per category? (ideally when creating a new category)

Assume I have a bunch of posts (articles) in two categories: "upcoming events" (cat=1) and "past events" (cat=2). When listing all posts of a specific category out of those two, category 1 shoud be listed in ascending order (first posts first, i.e. earlier upcoming events first), while category 2 should be listed descendingly (earlier previous posts for past events should appear further down the list). With menu entries for navigation, I can use URL parameters like mywordpressblog.example/?cat=1&order=asc However, since I have to add the second parameter "manually" it'll disappear when people just click on the category label that's shown for each post. Hence, I need to pick a sort order when creating or modifying a category, so that this sort order be used when showing all posts of that category. Is there a way to do this? * * * Several related questions don't help me out - since their either asking for defining completely custom sort orders, for sorting categories (not posts), or because they're not yet solved or involve some twinkering the the code which I'd like to avoid in order for plugin and wordpress updates to work well. Setting Custom Sort Order of Posts within a Category http://wordpress.stackexchange.com/questions/22021/different-post-sort-order- within-different-categories Ascending sort order for monthly & category view, i.e. ?m=201204, ?cat=4


Language selection for blog doesn't exist?

I've been installing and developing on Wordpress for a while with a focus on sites in Hebrew. Recently I moved a site from a multi-site installation I have for development to it's own hosting and domain (in the MU environment I used a third level domain for access). I used BackupBuddy to export and ImportBuddy to install in the new location. two different (but possibly related which is why I am combining them to a single question) appeared.   1. In the Settings->General in area there is no language selection dropdown, even when I add the Hebrew language files and check that the wp-config.php has the line: > define ('WPLANG', 'he_IL'); See also screenshot at http://screencast.com/t/9KgtF7e2v0   1. Hebrew text that was hardcoded into some of the templates (such as footer.php) is renderd as question marks ??? ??? instead of proper Hebrew glyphs while the Hebrew text that was stored in the DB (as part of post content etc.) appears just great. Page Encoding is set to UTF-8, the php files that are the templates are also UTf-8 encoded and appear just fine in a text editor (the hebrew characters) - all site uses the same font... Can anyone help me with this mistery? Site in question is: shanilasser.com


How to force <p> insertion in editor

# **EDIT 2** The following edit has some mis-information, see the selected answer and comments. # **EDIT** I am a fool. The editor **was** in fact adding `<p>` tags as expected. I was using a combination of `get_the_content()` and `the_content()`. Apparently the former will strip out these tags, just leaving a block of text _(which still leaves me in a predicament but im sure I'll figure something out)_ follow up question: should I delete this question? or is this kind of thing helpful to have in the search....? * * * When I paste text from different sources into the wordpress (tinyMCE) content visual editor I am getting different results. Ironically, it works how I want it to when pasting from MSWord, but not when going from notepad (or another website, or notepad++). Ideally I would want any pasted text to get wrapped in `<p>` tags (based on line breaks) and otherwise have minimal markup added. The big issue here is the `<p>` : linebreak issue. I want the client to be able to paste a few paragraphs of text in and be able to set the margins and padding so as to make it look nice. This must be a pretty normal expectation, and I am suprised that I am having difficulties with this, as I have built several WP sites before without noticing this issue.


Modifying .page-content background image

How can I implement it so that I switch per-post background images from the WP post-edit screen? A developer helped me built a custom WP theme, but can't help me out right now. On this page: http://vernisaj.ro/guetlinvelo/a-la-carte/litespeed/ there is a background image on the following CSS element:               .page-content { background-image: url('http://www.....' }      However in the WordPress editor, I can't seem to find this picture (I looked in all php files and css files, it's in there). Thanks for the help! EDIT: With the WordPress Editor I mean the one you'll get through Appearance -> Editor.


Creating author profiles with extra fields and exporting that data?

I'm trying to find a way to let my subscribers sign up to my site and enter details in their author pages to confirm their attendance at an event. In order to create the additional fields, I've been following this excellent tutorial by Justin Tadlock: http://justintadlock.com/archives/2009/09/10/adding-and-using-custom-user- profile-fields However, I need a way to export that information - is there a plugin that would let me do that? Or a useful resource for building something that would let me export that info as a csv file? Thanks for any pointers, Osu


Is there a way to use regular categories with custom post types? It seems like there is better functionality and options with regular categories (such as permalink options, etc.).


looking for wordpress action hook for new pending post?

Im looking for an action hook to link my function to when a completely new post is created with a **status of pending**? I'm aware of 'save_post' and others but want to target **specifically when a post is new**. Found this on a previous question:               add_action('new_to_publish', 'your_function');     add_action('draft_to_publish', 'your_function');     add_action('pending_to_publish', 'your_function');      but could do with something like `new_to_pending` or similar? any help would be great! Thanks


Is it advisable to use `add_rewrite_rule()` to serve a custom page?

I have a page called "dynamic" that's not stored in the post table at all (not a post, page or custom post type of any sort); the reason being is all the data is completely dynamic based on `$_GET` requests. This is a pretty close representation of how I've done it               add_action( 'init', array( $this, 'add_custom_rewrite' ) );     add_action( 'parse_request', array( $this, 'custom_requests' ) );     add_filter( 'query_vars', array( $this, 'custom_query_vars' ) );          function add_custom_rewrite() {         add_rewrite_rule(             'dynamic/?$',             'index.php?dynamic=true',             'top'         );     }          function custom_requests( $wp ) {         if( !empty( $wp->query_vars['dynamic'] ) ) {             dynamic( $_GET );         }     }          function dynamic( $get ) {         // ... do stuff with $get         load_template( get_template_directory() . '/dynamic.php' );         exit;     }      Now I ask this question as the page seems to finish early. It loads up the `wp_footer()` function and all the good stuff, but doesn't show an admin bar like all the other standard pages. Is there a better way to approach this issue; maybe using a real post type stored in the DB and referencing that?


Displaying comments with a walker: how to distinguish between parent and child comments

I have defined a walker in function.php to display comments in a certain way. I use the following code:               function speld_comment($comment, $args, $depth) {     $GLOBALS['comment'] = $comment; ?>     <?php      global $comment_count;     $comment_count++;      ?>          <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">     <div id="comment-<?php comment_ID(); ?>">
             <?php echo get_avatar($comment,$size='48',$default='http://www.speld.nl/wp-content/themes/speld5/images/avatar.png' ); ?>
<?php echo $comment_count; ?>

             <?php if ($comment->comment_approved == '0') : ?>             <?php _e('Een moment geduld, uw reactie wordt beoordeeld door de Speld Waarheidscommissie.') ?>             <?php endif; ?>
                 <?php printf(__('%s'), get_comment_author_link()) ?> •                 <a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php printf(__('%1$s, %2$s'), get_comment_date(),  get_comment_time()) ?>                 <?php // we want to add 'Zie profiel' here.. comment_author_link()  ?>
             <?php comment_text() ?>
                 <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'reply_text'=>'Reageer', 'max_depth' => $args['max_depth']))) ?>

      I've also enabled reacting to a comment (1 level deep). The problem is in the comment_count variable. Whenever somebody replies to a comment, the numbering for all comments below the reply shifts one number down. I'd like to prevent that from happening. Is it possible to make an if statement in the walker that allows reactions to a comment to not contain the comment_count variable? Any help would be greatly appreciated!


How to display each level of taxonomy children on separated pages?

For the products page I've created custom taxonomy with 3 levels of subcategories. I have to display for each term the image and the title(i'm using a plugin which gives you the permission to add an image to a category). What I really want is to display the list of subcategories( title + image ), each level on separated pages(when you click on the parent category to display the first level of subcategories, when you click a subcategory to display the 2nd level of subcategories, and so on). Here's the code from the taxonomy file: http://pastebin.com/3HaK83Uk And here is the my_list_category function: http://pastebin.com/eSenz2qM Right now, when I click on the category parent it displays all levels of subcategories. Can someone help me with that?


Wordpress: Keep order of query_posts list of post ID's using post__in

I need to request a certain list of posts in the order I want. I'm getting the posts using:               query_posts('category_name'=>'cases', 'posts_per_page'=>5, 'post__in'=>$_SESSION['sorting'], 'paged'=>$paged);      It works in that I get the posts in the array $_SESSION['sorting'] but the problem is that my sorting gets lost even if iI don't suggest a special orderby field. Can anyone help me?


Add additional data to a specific taxonomy term when used in a post

If I'm using a custom post type for a Movie or a TV show episode, I may use a taxonomy for "actors" and assign all the actors related to the work to it, but I'm not sure how, besides of that, I can also add **the character the actor is playing in said work**. The characters themselves may or may be not a taxonomy, as sometimes one also needs extra space for adding notes, like "John Doe (voice)" or "John Smith (via stock footage). I can figure something like a metabox with columns for each thing, yet I'm not sure how to make it harmonious (or do it at all).


How can i show all categories using wp query?

<?php $recent = new WP_Query(); ?>     <?php $recent->query('cat=1&showposts=2'); ?>      With what can i replace cat=1 to show posts from all the categories?


Posts & page twice display

I install a fresh blog and add some posts & pages. With normal template/theme the pages and posts are fine while showing twice when i changed the theme. The problem lies in the template but i don't have any idea, is there any problem in the loop or something else? ### Additional Info: Theme is Sahifa, a multi purpose magazine theme. If you need code sample of any file. i will show you.


Change labels on 'Nickname' and 'Biographical Info' in user-edit.php

For a project I'm working on, I want to change the labels of the 'Nickname' and 'Biographical Info' fields on edit profile (user-edit.php) page in the dashboard. I still want to use those fields as they are, I only want to change the labels. Anyone know of a function that can do this?


security issue in wordpress?

I have installed wordpress in `www.mysite.com/user` and now suppose if someone is familiare with wordpress he/she can easily access my stuffs through `www.mysite.com/user/members` `www.mysite.com/user/groups` etc even he can see all stuffs from `www.mysite.com/user` without logging in to my site.Is there any way to prevent this.something like access denied if he is not logged in or any kind of redirection to a specific url. or something like You don’t have permission to access `/members/` on this server .I am facing lots of problem because of this.I am using frisco for buddypress theme.


how to edit bbp_forum_freshness_link() format

I'm trying to find how to edit format of `bbp_forum_freshness_link()` function in bbpress plugin. E.g. currently it displays how many days ago there was last activity and I would like to display date. So if someone would like to share some thoughts or code snippets, that would be great.


Pushing to git from wordpress (not the other way around)

Is there any way to link the wordpress theme-editor to a git repository? So when a file is updated in the wordpress editor the change automatically gets pushed?


Display pictures instead of text in menus

I am working on a custom theme. In that theme, I am creating a menu called "social" for links to the social sites, such as twitter, facebook, ...etc. Now, Instead of text, I would like to display social media icons. How can I do that? Make every menu item an image? Thanks.


How do I display user name, role and site name using HTML tags inside a dashboard notification?

Here's what I have so far as my notification, but I can't find any information around how to input the user's name, role and site name within those sections. You can see where they are supposed to go. Any help would be much appreciated as I've been stumped for a few days now...               function my_network_notice(){         global $pagenow;         if ( $pagenow == 'index.php') {                  echo '

[DISPLAYNAMEHERE]

[USERROLEHERE], [SITENAMEHERE]

     }         }         add_action('admin_notices', 'my_network_notice');


WordPress Caching - Transients API or "update_user_meta " Cronjob?

I'm trying to set user meta based on queries. Basically, things like IF the query returns true, set this or if not, set this (or don't set it, if it is true). This works great but the problem is I currently make the call EVERTYIME to check true or false which I know is bad and unnecessary especially for the types of queries I am making (if it is true, it will ALWAYS stay true after that). So, how should I cache these requests? Should I set it with the WordPress Transient API or should I do a cron job to run every X hours and then "update_user_meta" based on the result? I am just a bit lost on either approach and need some guidance on the right path for this. Thanks!


Is wp_reset_postdata always necessary?

After run a query               $posts = (array)new WP_Query($args);      I use this data to do some calculation on post meta. I didn't display the posts. Do I still need to use `wp_reset_postdata` after the query?


Second wp_query doesn't appear to be working

I've set up this query in Wordpress to find all associated news for a company:
Related News
            <?php $link = get_the_title(); ?>         <?php $portfolioloop = new WP_Query( array( 'post_type' => 'news' ) ); ?>     <?php while ( $portfolioloop->have_posts() ) : $portfolioloop->the_post(); ?>           <?php $post_link = get_post_permalink(); ?>         <?php $post_title = get_the_title(); ?>                                 <?php  if (get_field('featured_companies') != "") { ?>
             <?php foreach(get_field('featured_companies') as $post): ?>                 <?php $company = get_the_title(); ?>                 <?php if ($company == $link) { ?>                     <a href="<?php echo $post_link; ?>"><?php echo $post_title; ?>
                 <?php } ?>              <?php endforeach;?>
         <?php } ?>     <?php endwhile; wp_reset_query(); ?>      I then wanted to create the same thing but find all events associated with the company. Even though news and events are setup exactly the same way it doesn't seem to work, what am I missing???
Related Events
         <?php $link_e = get_the_title(); ?>          <?php $portfolioloop_e = new WP_Query( array( 'post_type' => 'events' ) ); ?>     <?php while ( $portfolioloop_e->have_posts() ) : $portfolioloop_e->the_post(); ?>           <?php $post_link_e = get_post_permalink(); ?>         <?php $post_title_e = get_the_title(); ?>                                 <?php  if (get_field('featured_companies') != "") { ?>
             <?php foreach(get_field('featured_companies') as $post_e): ?>                 <?php $company_e = get_the_title(); ?>                 <?php if ($company_e == $link_e) { ?>                     <a href="<?php echo $post_link_e; ?>"><?php echo $post_title_e; ?>
                 <?php } ?>              <?php endforeach;?>
         <?php } ?>     <?php endwhile; wp_reset_query(); ?>      I tried wp_reset_query, but I don't have any real clue what to do!


List taxonomy term "Last Name" + "First Name" (taxonomy custom field) in a post loop

I have a few custom fields for a taxonomy "Author". The term title is the Author's last name, and one of the custom fields is his first_name. Now I need, in a post loop, to list all "Authors" of that post by their full name. How can I do this? I'm using Ultimate CMS plugin to manage taxonomy custom fields.   Just to be clear this is a post type "Academic Article" with the authors as a taxonomy. Thank you.


Wordpress multisite with same content

Trying to accomplish the following. Any help / advice is greatly appreciated. 1) I have multiple domain names (e.g., site1.com, site2.com, site3.com). 2) I need each domain to display the same content BUT 3) Show a different wordpress theme.Plugins are same...etc Thank you


How would one go about adding a category name to the url of multisite subsite?

How would one go about adding a "category" name to the url of multisite subsite? eg. http://mainsite.com/categoryname/subsite Simply editing site info settings doesnt help. I am trying to make a collection of subsites look and feel as though they are a category in the main site.


Arrange BBpress topics by created

The default setting in the bbpress forum topics is that the most active topic automatically gets on top (sorted by freshness). However, I wish to change this setting in descending order of topics created or by topic id. I have tried to locate the template file to make these changes but could not get. Any help is appreciated.


Creating a shortcode in a plugin that includes JS

I use a lot of embedded tweets on my site. The script always gets stripped out. I added Twitter's code to my theme, but it doesn't work with infinite scroll. So I'd like to make a shortcode that will import the needed script from Twitter. Please take a look at what I've got below. I can't get it to work and I'm not sure what's wrong. Thanks.               <?php     /*     Plugin Name: Tweet Shortcode     Description: Use [tweet] to insert the Twitter embed javascript so it won't be stripped from your post.     Author: Nate Hill     Version: 0.1     */          add_shortcode( 'tweet', 'tweets' );     function tweet_code( $atts ) {     $tweet_text = <<<'EOD'     <!-- Tweet JS. Do not edit. -->     <script LANGUAGE="JavaScript"  TYPE="text/javascript" async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>     <!-- end  Tweet JS tag -->     EOD;     return $tweet_text;     }


Moving from development while pulling production database without overwriting, to production

I am involved in a redesign of a client's website and during development the client has been adding posts/pages and working with existing plugins that were on the site. I have made a new theme and added new plugins including plugin settings to the new design. My question is how can I pull the current production database to my development without overwriting what I've developed. I was looking at the wp-db-migrate-pro plugin to migrate only certain tables but there are some complications. the wp-posts tables includes navigation menus and pages and if I were to pull that table I would destroy the pages and menus I have created. In addition there are plugin settings I need from the production site but pulling the wp-options table would overwrite the plugins and their settings I have on development. Is there an easy deployment strategy I could follow to grab data while not overwriting my own? This article https://deliciousbrains.com/avoiding- wordpress-database-merging/ talks about it but the two strategies suggested aren't really viable for me as they are difficult to write and manage.


Registration and Profile custom field

How to add custom field in wordpress registration form and view it in user profile in the backend? I've already google it but just find how to add it in user profile but not in registration process.


CSS not loading correctly

I have made a website, and am hosting it on my Raspberry Pi. It works really well on the LAN, but when I look at it through a proxy, or shoot the link to a friend, all I/they see is plaintext. Since I use Firefox, I pulled up Firebug. Oddly, it seems to indicate that the page has loaded the CSS (Stylesheets appear to be there, but not in use). Or at least that's what I believe to be happening. Any help appreciated. **I guess I should have clarified that I created a WP webpage.