Problem storing arrays with update_user_meta

I am writing a function that adds an ID number to an array and puts the array in the usermeta. $_GET['auction'] is the post_id. Here is the function:                       $reminders = get_user_meta($current_user->ID,"reminders");             print_r($reminders);             if(in_array($_GET['auction'],$reminders)) {                 echo "Failed: Auction already in list";             } else {                 array_push($reminders,intval($_GET['auction']));                 if(update_user_meta($current_user->ID,"reminders",$reminders)) {                     echo "Success";                 } else {                     echo "Failed: Could not update user meta";                 }             }             print_r($reminders);      Here is the output after adding one auction:               Array ( )      Success     Array ( [0] => 7 )       Here is the output after adding two auctions:               Array ( [0] => Array ( [0] => 7 ) )      Success     Array ( [0] => Array ( [0] => 7 ) [1] => 73 )      And here is the output after adding three auctions:               Array ( [0] => Array ( [0] => Array ( [0] => 7 ) [1] => 73 ) )      Success     Array ( [0] => Array ( [0] => Array ( [0] => 7 ) [1] => 73 ) [1] => 0 )      Notice that adding a new element to the array using array_push works fine. But when the array is stored in the usermeta then retrieved again, the last element in the array has been put into an array of its own, creating an infinitely dimensional array. I'd prefer to keep this array one dimensional. Is there a way I can run update_user_meta and get_user_meta without it changing the structure of my array?


List 'n' number of posts from a Tag, each with a different class or ID

I want to list 'n' number of posts (ordered by latest first) -- post's title linked to the post's permalink -- from a tag on my WordPress blog. I also want to assign each link its own class or ID. I checked this doc on WordPress Codex, which is very relevant to what I need, but makes little sense to me (and I'm therefore unable to modify it to my needs). Hope I am clear enough, if not, I can try to clarify. **EDIT:** Just so it's clear, I want to be able to list the posts wherever I want. Any template.


How to add a sub menu with AJAX?

What i want to do is fire up the `add_submenu_page()` function from within ajax on my plugin options page. When i click an "Add League" link, i want to display an ajax input[text] that will save into the database, then add the submenu page using the values that have been inserted. I am also hoping to be able to delete the entry as well as the newly created page.


How to list events by category and month with plugin Event Organiser?

I need to display a list of events by category and month. For example I need to list all the Mountain Bike events in July.


Loop not appending through infinite-scroll ajax call

I'm having trouble debugging why the InfiniteScroll jQeury plugin isn't loading more of my .boxy class items. So far I've placed the div containing the selectors in different levels of heirarchy, but this isn't working to suss out any console errors.

                      <?php if (have_posts()) : ?>                     <?php while (have_posts()) : the_post(); ?>

                                 <?php echo time_ago(); ?>

                             <a href="<?php if(get_post_meta($post->ID, "url", true)) echo get_post_meta($post->ID, "url", true); else the_permalink(); ?>" rel="<?php the_ID(); ?>"><?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?>

                                     <a href="<?php if(get_post_meta($post->ID, "url", true)) echo get_post_meta($post->ID, "url", true); else the_permalink(); ?>" rel="<?php the_ID(); ?>"><?php the_title(); ?>

                       <?php endwhile; ?>                      <?php endif; ?>

                             Load more

      Here is the code I've found to be the most elegant so far for the InfiniteScroll jquery plugin:               $(document).ready(function($) {             var $container = $('#articlePost');          // infinitescroll() is called on the element that surrounds     // the items you will be loading more of       $container.infinitescroll({              navSelector  : $('#nav-below'),                // selector for the paged navigation          nextSelector : $('#nav-below a'),                        // selector for the NEXT link (to page 2)         itemSelector : $('#articlePost'),                        // selector for all items you'll retrieve       },         // trigger Isotope as a callback         function( newElements ) {           // hide new items while they are loading           var $newElems = $( newElements ).css({ opacity: 0 });           // ensure that images load before adding to Isotope layout           $newElems.imagesLoaded(function() {             // show elems now they're ready             $newElems.animate({ opacity: 1 });         $container.isotope( 'appended', $newElems );           });         }       );     });


Allow Authors to edit all their own comments, even on others' posts

I recently found on my multiuser WordPress site that people with Author access can edit their own comments only if they are commenting on their _own_ posts. As far as I know, this is all the edit_post capability allows them to do. I want them to be able to edit all the comments they have written, on _others'_ posts as well. This post mentions the edit_comment capability, which sounds promising, but the questions didn't actually clarify whether that actually allows authors to edit all their comments, or only those on their own pages/posts. If a user has edit_comment privilege, can she edit a comment she wrote on someone else's post? I would prefer to do this through a reliable plugin if that's possible, so I don't have to worry about things breaking on the back end - I don't have a lot of time to maintain this site. (Does User Role Editor allow edit_comment? The screenshots don't show it.) But if the only way to do it is through editing the PHP, it's worth knowing that too.


how do you use Wp-cli on Shared Hosting?

I Have Godaddy Deluxe linux hosting it is shared server, so I don’t have the root password of the machine. I can create, move and delete files via SSH in my home folder but not in the root directories like /opt /etc.               curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar          php wp-cli.phar --info          chmod +x wp-cli.phar          sudo mv wp-cli.phar /usr/local/bin/wp      I am not able to execute the `sudo` command. Can anyone gives me alternate way for installing it?


Use radio buttons & checkboxes for post categories

For my users, I need them to be able to have both radio buttons and checkboxes in the categories when posting. I have seen a solution to make the checkboxes when selecting a category radio buttons, so that a user can only ever choose 1 category. However, I have a scenario where two categories are mutually exclusive and the rest are a free for all. So, the user MUST choose between category A/B. But can then have free choice of categories C/D/E/F/G/H, ETC Is there a way to do this? Thanks, Ian


Copy wp_postmeta from one database to another

I had a site setup on old-domain.com, which used the database old_db. Recently, we had to migrate our website to a new server and domain, new- domain.com which uses the database new_db. I installed a fresh copy of wordpress to the new server, and using the wordpress import tool I was able to import all my posts to the current setup.The images did not copy over, so I simply copied over the wp- content/uploads folder to the new setup, and fixed the image urls using the plugin Search And Replace Now the issue is, I have all posts appearing proper with images and everything. Everything except Featured Images. The site is not showing any featured images whatsoever. I was told that I need to copy over the postmeta data from old database to new one in order to correctly link them. Both databases are on the same server. Any help would be hugely appreciated.


get posts from 2 categories. (2 posts)

I have a custom post (it's called "items") and 2 categories there.   1\. on category page, I need to get posts which belong to 2 categories. get posts from category1="Food" and category2="featured" How can I get these posts from 2 categories? This is what I have been doing is.... I just got posts from "FOOD" like this. at the same time, I also need to get "featured" from "cate-type2". I am new here so I have no idea how to put html, php codes.. :) * * *               global $post;     $tmp_post = $post;     $args = array(         'posts_per_page'  => 5,         'post_type' => 'item',         'tax_query' => array(             array(                 'taxonomy' => 'cate-type1',                 'field' => 'id',                 'terms' => 39 // Food taxonomy id             )         )     );          $myposts = get_posts( $args );          foreach( $myposts as $post ) : setup_postdata($post); ?>      * * * ADDITION CODE: relation and AND      so I need to get posts from   tax1 : item-special (cate id: 6)   tax2 : item-category (cate id: 39)   * * * ` $custom_terms = get_terms('item-special'); $other_custom_terms = get_terms('item-category'); foreach ($custom_terms as $custom_term) { foreach ($other_custom_terms as $other_custom_term) { wp_reset_query(); $args = array('post_type' => 'item', 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'item- category', 'field' => 'id', 'terms' => 6 ), array( 'taxonomy' => 'item- special', 'field' => 'id', 'terms' => 39 ), ), );                $loop = new WP_Query($args);      if($loop->have_posts()) {         echo '
'.$custom_term->name.'
';              while($loop->have_posts()) : $loop->the_post();             echo '
'.get_the_title().'
';         endwhile;      }      } } ## ` I think I have little problems with this code. it shows but duplicated and all item posts. how should I fix it? Thanks,


restricting the number of character for permalink

I have this code to set the number of characters in URL more than 20 word, But i try this and not work, Where are the problem.               add_filter( 'sanitize_title', 'wpse52690_limit_length', 1, 3 );          function wpse52690_limit_length( $title, $raw_title, $context ) {         //  filters         if( $context != 'save' )             return $title;              //  vars         $desired_length = 100; //number of chars         $desired_words = 50; //number of words         $prohibited = array(             'the'             ,'in'             ,'my'             ,'etc'             //put any more words you do not want to be in the slug in this array         );              //  do the actual work         // filter out unwanted words         $_title = explode( ' ', $title );         //if you want more than one switch to preg_split()         $_title = array_diff( $_title, $prohibited );         // count letters and recombine         $new_title = '';         for( $i=0, $count=count($_title); $i<$count; $i++ ) {             //check for number of words             if( $i > $desired_words )                 break;             //check for number of letters             if( mb_strlen( $new_title.' '.$_title[$i] ) > $desired_length )                 break;                  if( $i != 0 )                 $new_title .= ' ';             $new_title .= $_title[$i];         }              return $new_title;     }


Media uploader edit image direct in edit-psot view

I want to make available to edit custom fields (its gallery) direct in edit- post view. Im using ACF plugin so I have this view: http://grabilla.com/04906-95db6a64-4c3f-497a-b312-67fff32ab21f.html I need to integrate media uploader editing direct in this table Any ideas?


using jQuery Cycle by Malsup with WordPress Page and Gallery

I would like to modify a WP Gallery to use the jquery cycle plugin by malsup. I know this is possible but would like to know best practice for this, if anything just pulling out the url for each image should give me enough to work with. Please advise on best practice for this. Note I do not want to use a plugin and would like to build this site on WP Core.


How to get my loop to paginate?

Below is a snippet of code that appears on one of my pages called: Featured. I created a template and then respectively created a page and activated the template in the wp-admin. However when I click the button to paginate to page 2, which looks something like: http://example.com/featured/page/2 the next page shows up blank with no content (and I have plenty of content in the respective categories to display.) Any ideas what could be wrong here? Let me know if you need further clarification with my issue and/or code. ### All Features                    <?php         $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;         $args = array(                 'post_type'=> 'post',             'category_name' => 'featured-content, podcast',             'posts_per_page' => 10,             'paged'=> $paged         );         $temp = $wp_query;         $wp_query = null;         $wp_query = new WP_Query($args);         if (function_exists('wp_pagenavi')) { wp_pagenavi(); }         if ( $wp_query->have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post();     ?>          <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>         <a href="<?php the_permalink(); ?>">             <?php the_post_thumbnail('featured'); ?>

<?php the_title(); ?>

By <?php the_author(); ?>

               <?php endwhile; endif; ?>                    <?php if ($wp_query->max_num_pages > 1) : ?>         <?php next_posts_link( __( '← Older' ) ); ?>         <?php previous_posts_link( __( 'Newer →' ) ); ?>     <?php endif; ?>               <?php     /* PageNavi at Bottom */         if (function_exists('wp_pagenavi')){wp_pagenavi();}         $wp_query = null;         $wp_query = $temp;         wp_reset_query();     ?>


Contact Form 7: custom validation

I'm currently using the Contact Form 7 plugin, which is great and works perfectly, but what I'm now trying to achieve with it is some custom validation rules.   I found this extension: http://code-tricks.com/contact-form-7-custom- validation-in-wordpress/ that once added to `functions.php` adds a whole raft of extra validation rules.   For example:               $acceptNumbers = array('acceptNumber', 'acceptNumber1', 'acceptNumber2', 'acceptNumber3', 'acceptNumber4', 'acceptNumber5', 'acceptNumber6');          foreach($acceptNumbers as $acceptNumber){         if($name == $acceptNumber) {             $acceptNum = $_POST[$acceptNumber];                  if($acceptNum != '') {                 if(ctype_digit($acceptNum)) {                     $result['valid'] = true;                 } else {                     $result['valid'] = false;                     $result['reason'][$name] = 'Please Enter Only Numbers';                 }             }         }     }      Called in the short code like so: `[text* acceptNumber]` but what I want to validate is quite specific and I'm not sure how it'll be achieved. I'll have 1 text field, I want it to contain ONLY one word, anything more than one word won't be accepted, and this one word MUST begin with the letter `s`. I'm not even sure if this is at all achievable, any suggestions would be greatly appreciated!


Using Wordpress public query variables

Good morning. I am trying to query various Wordpress pages, using public query variables, for example               http://dmkim1979.ru/?p=37                   //  single post     http://dmkim1979.ru/?page_id=40             //  single page      But I don't understand how to use most of these variables. And I cannot find complete information about the subject anywhere. The complete list of public query variables is               var $public_query_vars = array(           'm', 'p', 'posts',            'w', 'cat',            'withcomments', 'withoutcomments',            's', 'search', 'exact',                     'sentence', 'calendar', 'page',            'paged',            'more',            'tb', 'pb',            'author', 'order', 'orderby',            'year', 'monthnum', 'day',            'hour','minute', 'second',            'name', 'category_name',            'tag', 'feed',            'author_name', 'static',            'pagename', 'page_id', 'error',            'comments_popup',            'attachment', 'attachment_id',            'subpost', 'subpost_id',            'preview', 'robots',            'taxonomy', 'term', 'cpage',                      'post_type');      and I managed to figure out intuitively the usage of part of them such as                   http://dmkim1979.ru/?p=37                   //  single post         http://dmkim1979.ru/?page_id=40             //  single page         http://dmkim1979.ru/?paged=4                //  page 4 of 10 in archive              http://dmkim1979.ru/?m=201310               //  10-2013 archive         http://dmkim1979.ru/?monthnum=10            //  month 10 archive         http://dmkim1979.ru/?year=2013              //  year archive         http://dmkim1979.ru/?day=12                 //  daily archive (current year and month)              http://dmkim1979.ru/?cat=3                  //  category archive         http://dmkim1979.ru/?tag=tag4               //  tag archive         http://dmkim1979.ru/?rating=rating4         //  custom taxonomy archive         http://dmkim1979.ru/?post_type=tickets      //  custom post type archive         http://dmkim1979.ru/?author=1               //  author archive by id         http://dmkim1979.ru/?author_name=admin      //  author archive by name         http://dmkim1979.ru/?s=uuu                  //  search archive         http://dmkim1979.ru/?error=404              //  page not found         http://dmkim1979.ru/?feed=rss2              //  output feed      but the others remain mysterious, such as               'posts', 'w', 'withcomments', 'withoutcomments', 'search', 'exact',               'sentence', 'calendar', 'page', 'more', 'tb', 'pb',      'order', 'orderby',      'hour','minute', 'second',      'name', 'category_name',            'static',      'pagename',      'comments_popup',      'attachment', 'attachment_id',      'subpost', 'subpost_id',      'preview', 'robots',      'taxonomy', 'term', 'cpage'      can anybody please shed some light on how to use them? (Sorry for my English.)


Customizer - Update colour picker value based on currently selected radio

been scratching my head over this one and think I need a little help basically im trying to change the current value for a colour picker (in this case the body bg) based on the currently selected radio option I have already got the radio working and updating in the live preview, but i want this change to also reflect on a separate colour option Anyone know how to do this? Currently the colour pickers are disabled unless the user selects custom colour on the radio field and think the above would be a lot more elegant thanks, Danny


remove_action conditionally for Custom Post Type

By default, my theme is showing an author box below my posts. I am using a custom post type, and would like to remove this author box only on this post type. Here is how the theme is calling the author box:               add_action( 'wp_head', 'woo_author', 10 );          if ( ! function_exists( 'woo_author' ) ) {     function woo_author () {         // Author box single post page         if ( is_single() && get_option( 'woo_disable_post_author' ) != 'true' ) { add_action( 'woo_post_inside_after', 'woo_author_box', 10 ); }         // Author box author page         if ( is_author() ) { add_action( 'woo_loop_before', 'woo_author_box', 10 ); }     } // End woo_author()     }      Here is the function I have tried to remove the post author box from the `wpseo_locations` single posts, but it is not working:               add_action('init', 'kiwi_remove_post_author_box');           function kiwi_remove_post_author_box () {         if (is_singular('wpseo_locations')  ) {             remove_action( 'woo_post_inside_after', 'woo_author_box', 9 );         }       }      I have also tried:               add_action('init', 'kiwi_remove_post_author_box');           function kiwi_remove_post_author_box () {         if ( 'wpseo_locations' == get_post_type() ) {             remove_action( 'woo_post_inside_after', 'woo_author_box', 9 );         }       }      I cannot seem to get that box to go away. I know that there is a check box in the theme options panel that will make it go away globally, but I want it removed only for this post type. Any help would be greatly appreciated.


Shortcode add styles to the <head>

I have shortcodes that has option for :hover color. Is there a way to include styles in the head of a page for each shortcode element to change its hover color? There can be any amount of this shortcode elements with different options anywhere on site pages. shortcode e.g.               [element color='#666666' hover_color='#111111']element text[/element]


wp_query inside the_loop

I am having this issue with my loops. I am making a shortcode that will be called from the main query. It will display on the front page from the_loop. for some reason that I can't figure out. The second query displays only one post when it should display 3. So the shortcode will go in the page content. In the settings section, I have the front page set as static to "Home" and the blog page set to "Blog" but home is not a template. It is being generated by the index.php page using WordPress 2014 theme. So in the "Home" page content area, I have the shortcode that generates the second loop to get 3 posts from a category called "featured".                $featured = new WP_Query( array( 'category_name' => $category, 'posts_per_page' => 3 ) );        if( $featured->have_posts()) : while( $featured->have_posts()): $featured->the_post();      global $more;      $more = 0;           the_title();           the_content( '' );          endwhile; endif;     wp_reset_postdata();      This loop will display the first of the three posts but not the other two. I also tried using get_posts but that didn't work out any better


Get a list of all Widgets registered in WordPress admin widgets-area

I'm trying to disable a couple standard widgets in my theme `functions.php`. Therefore I wrote this little function, which works well:               function my_widget_ctrl() {          unregister_widget('WP_Widget_Pages');          unregister_widget('WP_Widget_Calendar');          unregister_widget('WP_Widget_Archives');          unregister_widget('WP_Widget_Links');          unregister_widget('WP_Widget_Meta');                  unregister_widget('WP_Widget_Text');                 unregister_widget('WP_Widget_Recent_Posts');          unregister_widget('WP_Widget_Recent_Comments');          unregister_widget('WP_Widget_RSS');          unregister_widget('WP_Widget_Tag_Cloud');                   }      add_action('widgets_init', 'my_widget_ctrl', 11);      Now I want to disable some other Widgets, which may be installed/activated by other Plugins. But I don’t know how to get a list of all widget-class-names registered, so I can unregister them with `unregister_widget()`?


Wordpress main site and sub domain

WordPress site is configured in IIS for which i have updated the permalink structure to be www.testing.com/company, www.testing.com/products, etc... I do have another site which was created in the IIS, but the URL of the site is print.testing.com/printing, but whenever i access this print.testing.com site, WordPress site is getting connected, but not the actual site. does anyone know know to update the permalink structure / the host header so that the site redirects works correctly?


IF Inside A Function For Content Filter

Trying to use a filter for post content. But how do i make an IF work inside the function.               <?php function my_the_content_filter($content) {       } add_filter( 'the_content', 'my_the_content_filter' ); ?>      So i need to add this inside of it.               <?php if (get_post_meta($post->ID, "heading_image", true)) : ?>             <img src="<?php $image_id = get_post_meta($post->ID, "heading_image", true);          $post_image_data = wp_get_attachment_image_src( $image_id, $size='full' );                echo $post_image_data[0]; ?>" style="max-width:1000px;" />          <?php endif; ?>      I cant seem to format it correctly.


Multiple sites/domains on one database

I looked through the questions and answers but could not find a specific answer that matched my question 100%. I have developed many themes/child-themes/plugins/etc for a long time. I know my way around most WP related stuff. But now I'm a bit stuck with a challenge here. What I want to acheive is:   1. Have 2 different domains   2. Both sites share the same theme   3. Both sites share the same posts/news, but some post only appear on the other (categories, perhaps)   4. Both sites share 'some' of the content. 2 sites, same db, different contact details, different logos, all content more or less the same except for like the footer and contact details. How is this done in the easiest way?


how to create child WordPress plugin

I like to create child plugin.. Explanation :- I have one parent plugin named X. This will work independently (like other existing plugins). Now I decided to add some extra features to that plugin X (think of it as an upgrade). So I want to create extra features by way of another plugin Y, which will depend on (and inherit from) X.   This plugin Y will not work with out plugin X. How can I do this?


Find Total Authors

Please suggest a code snippet to get the total number of authors on a blog who have at least one published article. Thanks


I have a self hosted blog but now the WordPress.com stats plugin has stopped working

I've got a self hosted blog and yesterday (18th March) the stats package stopped working. I'm getting the message: > Your WordPress.com account, [account] is not authorized to view the stats of > this blog. where `[account]` is the name of my Wordpress.com account. I deleted and reinstalled the plugins package and got the following message when I entered my API key: > The API key "[apikey]" belongs to the WordPress.com account "[account]". If > you want to use a different account, please enter the correct API key. > > Note: the API key you use determines who will be registered as the "owner" > of this blog in the WordPress.com database. Please choose your key > accordingly. Do not use a temporary key. The recommended action is to "Recover stats" The other choice is to recover the stats of my blog. However, what ever I do results in the same error. If I log into Wordpress.com with [account] I get an error message: > **You are not a member of this site.** This is the only account I have registered with WordPress.com. How do I link my blog back to WordPress.com? I should add that I'm am running WordPress 3.1.


Making oEmbed work on the excerpt field

How can I make oEmbed work on the excerpt field so I only have to paste the youtube url in there and then be able to echo 'get_the_excerpt()'? I also want to filter oEmbed and change the wmode but I think I found a solution for that here: http://code.hyperspatial.com/all-code/wordpress- code/oembed-wmode/ EDIT: Crap! I was wrong, it doesn't work at all, nothing happens. Anyone got a better solution?


How can I update the role of a newly added user when displaying the registration form with a shortcode?

Basically I have a shortcode that includes a registration form(among other things). The custom form itself is also included on `wp-login.php` and `user-new.php` if the default role is set to `my_custom_role`. I want to make sure that when new users subscribe via this custom form, in the case when it is rendered by the shortcode, they have their role set to my custom role regardless of what the `default_role` is set to inside my class the code related to this is: so far I have               _construct() {         global $pagenow;              add_shortcode( 'my-shortcode' , array( &$this, 'my_shortcode' ) );              $custom_is_default_role = get_option('default_role') == 'my_custom_role' ? true:false;              // Include custom registration Form and Components              if ( $custom_is_default_role && $pagenow == 'user-new.php' || $custom_is_default_role && $pagenow == 'wp-login.php' && isset($_REQUEST['action']) && $_REQUEST['action'] == 'register') {           $this->load_registration_components();         } else { // check for shortcode           add_filter('the_posts', array( &$this, 'shortcode_check' ));         }     }          // Check early on if [my-shorcode] is present on the page     public function shortcode_check($posts){         if (empty($posts)) return $posts;         $has_my_shortcode = false;         foreach ($posts as $post) {             if (stripos($post->post_content, '[my-shortcode]') !== false) {                 $has_my_shortcode = true;                 break;             }         }         if ( $has_my_shortcode ) {           $this->load_registration_components();           add_action('user_register' , array(&$this, 'update_custom_role'));              }         return $posts;     }     // Update the user role to my_custom_role     public function update_custom_role($user_id) {         //THIS ACTION NEVER TRIGGERS!         $roles = array( 'my_custom_role' => true );         update_user_meta( $user_id, 'roles', $roles);     }     public function load_registration_components() {         // Registration form         add_action('register_form', array(&$this, 'custom_register_form') );         add_filter('registration_errors', array( &$this, 'custom_registration_errors'), 10, 3);         add_action('user_register', array( &$this, 'custom_save_user_meta')); // YET THIS ONE FIRES FINE!        }     // Render shortcode html for logged out users and my_custom_role users     public function my_shortcode() {         $current_user = wp_get_current_user();         $roles = $current_user->roles;         if ( in_array('my_custom_role', $roles) || $current_user->ID === 0 ) {             add_action( 'wp_footer', array( $this, 'enqueue_styles' ) );             add_action( 'wp_footer', array( $this, 'enqueue_scripts' ) );             ob_start();             include('views/public.php');             $html = ob_get_clean();             return $html;         }     }


Creating tags via API

I'm working on using the WP API to insert posts via AJAX. What's the proper way of adding tags dynamically to a custom post type? These tags would not be predefined, but rather be created on demand by the user. Currently I'm doing this:                           $tags = explode(" ", $_POST['post_tags']);                  $new_entry = array(                 'post_title' => $_POST['post_title'],                 'post_content' => $_POST['post_content'],                 'post_status' => 'publish',                 'post_author' => $current_user->ID,                 'post_type' => 'customposttype',                 'post_tags' => $tags);                  $created = wp_insert_post( $new_entry );      (Yes, this is prototype code and I'm not sanitizing input yet :))


Two-level multisites in WordPress

I'm wondering if there is a way to implement something like sub-multisites, like parent-child multisite relation. So, what i want is a way to have something like this:               /site1     /site1/subsite1     /site1/subsite2     /site2      etc... My approach has been use mod-rewrite to change from /site1-subsite1 to /site1/subsite1 meaning that I'm aware of the permanlinks changes, etc... I will like to know if there is a more cleaner way to achieve this. Thanks in advance.


Current navigation highlight for a menu that may be modified by the user?

I'm using the following to list my pages:               <ul id="nav">        <?php wp_list_pages('title_li='); ?>     </ul>      is there a way of highlight the link of the page of the current in the navigation. It shouldn't be fixed. The user should be able to call the page whatever he or she wants, and create as much pages as he or she wants (the highlight feature should still work). Any suggestions or tutorials?


Remove permalink for custom post type

I have multiple custom post types and custom taxonomies, "staff", "games", which have the permalinks:               domain.com/staff/%staff-name%     domain.com/games/%game-name%      However, I'm only using these custom posts to store data and am displaying it collectively on different pages. How do I get the paths, such as, /staff/%staff-name% to redirect to the 404 page? Thanks!


Add new image size to media uploader so users can insert into post?

I would like to create an additional size for uploaded images which my users can then "insert into post". I understand that add_image_size() will add a new image size which I can use in my theme, but that new size isn't available on the media upload screen. Is there a way to get new sizes to appear on that screen so they're available to people as they add/edit posts? I have a tweaky theme that needs more than just the default 3 sizes + original. Thanks!


Single Wordpress Installation with Sub domains

I have installed buddypress within a wordpress blog. now my client wants to use domain like "forums.ourdomain.com" & "groups.ourdomains.com" to point buddpress forums that are installed within my wordpress blog. is that possible? actually my client dont want to install a new copy of wordpress for these sub domains and want to handle everything through single installation. any one guide me is that possible if yes then how? any help would be appreciated.


How can I make the descriptions in the category pages not become meta descriptions?

I have a category, and all the page descriptions are showing up on the pages, which is what I wanted, but they are also showing up as meta page descriptions. So I am ending up with 2 meta descriptions for every page: these and the ones I made with Yoast. How can I just have the ones made with Yoast be the only meta descriptions on the pages?


Is there any plugin hook that I can latch onto once a site is freshly installed?

To customize a fresh new WP install, there are a bunch of pluginable functions that can be overridden. Namely `wp_install()` and `wp_install_defaults()`. And `wp_new_blog_notification()`. I'd like to override a couple of default options without needing to keep custom versions of the latter in sync with core in my `wp-content/install.php` file. I'm not finding any obvious hook to do so in the `wp-includes/upgrade.php` file, however. Might I be missing anything? * * * Edit: so, the `pre_option_$option_name` is valid for options. Is there another, or some not-too-twisted procedure, that would allow to auto-enable permalinks, including (important) writing to the htaccess file as needed?


How can I store an array of all the terms existing? (for admin use)               $taxonomy = 'MYTAXONOMY';      $tax_terms = get_terms($taxonomy);          foreach ($tax_terms as $tax_term) {                echo  $tax_term->slug ;          }      seems to only work from template files, but I would like to store this array in functions.php for using in a tinyMCE select box.


submit extra content to wordpress post by my editors

i have a site where my authors post articles i want to find a way where other authors can submit a content to the post which already posted every new post , some editors may want to add extra content or comment on the bottom of the article so i need to find a way to do this ***** WITHOUT any needy of editing the post from dashboard ! i need something like a commenting system , but the content which will be submitted will be added to the bottom of the post ! even if it will be a a paid work :P


How to enable http (not just https) in wordpress?

My wp-config.php file contains               define('FORCE_SSL_ADMIN', false);      but all my permalinks are https: by default. ![enter image description here](http://i.stack.imgur.com/1MRdM.png) I want the site to be accessible by http. What do I need to change please?


How to make a cronjob type plugin

Hi i am new on wordpress and has been given a task to make such a script that will fetch posts by categories and shoot email to subscribers. The table structure for subscriber is below               Subscriber Id - primary key     Subscriber email - varchar     Category Id - int      Now the task is to fetch post for last week for each category that exists in above table an send a newsletter to the respective subscribers each monday automatically. I have an idea how to fetch post i will probably do it with get_post() method but i'm not sure how will i do it. Should i made a plugin? If yes, then can a plugin file be run like a cronjob ? Or if there is any other good approach please advice . Thanks Raheel


Plugin that will output submitted form data for user?

I have a standard HTML form that the visitor will fill out. It consists of mostly checkboxes. What I would like, is after the form is submitted, a page is then presented to the user showing what they checked. For example, if the visitor checked off Checkbox A, B, and D (but not C), then upon submission they would see the following:               You submitted:     Checkbox Value A     Checkbox Value B     Checkbox Value D      Obviously I can do this with just PHP, but my client would like to be able to modify the form options. Is there a plugin or user friendly way that this can be created?


Can't edit custom post type

I'm using the following code to create two custom post types: Pastebin Link The Spotlight custom post type is giving me the edit/permalink to edit the post. However, the cooking video isn't. I've just copied the code from the Spotlights, changed the pertinent info for Cooking Videos so I don't get why it isn't working.


Is WP feature image function cropping images? WP Content Slideshow

I am using WP Content Slideshow. I like the plugin, but am having an issue with it. I mailed the creator, but no response, so I am trying to troubleshoot what is causing the problem. You can see the issue on the homepage of elyconnect.com. The plugin uses the featured image for the image in the slideshow. I set the resolution for each image size correctly, but the images are "cropping" and I dont know why. I'm open to suggestions, or a recommendation for a better plugin if one exists.


Limit blogs creation

someone knows how to limit the number of blogs creation in a wordpress multisite? (3.6.1). In the wordpress plugins repository there is this plugin, but It doesn't work, I think it's not up to date. Any suggestion would be appreciated, thank you very much.


dynamically add scripts to WP_Widget widget() method

I have a wordpress widget that has the standard outline like:               class my_widget extends WP_Widget{          function my_widget(){        //do setup stuff     }          function form(){        //do form stuff     }          function update(){        //do update stuff     }          function widget($args, $instance){        //how can we dynamically add style and script here             //this does not work        if($instance['val'] == 'test'){           wp_register_script('test', plugins_url('test.js');           wp_print_scripts('test');        }else{           wp_register_script('diff', plugins_url('diff.js');           wp_print_scripts('diff');        }     }      } I am wondering if it's possible to somehow add scripts dynamically to a wordpress widget... I am guessing that this would have to take place within the widget() method b/c that is the only place where dynamic variables are passed, but the problem is this function appears to be fired after scripts are added. thanks for your thoughts


Pull images from the gallery

I am building a template where wordpress is being used primarily as an image CMS, I am pulling the first image from the content section of each post.               <img src="<?php echo grab_image() ?>" />          function grab_image() {     global $post, $posts;     $first_img = '';     ob_start();     ob_end_clean();     $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);     $first_img = $matches [1] [0];          if(empty($first_img)){     $first_img = "";     }     return $first_img;     }      My question is how can I, instead of grabbing it from post_content, grab the first image from the uploaded image gallery? So, the process to add an image would be to upload and then exit out (without inserting into post). I dont know what you call this or what to look for.. attachments? media library? The content area would be used strictly for text along with any extra meta boxes.


Delete Custom Dashboard Widgets

Here is the code on how to delete all dashboard widgets - the default, and plugin widgets but I want to change the code to only delete custom dashboard widgets not the default ones. * * *               // Create the function to use in the action hook     function remove_dashboard_widgets() {         global $wp_meta_boxes;         if ( !array( $wp_meta_boxes ) ) return;         foreach ( $wp_meta_boxes as $widget_section => $widget_locations ) {             if ( $widget_section == 'dashboard' ) {                 foreach ( $widget_locations as $widget_location => $widget_types ) {                     foreach ( $widget_types as $widget_type => $widgets ) {                         foreach ( $widgets as $widget_name => $widget ) {                             remove_meta_box( $widget_name, $widget_section, $widget_location );                         }                                    }                 }             }         }     }      // Hook into the 'wp_dashboard_setup' action to register our function     add_action('wp_dashboard_setup', 'remove_dashboard_widgets', 11 );


Create Short code dynamically

I want to generate short code for my gallery dynamically. For a single gallery, it is easy to create a short code for my gallery using               add_shortcode( 'image-gallery', 'gallery' )      Now my question is how can i create multiple short code for multiple gallery? Like for gallery 1 short code will be image-gallery-1, for 2 code will be image-gallery-2. I've tried this way               $all_gallery = $wpdb->prefix . 'gallery';     $all=$wpdb->get_results("select * from $all_gallery");     if(count($all)>0){        foreach ($all as $a){           add_shortcode( 'image-gallery-'.$a->id, 'gallery' );        }     }      Its working nicely but when i deactivate the plugin and then activate the plugin again, a fatal error occurred and plugin is unable to activate.


Wp-admin Custom User Management

I am working on a plugin for which I will have to develop a backend page similar to the built-in "Users" one, in the sense that it will be basically do the same things: list the existing users ( using the `WP_List_Table` class ), edit / remove, and add new ones as well. The only difference is that it will have a couple of additional fields, as well as some other custom functionality. My question is: should I be working with the already existing WP functions for handling users: `wp_insert_user`, `wp_update_user`, `wp_remove_user` or is it recommended to make direct calls to the database? Although this may be a little more complicated, I was wondering if it's the way recommended / only way to go.


Create pagination in the items list of specified custom taxonomy term

I've created list of custom taxonomy term and have problem with pagination. Custom post type "gallery" has his own custom taxonomy "gallery_category". The next loop lists all items of chosen Gallery category:                       /* Some info:              * http://wordpress.stackexchange.com/questions/13888/retrieve-single-term-slug              * http://codex.wordpress.org/Function_Reference/WP_Query#Taxonomy_Parameters              */             $term_slug = get_queried_object()->slug;             if ( !$term_slug )                 return;                 else             $args = array(                 'tax_query' => array(                     array(                         'post_type' => 'gallery',                         'taxonomy' => 'gallery_category',                         'field' => 'slug',                         'terms' => $term_slug                     )                 ),                  'posts_per_page' => 3,                 'paged' => get_query_var( 'paged' )             );             $loop = new WP_Query( $args );                 while ( $loop->have_posts() ) : $loop->the_post(); ?>                      <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'poznaj-wilno' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>

                         <?php if ( has_post_thumbnail() ) : ?>                             <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'poznaj-wilno' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_post_thumbnail( 'gallery-thumbnail' ); ?>                         <?php endif; ?>

                              <?php endwhile; // End the loop. Whew.     /*Using WP-PageNavi plugin.      * Call based on - http://scribu.net/wordpress/wp-pagenavi/wpn-2-74.html     */ ?>
     <?php         if ( function_exists('wp_pagenavi') )      wp_pagenavi( array( 'query' => $loop ) );      ?>
          I'm using WP PageNavi plugin to create pagination and I'm facing the problem with "`get_queried_object()`" function. It takes term name from the link: `http://domain.ltd/gallery/categories/term- slug`. When I click on next page, link changes to: `../gallery/categories/term- slug/page/2`. Because link slug has been changed I'm getting an error. Maybe you have any ideas how could i solve this problem? Thanks.


How to solve Woocommerce Memory Limit

I have Woocommerce set up to run on WP multi-site with my PHP Memory Limit set to 256M in the php.ini I also have in my wp-congif.php               define("WP_MEMORY_LIMIT", 128);      However Woocommerce shows the following "WP Memory Limit: 12 B - We recommend setting memory to at least 64MB." How can I solve this


WP query exclude post within the last month / only show over 1 month old

I need to create a landing page which only shows posts that are at least a month old. Everything I've read / tried with the date query so far seems aimed at including posts between the last month and now rather than excluding.. effectively I'm looking to exclude posts between todays date and today-1month. Any pointers appreciated.


Illigal string offset after moving website

After moving my website to another host, I'm getting a few errors in my wordpress theme. > Warning: Illegal string offset 'navbar' in /home/mydomain/public_html/wp- > content/themes/karmag/subheader.php on line 42 > > Warning: Illegal string offset 'topbar' in /home/lifecx/public_html/wp- > content/themes/karmag/subheader.php on line 48                   <!-- top bar -->         <div id="navigationtop" class="tour_2 tour_2a">                   <?php $disable_sidebar = of_get_option('disable_footer', '' );              if( $disable_sidebar['topbar']==0 ) { ?>                      <?php get_template_part( 'includes/template-parts/topbar' ); ?>                  <?php } ?>      > Warning: Illegal string offset 'topmenu' in /home/mydomain/public_html/wp- > content/themes/karmag/includes/template-parts/topbar.php on line 51                               <?php if ( ! dynamic_sidebar( 'main-menu' ) ) : ?>                         <?php wp_nav_menu(array('theme_location' => 'main-menu','container'=>'','menu_class'=>'sf-menu','fallback_cb'=>'kt_main_menu')); ?>                     <?php endif; ?>                       <?php } ?>      Does anyone know a simple fix for this. Many thanks!


Using wordpress translations strings in plugin

right now I'm building a helper plugin to make it easier for me to do simple tasks, such as registering post types. When doing this, i'd like to use some of wordpress base translations. Wordpress has the string 'Add New', which is translated in to other languages. Now, is it possible for me, to utilise the base translation, or will i have to re-translate 'Add New' for all of my post types?. Does wordpress have a text domain, in the same way plugins do. like __('Add New', 'wordpress'). I tried just adding __('Add New'), but that doesn't work either. Worst comes to worst, ill just have to retranslate it - just seems silly, if i could rely on normal wordpress-strings. Thanks!


URLs to user page is broken

My domain is http://mongage.com I don't know what happened to my site. the user URL linking to author/user page is broken. I switched to a new theme, but no success. I am using thentythirteen and the following code:               <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">      in my functions.php, I am rewriting the user/author page URL with the following code:               function change_author_permalinks() {     global $wp_rewrite;     $wp_rewrite->author_base = 'membres';     $wp_rewrite->author_structure = '/' . $wp_rewrite->author_base. '/%author%/';     }      add_action('init','change_author_permalinks');      but when I mouse over an author/user name I get "http://domain.com/members//" where it simply get cut off before the author/user name. I manually type the rest in the URL, but get a 404 deleting the custom author/user URL or switching to a new theme did not fix it either. would appreciate if anyone can put me in the right direction. Actually I started from scratch twice no success. It was perfectly working fine before. By the way, I have customize the comments system to work as a petition signup allowing only 1 comment/signup per user. I have also moved my comment form to the sidebar.


Autodelete posts that have word in title on cerain category

I want to know if there is a way or plugin that autodeletes posts that a certain word in their title. Even better if that is done only to a cerain category I have one site that has autoblog on .. and thats the problem... some posts dont work like i want.. so i want them to get autodeleted ! those posts got the word video on them ! so i want a filter or a plugin or somethin that deletes every post (even better if i can do it only on specific category) that has the word video on it's title ! :)


404 page is not querying my custom post

I have a 404 template page which is, obviously, designed for Not Found Pages. Within the code, I have the `get_header();` where I place the global code for the site. There is a `div` that contains a style atribute that is set with a `wp_query`! The goal is uploading an image in order to be the background, along with a color. Here it is:               <div style="     <?php       $args = array(         'post_type' => 'general_settings'       );       $the_query = new WP_Query( $args );       if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post();         echo "background:url(";         echo the_field('set_background'); //GET THE BACKGROUND POSTED         echo ") ";         echo the_field('set_color'); //GET THE BG COLOR       endwhile; endif;     ?>     no-repeat top center;">      The background that I upload appears for all pages, except for the 404 Page. Is there something that 404 make blocks the management content of `WP_query`?? Thank you!


How to create a link for wordpress meta datas?

I would like to create a link for "Leave a comment", which name "quick comment" (here come a ajax comment form on div).   How can I do this?   I have attached a picture where I'd like to put this link:   ![enter image description here](http://i.stack.imgur.com/HBJVi.jpg) The function for this:               if( ! function_exists( 'cyberchimps_posted_in' ) ) {        //add meta entry category to single post, archive and blog list if set in options      function cyberchimps_posted_in() {     global $post;          if( is_single() ) {         $show = ( cyberchimps_get_option( 'single_post_byline_categories', 1 ) ) ? cyberchimps_get_option( 'single_post_byline_categories', 1 ) : false;      }     elseif( is_archive() ) {         $show = ( cyberchimps_get_option( 'archive_post_byline_categories', 1 ) ) ? cyberchimps_get_option( 'archive_post_byline_categories', 1 ) : false;       }     else {         $show = ( cyberchimps_get_option( 'post_byline_categories', 1 ) ) ? cyberchimps_get_option( 'post_byline_categories', 1 ) : false;       }     if( $show ):                 $categories_list = get_the_category_list( ', ' );                 if ( $categories_list ) :                 $cats = sprintf( __( 'Ebben a kategóriában:', 'cyberchimps_core' ) . ' %1$s', $categories_list );             ?>                              <?php echo apply_filters( 'cyberchimps_post_categories', $cats ); ?>                     <?php echo apply_filters( 'cyberchimps_entry_meta_sep', '|' ); ?>     <?php endif;     endif;        }       }             if( ! function_exists( 'cyberchimps_post_tags' ) ) {         //add meta entry tags to single post, archive and blog list if set in options          function cyberchimps_post_tags() {     global $post;          if( is_single() ) {         $show = ( cyberchimps_get_option( 'single_post_byline_tags', 1 ) ) ? cyberchimps_get_option( 'single_post_byline_tags', 1 ) : false;      }     elseif( is_archive() ) {         $show = ( cyberchimps_get_option( 'archive_post_byline_tags', 1 ) ) ? cyberchimps_get_option( 'archive_post_byline_tags', 1 ) : false;       }     else {         $show = ( cyberchimps_get_option( 'post_byline_tags', 1 ) ) ? cyberchimps_get_option( 'post_byline_tags', 1 ) : false;       }     if( $show ):     $tags_list = get_the_tag_list( '', ', ' );                 if ( $tags_list ) :                 $tags = sprintf( __( 'Tags:', 'cyberchimps_core' ) . ' %1$s', $tags_list );             ?>                              <?php echo apply_filters( 'cyberchimps_post_tags', $tags ); ?>                     <?php echo apply_filters( 'cyberchimps_entry_meta_sep', '|' ); ?>              <?php endif; // End if $tags_list     endif;       }       }          if( ! function_exists( 'cyberchimps_post_comments' ) ) {       //add meta entry comments to single post, archive and blog list if set in options     function cyberchimps_post_comments() {     global $post;          if( is_single() ) {         $show = ( cyberchimps_get_option( 'single_post_byline_comments', 1 ) ) ?    cyberchimps_get_option( 'single_post_byline_comments', 1 ) : false;      }     elseif( is_archive() ) {         $show = ( cyberchimps_get_option( 'archive_post_byline_comments', 1 ) ) ? cyberchimps_get_option( 'archive_post_byline_comments', 1 ) : false;       }     else {         $show = ( cyberchimps_get_option( 'post_byline_comments', 1 ) ) ? cyberchimps_get_option( 'post_byline_comments', 1 ) : false;       }     $leave_comment = ( is_single() || is_page() ) ? '' : __( 'Szólj hozzá', 'cyberchimps_core' );     if( $show ):         if ( ! post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) : ?>             <?php comments_popup_link( $leave_comment, __( '1 hozzászólás', 'cyberchimps_core' ), '% ' . __( 'hozzászólás', 'cyberchimps_core' ) ); ?>        <?php echo ( $leave_comment != '' ) ? apply_filters( 'cyberchimps_entry_meta_sep', '|' ) : ''; ?>     <?php endif;     endif;        }      }          // change default comments labels and form         add_filter( 'comment_form_defaults', 'cyberchimps_comment_form_filter' );         function cyberchimps_comment_form_filter( $defaults ) {     $defaults['title_reply'] = __( 'Szólj hozzá!', 'cyberchimps_core' );     return $defaults;         }


How to open modal window when clicking a WP menu link?

I'm making my first site with WP, I'm a Joomla Developper. I'm using wisten theme, and WP 3.9.2 I want to create a link in my the navigation that opens a modal window (not a new page) on click. Example - http://kendo.mx , when you click the LOGIN link I have no clue of how I should do this in WordPress. The Jquery code for such an operation is not very difficult, the code is here :               http://jsfiddle.net/mmetsalu/hBX6E/2/      but I have no clue of how to integrate it. Any help would be appreciated


Is Post Type Necessary for Taxonomy Archive

Symptom: The following code will only work if I include the post type. Is this a correct behavior? Note:The data being called is a Custom Post Type.               <?php     $term=get_term_by( 'slug', get_query_var('term'), get_query_var('taxonomy')); // Capture the slug and hence get the taxonomy      $parent=get_term($term->parent, get_query_var('taxonomy'));     $the_tax=get_taxonomy($term->taxonomy);     $sectionargs=array(                     'post_type'=> 'bookpage',                       'meta_key' => 'Sort Number',                     'orderby'  => 'meta_value',                     'order'    => 'ASC'                               );     query_posts($sectionargs);?>
     <?php if (have_posts()): while (have_posts()): the_post();?>
<a href="<?php the_permalink(); ?>" ><?php the_title(); ?>
     <?php endwhile;?>
              <?php else: ?>
<?php _e('Sorry, no posts matched your criteria.');?>
     <?php endif; ?>      The template is called with a url of the form /taxonomy/term. I'm assuming therefore that any type of post assigned to the term in question should be found by the URL. However, if I omit the 'post type' then nothing is found suggesting perhaps that either the code needs to have the post type defined or it defaults to post_type=post. As far as I can tell the standard category archive template doesn't specify the post type. Does anyone know if the post type should be required? Thanks


Using Backbone with the WordPress AJAX API

I'm attempting to build out a simple TODO plugin using Backbone and have run into an issue with the AJAX API. In order to get the correct AJAX call back you have to pass in the "action" parameter like this: admin-ajax.php?action=get_todos which works fine for the GET method in Backbone. However, when using DELETE Backbone will use a URL like this by default: admin-ajax.php?action=get_todos/9 where "9" is the ID of the todo being deleted. By adding on this ID it breaks the AJAX call on the WordPress side. I can manually override the URLs for each of the methods but I'd like to know if there's a more elegant way to get the AJAX API to work with Backbone. I've created a demo plugin which shows the specific issue I've run in to. Load the settings page and click on any of the X's while watching your Network inspector to see the 0 value AJAX results coming from WordPress. https://github.com/hereswhatidid/wordpress-todo-backbone-demo


Modify Text Widget using wp_editor()

I try to add Editor to Text Widget by using wp_editor() But i get a javascript error switchEditors is not defined. Could you let me know the javascript file need to load               wp_enqueue_media();      wp_editor('content', 'text-id');


Widget to add an different image to sidebar (by category)

I want to add custom content (maybe using a widget) on my website's sidebar that changes by category. For example, if a user lands on the 'Cars' category, I want to show an image related to cars. In the same location, I want a Car to show if the user lands in the 'Cats' category. What would be the best way to go about this? I know that there is a custom sidebar plugin, but I really don't need a different sidebar for every category, I just need to add a section to the current sidebar that changes by category. Thank you in advance for your help!


Show all sub categories?

Is it possible to show all child/sub categories of all parent cats? I have the following hierarchy: Parent Cat/Tax   \-- Sub 1   \-- Sub 2   Parent Cat/Tax 2   \-- Sub 1   \-- Sub 2   I would like to be able to show all the child categories on one template without the parent showing as well. Is that possible?


Change places custom fields with title field in post wp-admin

Is it possible to make custom fields at the top, when writing a new post in admin panel ? Thank you.


Get post terms with hierarchical relationships

I'm having a hard time getting a set of selected terms in a custom taxonomy presented in a specific way. I have a hierarchical taxonomy 'places' and a post with the tagged terms:               England (x)       - London (x)          - Venue1 (x)     France (x)       - Paris (x)          - Venue2     Germany       - Berlin (x)          - Venue3 (x)      I need to print out:               myPostTitle : Venue1 (London - England)                   Paris (France)                   Venue3 (Berlin)      My problem is, that I can't find a function that will return the tagged terms, in a manner that reflects the hierarchical relationships. I need to be able to determine:   * Which terms are the actual 'venues' (the 'lowest' tagged child in each of the hierarchies)   * What parents and grandparents of those 'last children' to include. I'm outside the loop, and would prefer not to run setup_postdata(). I have the post ID.


Custom Shortcode and Button not Working after 3.9 update

I have added a new button that creates a short code but it seems that after the newest WordPress update, the button is not working any more. The button is visible but when someone clicks it, nothing happens. The code I used is the following- **js part**               (function() {     tinymce.create('tinymce.plugins.affiliate', {         init : function(ed, url) {             ed.addButton('affiliate', {                 title : 'Add Affiliate Link',                 cmd : 'Affiliate link',                 image : url+'/euro.png',                 onclick : function() {                      ed.selection.setContent('[aff afftitle="" afflink=""]' + ed.selection.getContent() + '[/aff]');                      }             });         },         createControl : function(n, cm) {             return null;         },     });     tinymce.PluginManager.add('affiliate', tinymce.plugins.affiliate);     })();      Ι also have written code for the PHP Part, but I am not sure if the problem is there.I thing that the problem is in the JavaScript above. Ι know that createControl doesn't exist any more. I am trying to get around this issue but with no luck at this time.


WooCommerce: Change default country on the cart page

I'd like to change the default country on the **cart** page to _none_ , i.e. to have "Select a country…" appear as the default in the drop-down list of countries. I've looked at this WooCommerce Docs snippet which uses the `default_checkout_country` **filter** but it only seems to apply to the **checkout** page (and not the **cart** page), as its title says. I also tested this by surrounding the `apply_filters('default_checkout_country', ...` in the files where they appear with `echo` statements and they don't appear anywhere in the generated markup for the **cart** page. As we are using PayPal Express Checkout we don't use the WooCommerce built-in checkout page so it appears that the above mentioned snippet doesn't apply and another solution is needed. My next step was to look into `woocommerce/templates/cart/shipping- calculator.php` where the country option list is generated on the **cart** page. There's a call to `$woocommerce->customer->get_shipping_country()`. That function in `woocommerce/classes/class-wc-customer.php` simply picks up the `$_SESSION['customer']['shipping_country']` variables. The only place those variables are set is in the function `set_shipping_to_base()` in the same file and the only place that function is (conditionally) called is in `woocommerce/shortcodes/shortcode-cart.php` which I assume generates the **cart** from the **shortcode** used on the autogenerated **cart** page. I added a `echo` statement to the block in that file where that function is called but nothing appeared in the markup, so I got stuck there. The above investigation seems however to be somewhat of a red herring as the above mentioned session variables seem to actually be set by the **Base Country/Region** setting on the General tab, as it would vary accordingly when the `$_SESSION` variable got printed in a browser where cookies and cache had been previously deleted. So I'm kind of stuck here too. I'd like the **Base Country/Region** setting to remain the country set, but still have no default country unless the visitor actually has selected it. Any ideas?


Blogroll/Lins Menu not visible in my backend?

well, i'm confused. I can't seem to find out why my "Links" Menu doesn't show up in my wordpress admin. I have this in my `functions.php` file …               add_action( 'admin_menu', 'remove_links_menu' );          function remove_links_menu() {         remove_menu_page('themes.php'); // Appearance         remove_menu_page('tools.php'); // Tools         //remove_menu_page('link-manager.php'); // Links         //remove_menu_page('edit-comments.php'); // Comments     }      However it clearly says, that `link-manager.php` is not removed. If comment- out the entire action the `themes` and `tools` Menus are showing back up. However the link-manager is never visible. Any ideas?


List custom field values in alphabetical order without repetition from the current category?

I have this code:               global $wpdb;     $query = "SELECT DISTINCT meta_value                       FROM $wpdb->postmeta                       WHERE meta_key = 'product_brand'                       ORDER BY meta_value;";     $directors = $wpdb->get_results( $query );       foreach( $directors as $director ) :         echo $director->meta_value . ', ';     endforeach;      This code will show all meta values having the `meta_key` "product_brand". On category pages, what I want to do is list all unique meta values having the `meta_key` "product_brand" from the current category.


Custom Posts In Pages

I am new to Wordpress.Sorry for asking such easy question I have a view page in which I want to show pictures in Grid so I have created Custom Post In Wordpress Name **Pictures.** there are pages name called **Celebrities** **Models** etc the problem is I don't know how to display pictures on specific pages. For example I want to do something like this   1. Add a new picture from custom post    2. select Page on which I want to display The problem is there is no selection. So how can I assign or show different posts to different pages.


Admin-ajax.php appending a status code to ajax response

I'm writing a plugin that uses Ajax (jQuery with form plugin) via a form submission and the php function returns a JSON response.               add_action( 'wp_ajax_bubbly-upload', 'bubbly_upload_submit' );          function bubbly_upload_submit() {         // generate the response         $response = json_encode( array( 'success' => true ) );              // response output         header( "Content-Type: application/json" );         echo $response;     }      In Firefox, none of the jQuery response handlers were firing and the save file dialog was opening with the JSON response. I wouldn't have the issue if I returned HTML. However, in either case, a '0' was appended on to the end of my response. After some digging, it looks like jQuery will not trigger a handler if the JSON reponse is invalid. This '0' being added onto the end is causing the JSON to be invalid. If I look into the `admin-ajax.php` code, I see this:               default :         do_action( 'wp_ajax_' . $_POST['action'] );         die('0');         break;     endswitch;      The php docs for die say that if the parameter passed is a string, then it will be printed just before exiting, if it is an integer, it will not be printed. Without hacking the core, is there a way I can avoid this issue and still use JSON? Also, is this a bug, because I don't see how adding a zero to the end of every AJAX response would be desired...


Displaying custom profile fields using Mingle Plugin

I am using the Mingle plugin to add some networking functionality for a website I am creating for a client. I am having Mingle handle displaying user profiles and friends, but WordPress to actually register users and put in fields. Mingle has the ability to add custom fields (ex: Twitter, Facebook, etc). However, there is no way to display these custom fields individually. So, I have added my own custom fields to WordPress using the `functions.php` file:               function add_new_contactmethods( $methods ) {         $methods['twitter'] = 'Twitter';         return $methods;     }     add_filter( 'user_contactmethods','add_new_contactmethods' );      I am displaying them **within one of the Mingle templates** (`mingle/classes/views/mngl-profiles/profile.php`):               <?php if ( get_the_author_meta( 'twitter' ) ) { ?>         <a href="http://twitter.com/<?php the_author_meta( 'twitter' ); ?>" title="Follow @<?php the_author_meta( 'twitter' ); ?> on Twitter">

                     <img src="<?php echo THEME_DIR; ?>/images/icons/twitter.png" alt="Twitter" class="socialIcon" />

                     @<?php the_author_meta( 'twitter' ); ?>

              <?php } ?>      Now whenever I go to a profile page that is generated by _Mingle_ , (`http://example.com/admin` or `http://example.com/dylan`), whoever is currently logged in at the moment will have _their_ custom fields shown, not to the user whose profile is being shown. Does that make sense? I can provide more code or elaborate if need be. I would really, really appreciate any and all help I can receive on this, the project is really time-sensitive.


Is it possible to pull comments from facebook into your blog?

I have a client who wants to be able to share his latest blog posts on Facebook (no problem there) but then he wants the comments made on his Facebook page to that share shown on his blog as part of the comments on the blog post. I have been digging around and while I can find ways to let users comment on your blog using Facebook's api (http://developers.facebook.com/blog/post/198) I can find nothing that pulls comments from Facebook to display on your site. The closest I could come is this http://wordpress.org/extend/plugins/facebook- comments/ which according to its developer is broken and can only be fixed by 'screen scraping' Facebook which, of course, is against Facebooks TOS. Does anyone know if there is a working plugin, or a relatively simple method to get this done?


The issue of redirecting my site to a new domain

I have encountered some problems after I have redirected my site, which is in a sub directory in my server, to a new domain. I have kept the same server. The origin URL of my wp site `http://www.example.com/mywpblog`, has been redirected to another new domain `http://www.example.com`. Please help me solve the following :   1. The original title of my WordPress page disappeared. My new domain name is the title which appeared in the title bar. I couldn't find it to edit while the origin is still there in the `header.php`. > Q: How can I return my new title?   2. Meta links don't work properly. For example, I try to open the "register" link (`http://example.com/mywpblog/wp-login.php?action=register`) and get a page with the following message: "the content cannot be displayed".  > Q: I assume there is some conflict with links so may be I should to edit > these links on the `sidebar.php`?   3. My post page's real link doesn't appear when I open I a post, just the `http://newexample.com` which keeps appearing in the address bar. I can't see the complete permalink.


Get the 'slug' of a custom taxonomy

Use case: I have a custom post type of 'show' for a music venue. In the sidebar we want to display any related 'show' to the current one on single-show.php. They will be related by a custom taxonomy of 'genre'. I figured I could dump the custom taxonomy slugs for a post (might be more than one) into a variable then pass that variable into a custom query for the sidebar post. Using get_the_term_list() works if there is a single taxonomy but if there are multiple it breaks (of course). Any thoughts on how to get an array of the custom taxonomy slugs for a give post into a variable?


Add wordpress menus to magento website

How to add wordrpess menus to magento website? I have installed Magento WordPress Integration, author jamesckemp. By using this plugin, i did magento menus to display it in wordpress website. Please give me any suggestions or solutions regarding this.


Display all categories including sub categories

I am trying to display a list of all categories and sub-categories underneath that category, I have managed to get a list of all categories that are parents but am struggling to detect if it has children and then display them in the current loop. Here is my code at the moment:               $args = array(       'orderby' => 'name',       'parent' => 0       );     $categories = get_categories( $args );     foreach ( $categories as $category ) {              echo 'term_id ) . '">' . $category->name . '
';          }      I have found a few functions on here about detecting if the category has children, but am struggling to actually display the children (up to one level) under this link. Any help is greatly appreciated, Simon


wp_get_attachment_image_src returns incorrect URL on multisite

I'm not sure how much code to post because I don't think too much is relevant. I'm just dumping the contents of `wp_get_attachment_image_src` and the contents turn out to be incorrect on multisite.               $id = 1290; // tested with a random ID outside my loop     echo '<pre>';print_r(wp_get_attachment_image_src ( $id, 'thumbnail' )); echo'</pre>';      The result shows the first index of the array (the src URL) to be: `http://localhost/test1/wp-content/uploads/sites/0/2013/03/front-150x150.png` Visiting this URL results in a 500 error on my setup, because the real URL is : `http://localhost/test1/wp-content/uploads/sites/10/2013/03/front-150x150.png` Why would WordPress drop a number (in case you missed it the leading **1** from the first number after `/sites/` from the image's URL when returning it via `wp_get_attachment_image_src` ? Similarly echoing `wp_get_attachment_image()` also shows a broken image (with the same incorrect source URL). **.HTACCESS**               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]     RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]     RewriteRule . index.php [L]     </IfModule>          # END WordPress


How can I make internal anchor links work with WordPress's permalinks?

I've got a custom template page called `'shop'`, which is found at the URL `http://mysite.com/shop/`. This page lays out all the posts of post_type `'product'` like this:

Product name
`       <p>A description of the product.</p>       </div>`      On another page, I've got a link like this:               Buy this product!      I want that link to go to the `/shop` page, then scroll down to position the page right at the anchor link for this product. But it seems like WordPress' _'pretty permalinks'_ redirection is getting in the way: as soon as it switches to the `/shop#product-name` page, the URL gets rewritten to `/shop/` and the browser leaves the page scrolled at the top. My `.htaccess` file is exactly what WordPress generated: it looks like this:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>     # END WordPress      Any help in getting these anchor links to work properly would be much appreciated. _( **Moderator Note:** Title was originally "My permalinks setup doesn't like anchor links to another page.")_


Once redirected by Rewrite rules, how can WordPress know the page?

I have been searching for some configurations of .htaccess, filters and hooks to make able to manage the inner site uri's. The goal was force login, register and admin pages through SSL, and all the other pages through HTTP. Although it can be easy when you have the same domain for both, http and https, it could be quite difficult when the domain is different, and even the PATH different (for example: HTTP on mydomain.com/blog, and HTTPS on mydomain.sslserver.com). Neither this question (Use a different domain for SSL) nor the HTTPS PlugIn, helped to reach this goal with success. For this reason I began making my own customization taking advantage of some other information. The problem is I am very new with WordPress code, and trying to find out how the redirection works, I am stuck without understanding the inner WordPress redirection. Then, **my question:** If the RewriteRule does not pass the PATH of the permalink (for example, a path to a post or a category), and only is rewriting to /index.php, how can this file 'knows' which is the queried post or category? I supposed that in some part of the code it would need use the $_SERVER["REQUEST_URI"] or the $_SERVER['REQUEST_URI'] or the $_SERVER['ORIG_PATH_INFO'] somewhere, since it works without converting the permalink's PATH to a QueryString, and without sending any POST or GET data. Please, I have been seeking for some tutorial telling what is going on and did not find any thing with a clear and plane explanation. Maybe there are too many pages of close information related and the Searcher do not show me the correct page, maybe I am not searching correctly, but I really need to know how it works. Thanks!


Help with this custom field conditional if no field is set display nothing

I'm using the code below to display an image if the swap_select custom field value is true. If it's no it displays nothing. However when posts are first created no custom field exists. So what would the conditional be to account for no custom field at all and in that case display noithing?               <?php      $swap_value = get_post_meta($post->ID, 'swap_select', true);     // check if the custom field has a value     if($swap_value!= 'no') {       echo '<img class="" src="thumbs/speechbubble_pink.png"/>';     }     else{     }     ?>


Doubts about how to migrate WordPress from local to online server using Search and Replace Tool script

I am trying to migrate my blog from my local web server to an online web server and I have a doubt about this procedure. I have uploaded all my local file in the root of my web server. I have also export the tables of my local database (using phpMyAdmin) and I have import them on my online database. Then I have change the settings inside the file **wp-config.php** in such a way as to make the connection with the online database. Now I have to change the URL settings on my database using the **Search and Replace Tool** script: http://interconnectit.com/products/search-and-replace- for-wordpress-databases/ So my doubts related to the use of the search and replace script are: 1) Have I to put the **searchreplacedb2.php** file into the root of my webserver (where it is the wp-config.php file) and have I to execute this script? 2) Have I to scann ALL the tables or only the posts table? Tnx Andrea


Convert uploaded PNG to JPEG automatically

Is there a way to convert automatically uploaded PNGs to JPEGs and keep the original? In other words, let the user upload a PNG, but show in wordpress (thumbnails, large, medium, etc) the JPEG version and only show the original uploaded PNG when Wordpress request the full image.


Including post data in a sidebar occurring outside of and before the Loop

I'm having problems setting up a single WordPress template page to display post data outside of the Loop. The page has a left sidebar in which I want to display post meta data, tags and navigation links to previous and next posts, followed by a main column with the post title and content:                             <title>Lorem ipsum</title>

The post on this page is a <?php if (in_category('apples')) { ?> apples blog post.  <?php } else { ?> pears blog post. <?php }; ?>.  You can browse the Archives to find more articles of this type.

Previous

<?php previous_post_link('%link'); ?>

Next

<?php next_post_link('%link'); ?>

             <article id="post-<?php the_ID(); ?>" class="post" role="main">
<time datetime="2009-09-04"><?php the_time('F jS, Y') ?></time>

                         <?php the_title(); ?>
                                  <?php the_content(); ?>

                 <?php comments_template( '', true ); ?>

            The way I'm trying to solve the issue is by running a separate loop in the sidebar (sidebar-single.php), rewinding and then running it again in the contents section (single.php). Unfortunately, while the data from the first loop is diplaying correctly in the sidebar, the loop doesn't rewind for some reason and as a result the content for the next post displays in the content part of the page. See an example here. Any ideas as to how the non-rewinding issue in this setup can be fixed, or alternatively how the objective can be attained by other means?


IIRF + IIS 6 + Wordpress does not return 404 error

I use IIRF for Wordpress redirects in IIS6, but does not return "Page not found" (404), always redirect to home directory for all missing files. Permalink Structure:               /%postname%.html      IIRF rewrite:               RewriteRule /(.*)$ /index.php/$1 [I,L]


Call to undefined function get_user_meta() - trying to access data in MySQL from custom fields

I am trying to access data from some custom fileds in my MySQL db so that I can add them to a webpage that will be printed out. The data is held in a column called "paypal_user" and I need to access one piece of data and print that along with the user id of the user. I've had a little help with the code but I am stuck as I am getting the following error: Call to undefined function get_user_meta() My code is below. Thanks in advance for any help.               <?php     include_once('wp-config.php');     include_once('wp-load.php');     include_once('wp-includes/wp-db.php');     ?>          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">               <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />     <title>Untitled Document</title>

          <?php           if ( is_user_logged_in() ) {          global $user_ID;          // Get the 'paypal_user' info for the user. Just fetch a single     // value, not an array.     $paypal_user = get_user_meta($user_ID, 'paypal_user', true);     $exp_date = $paypal_user->expire_date;     ?>
<?php echo '$user_ID' ?>

PR34 2PL

<?php echo '$exp_date' ?>

     <?php } ?>


Get Custom post with ID

How do I get a custom post by its ID? I want to display a single post from custom post using its ID. I tried `'post_type' => 'homepage', 'post_id' => '717'` but it didnt work. Thanks


definining own teaser text for post

i'd like to have a small news box in my sidebar - so i need to display just a few lines of text, separated from the actual the_content() - how could i do that? it should be somekind of quicktag which will be hidden in the full post content. thanks


Page/2 posts don't load and give 404

I load 10 posts on my home.php and I have the 'posts_nav_link()' function to acces to latest entries. But when I click on the previous entries, the link redirect me to mysite.com/page/2 and give me a 404 error. Could you help me please Thanks ?               <?php if (have_posts()) :                      query_posts(                             array(                                 'post_type' => array(                                     'etude',                                     'new'                                 )                             )                         );?>                               <?php while (have_posts()) :                         the_post(); ?>

                             <h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>

<?php the_time('d F Y'); ?> dans <a href="<?php echo site_url(get_post_type());?>"><?php echo get_post_type(); ?> // <?php comments_popup_link(__('No Comments »', woothemes), __('1 Comment »',woothemes), __('% Comments »',woothemes)); ?>
                              <?php the_content(__('Continue Reading',woothemes)) ?>

                          <?php endwhile; ?>

<?php posts_nav_link() ?>


permalinks issue and archives

I have an issue with a site running on WP 3.3 where when we make the permalink anything by "/%post_id%/%postname%/", the archive pages break and become 404s. After some research, I came to understand why from a performance perspective, this is not a good practice, so I tried the suggested alternatives: "/%year%/%postname%/" and "/%post_id%/%postname%/" Both suggestions worked, except that only with the post_id one, did archive urls become "/date/2012/11/" for example, and were found. Under any other permalink suggestion, they just were "/2012/11/" for example, and produced 404s. Now the question is why does WP only put the word "date" in when the permalink is "/%post_id%/%postname%/"? I figure it works with the "date" parts because it matches to "/date/%year%/%month%/". As note, category and tag urls came out as usual and worked: example "/category/news" and "/tag/advice/".


Exclude category

I want to exclude a category from showing in a function, but cannot figure out how to do it for my specific code as below. I want to make it so that any post that is in the "featured" category, does not display - but all other posts do.               $args = array( 'posts_per_page' => 4, 'category_name' => 'featured');                       $last_5_posts_query = new WP_Query( $args );     while($last_5_posts_query->have_posts()) :       I just cannot figure out where or how to add the exclude operator, which i assume is by adding a - somewhere. Thanks.


how to set beforsend option in wordpress ajax methods

How do I set the `beforesend` option in WordPress AJAX? I want to show loading option. This is my code:               function showmyvideos() {          var datas="data";         var data = {             action: 'my_vids',             link: datas           };          ajaxurl= "http://localhost/wordpress/wp-admin/admin-ajax.php";         jQuery.post(ajaxurl, data,function(response) {              });          }


wordpress as law draft discussion site

I need to build a site to openly discuss the draft of legal law. Every person interested in the law will can leave a comment for each article. Comments should be upvoted and downvoted. Also, every person should be able to sign off the support of the draft. Any ideas which plugins can help me? thanks a lot for your answers !


Remove iPhone detection on login page

I have a wordpress site with a customized login page, the problem is when I go to that page on my iPhone, it detects it as an iPhone and adds the viewport meta tag, which normally would be great but this particular login page I want to be viewed full sized and zoomable, not iPhone sized and non-zoomable. So I need to remove the iPhone detection from the login page without modifying the wordpress core. Anybody have any ideas?


How can I create a legend (Key) like the one in the footer on WordPress StackExchange

Ironically, Wordpress StackExchange has the perfect example of what I'm trying to do. At the foot of every page here is a key/legend of associated sites with a colour reference for each one. I need to create an identical looking key of my posts showing the project names and project colours for each project in my portfolio site. The project names and colour references are already in custom fields within my custom post type. However obviously a query will just return all the results. I've been looking at GROUPBY but not been able to get it to work, anyone got a better idea or can tell me where I'm going wrong? Sigh, I can't seem to get an answer to this from Wordpress support or StackOverFlow, it can't be that difficult surely.


How to remove Gravatar from Username column

How to remove the **Gravatar** image from **Username column** in the **All User** admin page? ![enter image description here](http://i.stack.imgur.com/WPCl1.jpg)


Reference external file as a function

In my functions.php I have the following code:               add_action( 'admin_menu', 'jp_create_admin_pages' );          function jp_create_admin_pages()     {         add_menu_page(             'Members',             'Members',             'manage_options',             'members',             'admin-members.php');     }      In the same folder, I have another file called admin-members.php with the following code:               Hello Admin World!      However, I am getting a PHP error saying that this is an invalid callback (it works when I replace the 'admin-members.php' parameter with the name of a function in functions.php). How can I reference an external file as a callback so that this will work?


Different fields in My Profile page depending on user role

So I understand that I can user current_user_can to check the role of the current logged in user. But what I would like to do is show these different fields to the site Admin. So for example the contributor role may have different custom fields than the subscriber. Each role would see their relative fields but the Admin would see a whole list of all fields in a contributor profile page and subscriber profile page. Is there a way to allow the admin to only see certain fields of a user profile page? I hope this makes sense to you out there! Thanks in advance.


Why does the page/post ID keep growing when i refresh the post-new.php file?

I created a custom post type and for debugging reasons i display the Post ID on the Add New ... page. If i refresh the page without saving or even creating a new post,(so i just press f5 on the post-new.php) the post ID is growing one by one. Why is this happening and is this the normal behaviour?


Sort Custom Post Type Archive by Taxonomy Term

What is the best method (as of 3.1 or 3.2 beta) to sort a custom post type archive by a given taxonomy term? I'm trying to make a staff page and I want to sort employees by department. So the taxonomy would be `staff` and the terms to sort would be `sales` and `support`. I tried `query_posts` and `WP_Query` but perhaps I messed up the arg array...


Excluding Pages not working

I was trying to set up a few pages the other day that would hold an authors information (only to be accessed from the author snippet at the bottom of posts), and obviously these pages are showing up in the `<?php wp_list_pages('title_li='); ?>` , I made sure of my page order (0-5 are the pages that must be there, and I set up the special pages to start with an id of 44 just in case they added some pages), and then tried `<?php wp_list_pages('title_li=&exclude=44'); ?>`. However, 0-5 show up, as well as 44. Any thoughts on why this is still occurring?


How to hide <pre> and <table> content from auto-generated excerpts?

Auto-generated excerpts just take the first x characters from the post content and cut that off at a certain point. When there is a `table` or `pre` element in that part, the excerpt looks rather useless most of the time. How can I hide the content of these elements from my auto-excerpts?


plugin links not working

I'm developing a plugin with the latest version of WordPress (3.4.2) locally (XAMPP 1.7.7 [PHP: 5.3.8]) and for some reason the links are not working within the plugin. I just have a simple delete link that links to a 'delete- gallery.php' file from within the plugin admin page. This file (delete- gallery.php) only calls a function to delete the record from the database and redirects back to the page that called it (the plugin admin page). Simple enough. But, when the link is clicked I get directed to XAMPP root (localhost:8080/xampp) and not the requested destination (delete-gallery.php) for some reason.               $url = plugins_url('includes/delete-gallery.php', _FILE_);     echo 'Delete';      I know the hrefs' path is correct on the link because it shows up in the status bar on hover, but for some reason it's not locating the file locally on submission. If I set the destination to somewhere external (ie. google.com, etc) it works fine, but not locally within wordpress. The permalink structure has been updated and the .htaccess file is currently as so:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>     # END WordPress      If I use a blank .htaccess file I don't get redirected to the XAMPP root, but instead get the 404 error 'Object not found! The requested URL was not found on this server. ...' when the link is clicked. Is there something that needs to be set in .htaccess to allow redirecting locally within wordpress? I'm at a loss here. Any suggestions would be greatly appreciated.


Is it possible to create Custom Post plug-in?

I understand that Wordpress allows you to create Custom Post Types with Custom Fields, but is it possible to create a custom Plug-In that creates and maintains its own Custom Post type (outside of Wordpress's Custom Posts)? So for example, if you had a Wordpress site that had a the Custom Post Type "Event", along with Custom Fields like "Event Host", "Location", "Start Date", "End Date", "Entry Fee", etc. The idea is that a custom Plug-In would allow finer control to view and sort selected records from the database. So for example, a user could ask to only see events by a certain Event Host, or that has an Entry Fee between certain thresholds. Also, if the End Date had passed (i.e. the event had finished), then all search results would not display that Event any more. I understand that most of this may be possible using Custom Post Types and Custom Fields using Wordpress, but I believe a lot of it is fiddly, limiting and slow. Being able to write the database schema and SQL statements would presumably give us a lot more power. Does Wordpress allows such levels of customisation through plug-ins?


Single sign on for multiple domains

I want to connect two sites which are not on the same domain and allow uses to be logged in to both, by logging in to only one site. I found a huge number of topics and plugins but most of them deal with the subdomains of one parent domain (site1.domain.com and site2.domain.com) which is not what I want. Both sites will be on the same server, so accessing the database from either of them won't be a problem. I am thinking of the custom plugin which will do the following: When a user is logged to one site, generate a hash, store in DB, redirect to the other domain/sso with an ID and if the IDs match, login there as well and redirect back to the first site. This way I will avoid all browser troubles with cross domain cookies and iframes/other hacks. From security point of view, all hashes will expire in 1 minute so automatic (brute force) check of IDs will be impossible. I can even mix it with an IP address and cookie/session to make it more secure. **My questions are:**   1. What is the best approach for this? Is there an existing solution for what I am trying to do?   2. Is there a plugin I should use? Thanks!


Change path/url of admin-bar.min.css

Does anyone know where admin-bar.min.css is registeded/included? Im trying to add a slash in front of admin-bar.min.css, so the admin bar will work correctly on all pages. Im playing arround with a wordpress site with dynamicaly generated urls, and right now the admin bar is the last thing I need to fix, only I cant find it. All help is much apriciated :)


Transfered live site to new server and images are not showing

i just recently transfered a new site to a server. All paths are correct when I debug the site but for some reason the uploads front and back do not show either in the media section or the site pages. In the media area I get the thumbnails and file names but they do not show up. It is almost like it knows they are there but it does not want to show them. I have set all permissions to 777 in uploads and still no joy at all. Does anyone know what this could be? Cheers, Mark


Paginate wp_query while utilizing post__not_in

I'm currently running a wp_query like this:               <?php                  $the_query = new WP_Query( array(                     'post_type' => 'photos',                     'posts_per_page' => '2',                     'post__not_in' => array(3),                     'paged' => $paged                     )                 );             ?>             <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>               <?php the_title(); ?>             <?php endwhile; ?>      I then have some pagination at the bottom as such:               <?php next_posts_link(); ?>     <?php previous_posts_link(); ?>      Say I have 11 posts that the query would return but one of them has the id of '3'. This means that I have 10 total posts and should return a number of 'next' links. For whatever reason at the end of those pages, there will be a 'next' link that links to a page that is blank. I believe this empty page is the post I'm attempting to exclude with 'post__not_in'. How can I exclude posts from my wp_query and still have accurate pagination?


Placing video content into a sidebar

I'm trying to figure out how to place video from a post (category video) into a sidebar. I can get other content content images and text to show, I'm guessing it has something to do with post format? If I lable the post formet as video then there must be a call for it. so far I have:               <?php     $args = array( 'numberposts' => 4, 'order'=> 'DESC', 'orderby' => 'post_date', 'category' => 5, 'post_type' =>  'post' );      $postslist = get_posts( $args );         foreach ($postslist as $post) :  setup_postdata($post); ?>
<?php the_post_thumbnail( 'sidebar_thumbnail' ); ?>

<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
           <?php endforeach; ?>
          <?php dynamic_sidebar( 'sidebar1' ); ?>          <?php else : ?>...      but insead of the thumbnail image link to the post I'd rather have the video from the post. Thanks


How to access .html file that's located in the theme folder from the browser?

By default you cannot access a file inside the theme folder directly from the browser, what changes should I make to make an exception?