Wordpress Super Admin menu not enabled

Hi I am trying to create a social network using buddypress.I found a book that has detail instructions on how to create a number of wordpress sites : wordpress blueprints Just to be clear I have wordpress installed on localhost in e-commerce folder.The first stept that I done was to add this code in wp-config.php:               <?php     define('WP_ALLOW_MULTISITE', true);     ?>      This enabled the instalation menu.After I clicked install I was asked to create a folder in wp-content named blogs.dir. I was give this code to put in wp-config.php:               define('MULTISITE', true);     define('SUBDOMAIN_INSTALL', false);     $base = '/e-commerce/';     define('DOMAIN_CURRENT_SITE', 'localhost');     define('PATH_CURRENT_SITE', '/e-commerce/');     define('SITE_ID_CURRENT_SITE', 1);     define('BLOG_ID_CURRENT_SITE', 1);      and this code to put in wordpress .htaccess file and replace what is there:                 RewriteEngine On     RewriteBase /e-commerce/     RewriteRule ^index\.php$ - [L]          # uploaded files     RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [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).*) $1 [L]     RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]     RewriteRule . index.php [L]      Next I was asked to relog and after relog a Super Admin menu should have appeared in the dashboard but the menu is not appearing for me. What is the problem and how can I conrect it?


How can i show only 30% of the "the_content("More...")"?

I'm trying to make a page that has all the posts in it and shows 30% or less of the content of the post. So I'm editing a page template and I can't figure out how to show only 30% of the content. I'm new to this so please don't spam me with "go google it you noob" , stuff like that. Thank you in advance and have a nice day!


How to correctly move jquery script to external file

I have a jQuery floating navbar plugin that works fine when all the code is inserted in the head. However the ammount of code in the head became unmanageable so I put the code in the root directory in a file called sscroll.js. I have tried to include the file the following ways but they don't work. (No errors are coming up on firebug) `<?php wp_enqueue_script('sscroll', 'sscroll.js', array('jquery')); ?>`               <script type="text/javascript" src="sscroll.js"></script>     <script>     $('#sidecontainer').stickyfloat({duration: 400 });     </script>      >               <script type="text/javascript" src="sscroll.js">$('#sidecontainer').stickyfloat({duration: 400 });</script>      >               <script type="text/javascript" src="sscroll.js"></script>      I prefer using the enqueue script, but I'll be happy with anything that works. Any suggestions welcome. Thanks!!!


custom field as a boolean with a checkbox?

I have installed the more fields plugin which gives me access to a custom field checkbox. When setting the field up through the plugin the caption says: Creates single checkbox, which key is either on/off. As you can see by the query I am looking for all the events whose event-archive = on. Is there a better way to do this? This doesn't return any posts anyways. Is there a better way to build a boolean field?               $archive_query = new WP_Query(             array(                'post_type'  => 'event',        // only query events               'meta_key'    => 'event-archive',  // load up the event_date meta               'order'       => 'desc',         // ascending, so earlier events first               'posts_per_page' => '5',               'meta_query'  => array(                  array(         // restrict posts based on meta values                   'key'     => 'event-archive',  // which meta to query                   'value'   => 'on',  // value for comparison                   'compare' => '=',          // method of comparison                   'type'    => 'CHAR'         // datatype, we don't want to compare the string values                  ) // meta_query is an array of query ites                 ) // end meta_query array               ) // end array             ); // close WP_Query constructor call


Conflict between wp_list_pages and get_posts - list pages not displaying

This has only been a problem since I updated to Wordpress 3.1 I have a page that displays a list of custom post types. The page is the child of a parent page. There is a sidebar that lists sibling pages. The code for the two is conflicting somehow, and I can't get the list of pages to show up. This is the code to display the list of custom post type (in my case 'sponsor'):               <?php     $args = array( 'numberposts' => 30, 'post_type' => 'sponsor' );     $sponsors = get_posts( $args );     foreach ($sponsors as $post) :  setup_postdata($post);      ?>

<?php the_title(); ?>
     <?php the_content(); ?>
          <?php endforeach; ?>      This is the code in my sidebar to list the sibling pages:               <?php         if (!$post->post_parent) {             $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');         } else {             $p = end(get_post_ancestors($post->page));             $children = wp_list_pages('title_li=&child_of='.$p.'&echo=0');         }     ?>     <?php         if ($children) {             $parent_title = end(get_post_ancestors($post));     ?>
         <?php echo $children; ?>     <?php } ?>
      Nothing is showing up in the sidebar. I tried deleting the code for the posts, and the list of pages showed up correctly. But something about the "get_posts" is not letting the "list_pages" work. Anyone know what alternate code I can use?


The new WordPress 3.1 "Admin Menu" isn't appearing on my site or in the Dashboard

WordPress 3.1 added the Admin Bar feature, similar to the one used in WordPress.com websites, which appears on both the website and Dashboard for logged in users (if enabled in your User settings). I've updated to WP 3.1 and enabled both settings for the admin bar ("when viewing site" and "in dashboard"), as well as clearing all caches (through W3 Total Cache) and my browser cache. Any ideas on why I'm still not seeing the admin bar? I am using a custom theme, but I don't see how that would affect the Dashboard admin bar.


making urls clickable for wordpress custom post type field?

Here is the code I'm using to add a custom field to a post type I have set up. As you can see it creates an input box which allows me to add whatever I want. I want to put urls in this box (without the "http://", e.g. "example.com") and have them be automatically clickable. Is there a way?               add_action("admin_init", "add_friends_fields");          function add_friends_fields(){         add_meta_box("artist_links", "Links", "artist_links", "friends", "normal", "low");     }          function artist_links(){         global $post;         $custom = get_post_custom($post->ID);         $artist_links = $custom["artist_links"][0];         ?>         Links:

         <input size="50" name="artist_links" value="<?php echo $artist_links; ?>" />         <?php     }      -edit-

Artists
             <?php                 $i=1;                      $temp = $wp_query;                 $wp_query = null;                 $wp_query = new WP_Query();                 $wp_query->query('post_type=friends&posts_per_page=-1');                      while ( $wp_query->have_posts() ) : $wp_query->the_post();                      $custom = get_post_custom($post->ID);                 $artist_links = $custom["artist_links"][0];                 $artist_bio = $custom["artist_bio"][0];             ?>                  <article class="mgm-artist<?php if($i%6 == 0) { echo ' right'; }; $i++; ?>" id="post-<?php the_ID(); ?>">                 <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'video-thumb' ); } ?>

Name: <?php the_title(); ?>

Bio: <?=$artist_bio?>

Link(s): <?=$artist_links?>

                  <?php                 endwhile;                  $wp_query = null;                 $wp_query = $temp;                 wp_reset_query();             ?>


Does plugin's uninstall.php file have access to the plugin 's object?

I read on the codex that the best way to implement a clean uninstallation functionality to a plugin is by adding a uninstall.php file inside your plugin directory. I'm wondering: can i use my plugin's Class instance data inside the uninstall.php file? This is the code sitting in my uninstall.php file:               if(!defined('WP_UNINSTALL_PLUGIN')) exit;     delete_option('my_plugin_options');     $table_name = $wpdb->prefix . $this->dbName;     $wpdb->query("DROP TABLE `$table_name`");      I'm wondering if the table_name variable will be properly retrieved, or if i should hardcode it. As per my tests, the table remains after deletion, so i guess i'l fallback to using a hook inside my plugin's file, unless i'm missing something?


Permalink Structure for Multiple Post Type Archives by Taxonomy

Recently I have been working on an advanced WordPress project, and I'm stuck with changing permalink structure for custom post types. I have created 3 post types lets say: _type1, type2, type3_ and a taxonomy _test_ registered for all of them. I have 3 terms in the custom taxonomy _cat1, cat2 ,cat3_ Here's what I want to achieve: instead of accessing all posts from cat by > siteurl/test/cat1 I want to access each post-type archives by taxonomy cat like: > siteurl/type1/cat1


Ordering Submenu Pages in WP 3.1

I just recently upgraded to WordPress 3.1 a few moments ago. However, I noticed that when you have Post Types show up under a *main* menu page, it overrides the link fo th menu link. ![](http://i.stack.imgur.com/Kms5A.png) Here's my `register_post_type` arguments for "Visitor" post type.                   $v_args = array(             'labels' => array (                     'name' => 'Visitors',                     'singular_name' => 'Visitor',                     'add_new_item' => 'Register New Visitor', // TODO: http://codex.wordpress.org/Function_Reference/register_post_type#Arguments                 ),             'public' => true,             'publicly_queryable' => false,             'exclude_from_search' => true,             'show_ui' => true,             'show_in_menu' => 'argus',             //'show_in_menu' => false,             'hiearchical' => false,             'supports' => array( '' ),             'capabilities' => $visitor_caps,             'register_meta_box_cb' => array ( &$this, '_wp_visitor_meta_box_cb' ),         );              // http://codex.wordpress.org/Function_Reference/register_post_type         register_post_type( $post_type, $v_args );      Here is the call to `add_menu_page` that adds the link to the admin menu.               public function _wp_admin_menu( )     {         add_menu_page( 'Argus', 'Argus Admin', 'argus', 'argus', array( &$this, '_wp_argus_main_panel' ), '', -1 );         add_submenu_page( 'argus', 'Argus Administration', 'Main Menu', 'argus', 'argus', array( &$this, '_wp_argus_main_panel' ) );                 // save having to register 'admin_menu' action across every sub-plugin         // There is no 'admin_menu' function/method in any class stored in $classes         foreach( self::$classes as $class => $obj )         {             if ( method_exists( $obj, 'admin_menu' ) )             {                 $obj->admin_menu();             }         }     }      **Please note:** The call to `add_submenu_page` was added after the fact and doesn't change the behavior or output one bit. I added this to re-add the default link that 3.0.4 added by default under the link header generated by `add_menu_page`.


Good RSS Feed Parser to use on php file?

Was trying to use EmbedRSS Plugin but the php code that I used to put it into my index.php file doesn't work.                [cetsEmbedRSS id='http://deannaschneider.wordpress.com' itemcount='2' itemauthor='1' itemdate='1' itemcontent='1']      convert into php:                <?php echo do_shortcode ('[cetsEmbedRSS id='http://deannaschneider.wordpress.com' itemcount='2' itemauthor='1' itemdate='1' itemcontent='1']'); ?>      I switched to Wordpress's built in rss and used the following code:                <?php include_once(ABSPATH . WPINC . '/rss.php');      wp_rss('http://www.ssupremacy.com/bbs/rss.php?fid=3', 10); ?>      When I replace "3" with "4", the feed shows but it doesn't show in fid=3. And I want more to show then just a list of links. I want an excerpt of the forum post, date, author, etc. Any ideas?


Shared upload folder in wordpress multisite

I have a wordpress multisite, where I would like all the images uploaded through the main site (mysite.com) to be accessible to `sub1.mysite.com` and `sub2.mysite.com`. All the images should be in one folder without subdirectory (e.g: `wp-content/uploads/image.jpg`). I tried the bellow function, but my images for subdomains are uploaded to `wp-content/uploads/sites/#blog_id/`               function wpse_16722_upload_dir( $args ) {         $newdir = '/';              $args['path']    = str_replace( $args['subdir'], '', $args['path'] ); //remove default subdir         $args['url']     = str_replace( $args['subdir'], '', $args['url'] );               $args['subdir']  = $newdir;         $args['path']   .= $newdir;          $args['url']    .= $newdir;               return $args;     }     add_filter( 'upload_dir', 'wpse_16722_upload_dir' );


recent comments filter by author, page, category

is there any way to display recent comments in a widget area   * only for **one page**? = Comments that are belongs to one page.   * comments of **one category** but not from admin ( or some other user ) I want to have two widget on my home page   * 10 last comments for one page   * 10 last comments for one category except my own comments


Post belonging to many categories

I have a post that belongs to two categories (Drinks, Food). The post appears on category pages under `/category/drinks` and `/category/food` When I click on the post under category archive `/category/drinks` it takes me to a post page that's in `/food/` Is there any way to solve this in a way that the post stays in the same category?


add class to internal links in content

i want to add a class to all links inside of the_content, that point to other interal content, f.ex. other posts and pages. i want to do this automatically. dunno if the best practise would be, to look for content or try to hook into the tinymce editor.. and eather way around, i don't know how.. this is what i have:               text      and i want it to be               text


Pagination for categories with a different amount of posts on first page not appearing on 2nd page

I wish to show a different number of posts (4) on the first page of a category page, while showing a different number of posts on the following pages (16 posts on each). I have an extra condition for the first page to have only 4 posts instead of 16, that there must be a page with the same name (this is not relevant for the problem but just to explain what is happening in the code below). I am doing it similar to as it is explained in the question here where I have the following two functions. (Other answers seem to work similarly too so I should be in the right track I hope).               function paginate_categories( $query )      {          // not an admin page and it is the main query     if (!is_admin() && $query->is_main_query())     {         if (is_category())         {             if (get_page_by_title(get_queried_object()->cat_name) != null)                 $startpage_total = 4; // show 4 posts on start page if there is content (i.e. there is a page with the same title)             else                 $startpage_total = 16;                  $pages_total = 16; // show 16 posts on all other pages                  if(!is_paged()) {                 $query->set('posts_per_page', $startpage_total);             } else {                 // a paginated page                 $query->set('posts_per_page', $pages_total);                 $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;                 $offset = $startpage_total +($pages_total*($paged-2));                 $query->set('offset', $offset );             }         }       }     }     add_action( 'pre_get_posts', 'paginate_categories' );          function itsme_adjust_category_offset_pagination( $found_posts, $query ) {         $ppp = get_option( 'posts_per_page' );         if ($query->is_main_query() && is_category() &&  (get_page_by_title(get_queried_object()->cat_name) != null))         {             $first_page_ppp = 4;                  if( !is_paged() ) {                 return( $found_posts );             } else {                 return( $found_posts - ($first_page_ppp - $ppp) );             }         }     }     add_filter( 'found_posts', 'itsme_adjust_category_offset_pagination', 10, 2 );      My paginator code that I am including in my category template looks like this:               <?php         global $wp_query;              $big = 999999999; // need an unlikely integer         $add_args = False;         $search_query = get_query_var('s');         if (isset($search_query) && (trim($search_query) != ""))         {             $add_args = array('s' => $search_query);         }              $args = array(             'base' =>  str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),             'format'       => '/page/%#%',             'total'        => $wp_query->max_num_pages,             'current'      => max( 1, get_query_var('paged') ),             'show_all'     => False,             'end_size'     => 1,             'mid_size'     => 2,             'prev_next'    => True,             'prev_text'    => __(' '),             'next_text'    => __(' '),             'type'         => 'list',             'add_args'     => $add_args,             'add_fragment' => '',             'before_page_number' => '',             'after_page_number' => ''         ); ?>              <div id="paginate">             <?php echo paginate_links( $args ); ?>         </div> <!-- #paginate -->      I have 8 posts at the moment under my category and the first page is correctly displaying 4 posts with the paginator displaying 2 pages, with a link to go to the next page. However, when I go to the next page, the paginator doesn't display at all. I dont get the same page links so that I can go back to the previous page. The reason for this is that `$wp_query->max_num_pages` is set to 1 (because 8 < 12). Is there something I am still missing to get this working correctly?


Wordpress rewrite my URL when i use pagination

I've just created a rewrite rules to integrate pagination in my page music (displaying custom post_type "music") in order to : 1. displaying a specific page from a long musical playlist. 2. in this page, playing a specified track Here is the rule for pagination : `add_rewrite_rule('music/page/([0-9])+/([^/]+)/?', 'index.php?pagename=music&paged=$matches[1]&trackid=$matches[2]', "top");` But now when I enter : http://carbonpaper- dev.imperatorium.org/music/page/2/track-2442 Wordpress rewrite my link with a repetition of /page/2/ : http://carbonpaper- dev.imperatorium.org/music/page/2/track-2442/page/2/ I search a solution to keep the first URL. I try get_rewrite_permalink() function but it's not ok.. Any suggestions ? beR- The blog is in test phase so sorry for inconveniences...


Add custom fields within meta box class "on the fly"

I'm one of the contributors for the Meta Box Class here on Github (link) and before I get too deep, I wanted to ask if anyone knew of a straight forward way to allow users to add additional fields "on the fly", having an "add" button with a text field to add additional fields (i.e. list items). I've seen this done a few ways in the past, but I'm all for not reinventing the wheel.


Second Level Menu

I'm trying to figure out how to do, Second Level Menu as a template function, that persistent when visiting any level, whether its a top level page, or a grand children Page. Any Ideas?


Storing meta fields multiple times OR once with multi dimensional array?

I got some options that I expand using a repeater type field. The values I save for each field is already an array so in essence I'm saving a multi dimentional array per option. (See this weekly trading hours picker http://foxinni.com/screens/trading_hours-20120828-162304.png) **My question is this** : Is it better to store the meta values in one meta field as a double serialized value, or is it better to split them into one dimentional values but storing as multiple custom fields with the same name in the db? _Reason I ask is becuase it's easier to manage just one custom field, and as I've come to find, having duplicate meta field ID's as a bit of a pain to manage. Checking the old value to verify the correct field is cumbersome imo.._


Front-end update_post_meta snippet displays white screen?

Thanks to @Anu's correction I now have a function to update_post_meta from the front end. Something is wrong in my script however, because with the function below nothing is being displayed on the page. It only displays is a white screen. if I take out the `if ( empty($_POST) ||` section the page template will display, but any changes I make to the form are not saving. What am I missing?               // top of page     if ( empty($_POST) || !wp_verify_nonce($_POST['name_of_nonce_field'],'name_of_my_action') )         { //if fail nonce check, exit script            exit;         }     else :         {         global $post;         $postid = $post->ID;         $data = $_POST['priceone'];         update_post_meta($postid,'metakey',$data);         }     endif;          // in single.php     $priceone = get_post_meta($post->ID, 'priceone', true);     <form method="post" action="">        <?php wp_nonce_field('update_drw_postmeta','drw_inventory'); ?>        <label>This is label</label>        <input type='text' name='priceone' value='<?php echo $priceone ?>' />        <input type='submit' value='save' />     </form>


I'm looking for a plugin to execute a specific task a certain time

I'm looking for a plugin capable of execute a task (in my case, switch the sticky attibutte of certains) in a specific hour (for example 22:00 hrs), Anyone knows a plugin with those capabilities? Thanks in advance


Shortcode attribute "title" doesn't appear in $atts array

In a post, I have this text:               [bhours shortcode="test" title="test"]      But the "title" attribute appears to be ignored. Here's a var_dump of the $atts attribute array               array(1) {       ["shortcode"]=>       string(4) "test"     }      Here's the PHP code:               function bhour_shortcode_handler($atts){         global $post,$bhourdays;              $output='';              echo var_dump($atts);              if(isset($atts['shortcode']) && !empty($atts['shortcode'])){                       if(isset($atts['title']) && empty($atts['title'])){                 $output.='';             }             elseif(isset($atts['title']) && !empty($atts['title'])){                 $output.='
'.$atts['title'].'
';             }             else{                 //get title from post                        }              }                   $output.='
this is a test
';              return $output;     }          add_shortcode('bhours', 'bhour_shortcode_handler');      Is the "title" attribute some sort of reserved word?


Wordpress get embedded/attachment video

I’m looking a way to get embedded video in PHP from WordPress post on a single.php page. I’ve implemented a slider that pulls post attachment images and would like to do the same for video. As the media upload limit in WordPress and practicality of uploading video to CMS are leading me away from using similar method, I need to find a way to get embedded videos. get_embedded_video() is now depreciated and I cannot find anything else that can replace it. I tried get_attached_media() despite embedded is not clearly attached, and it didn’t work. Any solution to this problem?


How to add field above password section in profile page

I managed to create new custom fields in the profile page. However, the new fields are located below the Password section. My new fields is more about the user personal details, which should located below/above Biographical Info section. But this new field always display below to the password section, this will be very odd for users to read. I found a post talking manipulating the DOM by javascript here. But the codes somehow didn't work for me, I don't know why. So, I would like to find an alternative way. Please advise. Thanks


Access Tables with number prefix

I have multiple sites setup within my site. I need to access all the various options tables which are named 'wp_#_options'. How can I select these tables that have a number prefix? Using `$wpdb->get_results($wpdb->prepare("SELECT * FROM ".$wpdb->7_options." WHERE ....."));` gives me a parse error.


How to make my plugin able to be updated from admin panel?

Most of the Wordpress Plugins are able to be updated from admin panel. You go to `Admin Panel > Plugins > Installed Plugins >` and if you have an outdated(old plugin) that has a new version, you can click Update to download the new plugin. How to add this to my plugin? Is this made with the:               Plugin URI: http://mysite.com/wp/plugin      If yes, than how to set up that folder? Should i name every new version in zip files in that folder? Or how to tell the version of plugin to wordpress?


Wordpress pagination /page/2 part added at the end of url

The pagination works, but not the default URL of the 'next' button. It ads the `/page/2/` part at the end of my url where a `$_GET` is stored. Is there a way I can move the `/page/2/` part to the end of my url before the `$_GET` section? This is how it is right now:               http://websitename.com/custom-post-type/?merken-selection=fiat#038;transmissie-selection=0&fuel-selection=0&addition-selection=0/page/2/      But it needs to become the following:               http://websitename.com/custom-post-type/page/2/?merken-selection=fiat#038;transmissie-selection=0&fuel-selection=0&addition-selection=0/      This is my query:               $paged = 1;     if ( get_query_var('paged') ) $paged = get_query_var('paged');     if ( get_query_var('page') ) $paged = get_query_var('page');          $taxedQueryArgs = array(         'post_type' => 'lease_fop',         'paged' => $paged,         'tax_query' => array(             'relation' => 'AND',             array(                 'taxonomy' => 'merk',                 'field' => 'slug',                 'terms' => $merk,                 'operator' => 'AND'             ),             array(                 'taxonomy' => 'transmissie',                 'field' => 'slug',                 'terms' => $transmissieSoort,                 'operator' => 'AND'             )         )     );          query_posts( $taxedQueryArgs );     ...      This is the wordpress function I use for the pagination:               /**      * Paginate for custom post types      *      */          function paginate() {         global $wp_query, $wp_rewrite;         $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1;         $pagination = array(             'base' => @add_query_arg('page','%#%'),             'format' => '',             'total' => $wp_query->max_num_pages,             'current' => $current,             'show_all' => true,             'type' => 'plain'         );         // if ( $wp_rewrite->using_permalinks() ) $pagination['base'] = user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link( 1 ) ) ) . 'pagina/%#%/', 'paged' );         // if ( !empty($wp_query->query_vars['s']) ) $pagination['add_args'] = array( 's' => get_query_var( 's' ) );         echo paginate_links( $pagination );     }      When I comment out the last two rules, as you can see in the snippet above, it works. The url is then: `http://websitename.com/custom-post-type/2/?merken- selection=fiat...` without the fancy 'page' part in between, as the function would suggest.


Is it possible in WordPress

I am trying to create a ranking based on user donation, my problem is I am not sure if wordpress user meta support append For each Project a user can donate money via paypal In **WordPress User Meta** I am not sure how if is possible to append and integrate 2 column field for each donation amount and project made 1st field is a dropdown field(containing the projects) = second field(amount) The project list will be handled by a custom post type with a custom field of amount and if the user donated to that page it will be credited to the current user and update the project and amount field. in other words, i would like to append a user meta in the admin via the front end, i know its possible appending via backend but how about if the data is coming from the front end any security or limitation?               $user_id = get_current_user($id);     $project = $product_name;     $amount = $project_amount     If ($project != $product_name) {      **add_user_meta( $user_id, '$project', ??);**     **add_user_meta( $user_id, '$amount', ??);**     }     else     {      **add_user_meta( $user_id, '$project', ??);**      **add_user_meta( $user_id, '$amount', ??);**     }      the problem now is the how would I add the project and amount data at the same column or append another row if the project is not identical


Paginate_links links not working accordingly to how I do query the page

Ok, I've a custom post type page to which I have attached the paginate_links function to navigate through the elements. If I don't do anything and let WP using whatever mechanism is attached to the archive page, then the paginate_links work fine but the previous link never goes back to the page one. Changing manually the links works fine. On the contrary, if I do something like the answer suggested here, overriding the wp_query object, the paginate_links move to the second page but the "current" remains set always on page 1. CODE               $current = get_query_var('page') ? get_query_var('page') : 1; // Get query var     $record_per_page = 2; // How many faqs to display on each page     $offset = ( $current - 1 ) * $record_per_page;              $args = array(             'post_type'         => 'faqs',             'orderby'           => 'date',             'order'             => 'desc',             'page'              => $current,             'offset'            => $offset,             'posts_per_page'    => $record_per_page,         );               $the_query = new WP_Query( $args );         $temp_query = $wp_query;         $wp_query = NULL;         $wp_query = $the_query;              $row                = 1;         $total              = ceil(wp_count_posts('faqs')->publish / $record_per_page);              while ( have_posts() ) : the_post();             echo get_the_ID();           endwhile;              // Reset postdata         wp_reset_postdata();              if ( $total > 1) {                  $paginate_links = paginate_links( array(                 //'base'      => @add_query_arg( 'page', '%#%' ),                 'base'      => '%_%',                 'prev_text' => __('« Indietro'),                 'next_text' => __('Avanti »'),                 'mid_size'  => 5,                 'format'    => '?page=%#%',                 'current'   => $current,                 'total'     => $total             )); echo $paginate_links;         }          // Reset main query object     $wp_query = NULL;     $wp_query = $temp_query;      Any idea of what's happening?


Custom user roles for access to specific parts of the site

I need to create specific sections of my site which should only allow certain users to access them. So basically, I'll be having a staff section - if the user is a staff member, they'll see a link to the section and obviously be able to see all the info there. I've looked into a couple of things, namely adding user roles but they all seem to have a set list of capabilities that I can set. There isn't anything that I can find that will allow me to restrict users access to certain parts of the site. I don't mind using plugins or anything like that - any suggestions would be welcome.


Stand alone website with two WordPress pages

I have a stand alone website that currently uses WordPress for only one of the pages. When I initially installed WordPress I created a new folder entitled 'blog' to use as my root directory. What I am trying to do now is create a second page that will utilize WordPress, but I don't want that page to be www.mysite.com/blog/newpage. I want my newly created page that will utilize WordPress to be www.mysite.com/newpage. What is the best way to accomplish this task? I thought about adding my WordPress theme to the root directory of my static site, but I have had trouble with that in the past. I would appreciate any guidance.


Change the date format

Sorry I'm newbee of wordpress. I want to change the format from Fri, 4 Oct 2014 to 04/10/2014. I changed the format from general - settings but still looks like same. I've already check this post : Here is the html of my page:               <time class="item-to" datetime="2014-10-04T00:00:00+00:00">Fri, 4 Oct 2014</time>      Should I change something in core wordpress files?


Image Upload HTTP 500 Internal server error

While I upload images the images are uploaded in the uploads folder but dont get response rather it get a HTTP error(500 Internal server error). I have tried all the solutions to fix the upload image.Turned off the mod_security from the htaccess.Increased the memory size.Also changed the permalink to default previously it was postname.I have also tried with both the flash uploader & the browser uploader.And get the error in the async- upload.php.


Hook on creating a menu entry?

I need to run some code after a new item has been inserted into a WordPress nav menu. Is there any hook on menu modification or something similar?


Merged two WP_Queries, posts per page and pagination not working

I merged two WP_Queries with the code below, it has pagination setup as well as posts per page in the final combined object but those settings aren't working. My page shows 24 posts, where is it getting this number from and why isn't pagination working?               $args1 = array(         'post_type' => 'post',         'posts_per_page' => -1         );     $query1 = new WP_Query( $args1 );              $args2 = array(         'post_type' => 'product',         'product_tag' => 'home',         'posts_per_page' => -1         );     $query2 = new WP_Query( $args2 );          $paged = get_query_var('paged') ? get_query_var('paged') : 1;          $finalargs = array(       'paged' => $paged,       'posts_per_page' => 3     );          $wp_query = new WP_Query($finalargs);          $wp_query->posts = array_merge( $query1->posts, $query2->posts );          $wp_query->post_count = count( $wp_query->posts );          echo '<pre>';     //var_dump($wp_query); exit(0);     echo '</pre>';      The output of var_dump is below, so if my wp_query has posts per page and pagination setup why isn't it working?               object(WP_Query)#566 (47) {       ["query"]=>       array(2) {         ["paged"]=>         int(1)         ["posts_per_page"]=>         int(3)       }       ["query_vars"]=>       array(61) {         ["paged"]=>         int(1)         ["posts_per_page"]=>         int(3)         ["error"]=>         string(0) ""         ["m"]=>         string(0) ""         ["p"]=>


Every time I de-activate a custom plugin, the site encounters a critical error

I have a custom plugin that I no longer use. I was looking to de-activate it from my site (and, subsequently, my network) but every time I attempt to, I get this error: > Please activate the {plugin name} plugin with no further output from WordPress (it's just the text and nothing else!) I'm effectively locked out of everything on the web end with no options but to restore the DB to an earlier version. Has anyone ever experienced something like this before?


Add a string after each item in Wordpress sub menu

I am trying to add a special character to display a » alongside each menu item in Wordpress. So for example About us » Contact us » And so on... Here's my code
<?php echo $children; echo '»'; ?>
      I expected this would do the job, but it just puts the » below the list. Here's the full code                     <?php           if($post->post_parent) {           $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");           $titlenamer = get_the_title($post->post_parent);           }                else {           $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");           $titlenamer = get_the_title($post->ID);           }           if ($children) { ?>
             <?php echo $titlenamer ?>

<?php echo $children; echo '»'; ?>


How to customize navigation menu?

I'm new to Wordpress and I've tried `wp_nav_menu` function. If i get it right it is a standard way to show you navigation menu created with help of the Menu Manager. What is bothering me is the fact that it internally creates a bunch of CSS classes I probably don't need. I have control over the container `div`(delete it, change its class and so on) and the `ul` element itself, it is also possible to add extra elements before and after an anchor element. What i couldn't find out is how to remove those bizillion classes attached to list elements(`li`). Is there any way to achieve this? And another question would be: could it harm? I have noticed that there are some classes, which could be used by another built in Wordpress functions. If there is a way to remove those, which should definitely stay?


User profile update author

So I'm trying to create email notifications to certain users to update them on updates to user profiles. I'd like to send these users the profiles that were updated, and also which user made these updates. Sometimes administrator-level users may make changes to other user profiles. I know I can hook into the profile_update to send emails when an profile is updated, but the big question is how to get information on who made these profile updates? Any suggestions on how to do this would be appreciated. Thank you


the_post_thumbnail fetches wrong image

We currently have a strange issue with a wordpress site. We have Featured Images on a good number of pages, including the one that we selected as the start page of the blog – the site uses a custom start page. Alas, instead of pulling the Featured Image for that blog, it takes the image it finds on the first article of the blog. Which is kind of strange, considering the call is at a place where we haven't entered the loop yet. So I'm at loss. How can I get the function to output the right image? (WordPress 3.5.2; Theme “Responsive”)


Add taxonomy to custom post type archive

This is my first question so bear with me. I'm trying to setup a custom post type which has a few taxonomies associated with it. Each taxonomy is hierarchical. What I would like to achieve is a better url structure than what is happening right now. My permalinks are set to the default "post name" setting. What I would like to achieve is something like this: domain.com/custom-post-type/taxonomy/type what ends up happening is I just get: domain.com/taxonomy/type This is essentially a career board where I have different taxonomies representing different categories. For example there is "job sector" for different types of jobs. Should these be set as hierarchical? When I use a plugin called "Custom Post Type Permalinks" I can get it to work the way I want but I was wondering if its possible without a plugin. here is my code for the custom post type plugin I've created:               <?php     add_action( 'init', 'career_forum' );     // let's create the function for the custom type     function career_forum() {          $labels = array(             'name' => _x( 'Careers', 'post type general name' ),             'singular_name' => _x( 'Career Listing', 'post type singular name' ),             'add_new' => __( 'Add New', 'career' ),             'add_new_item' => __( 'Add New Career Listing' ),             'edit_item' => __( 'Edit Career Listing' ),             'new_item' => __( 'New Career Listing' ),             'view_item' => __( 'View Career Listing' ),             'search_items' => __( 'Search Careers' ),             'not_found' => __( 'No careers found' ),             'not_found_in_trash' => __( 'No careers found in trash' ),             'parent_item_colon' => ''         );         $args = array(              'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' => true,             'has_archive' => true,             'menu_position' => 5,             'rewrite' => array( 'slug' => 'careers', 'with_front' => false ),             'supports' => array( 'title', 'editor', 'thumbnail')     );          register_post_type( 'career_listings', $args );     }     add_action( 'init', 'create_career_forum_taxonomies', 0 );     // function for adding taxonomies for Career Forum     function create_career_forum_taxonomies() {         // Job Sectors         $labels = array(             'name' => _x( 'Job Sectors', 'taxonomy general name' ),             'singular_name' => _x( 'Job Sector', 'taxonomy singular name' ),             'search_items' => __( 'Search Job Sectors' ),             'all_items' => __( 'All Job Sectors' ),             'parent_item' => __( 'parent Job Sector' ),             'parent_item_colon' => __( 'Parent Job Sector:' ),             'edit_item' => __( 'Edit Job Sector' ),             'update_item' => __( 'Update Job Sector' ),             'add_new_item' => __( 'Add New Job Sector' ),             'new_item_name' => __( 'New Job Sector Name' ),         );          register_taxonomy( 'job_sector',          array( 'career_listings' ),          array(          'hierarchical' => true,         'labels' => $labels,         'show_ui' => true,         'query_var' => true,         //'rewrite' => array( 'slug' => 'job-sector', 'hierarchical' => true, 'with_front' => true ),         )     );          // Regions     $labels = array(         'name' => _x( 'Regions', 'taxonomy general name' ),         'singular_name' => _x( 'Region', 'taxonomy singular name' ),         'search_items' => __( 'Search Regions' ),         'all_items' => __( 'All Regions' ),         'parent_item' => __( 'parent Region' ),         'parent_item_colon' => __( 'Parent Region:' ),         'edit_item' => __( 'Edit Region' ),         'update_item' => __( 'Update Region' ),         'add_new_item' => __( 'Add New Region' ),         'new_item_name' => __( 'New Region Name' ),     );          register_taxonomy( 'region',          array( 'career_listings' ),          array(          'hierarchical' => true,         'labels' => $labels,         'show_ui' => true,         'query_var' => true,         'rewrite' => array( 'slug' => 'region', 'hierarchical' => true ),         )     );          // Position Type     $labels = array(         'name' => _x( 'Position Types', 'taxonomy general name' ),         'singular_name' => _x( 'Position Type', 'taxonomy singular name' ),         'search_items' => __( 'Search Position Types' ),         'all_items' => __( 'All Position Types' ),         'parent_item' => __( 'parent Position Type' ),         'parent_item_colon' => __( 'Parent Position Type:' ),         'edit_item' => __( 'Edit Position Type' ),         'update_item' => __( 'Update Position Type' ),         'add_new_item' => __( 'Add New Position Type' ),         'new_item_name' => __( 'New Position Type Name' ),     );          register_taxonomy( 'position_type',          array( 'career_listings' ),          array(          'hierarchical' => true,         'labels' => $labels,         'show_ui' => true,         'query_var' => true,         'rewrite' => array( 'slug' => 'position-type', 'hierarchical' => true ),         )     );     }


Using custom templates for post_is_in_descendant_category

I'm using this function on functions.php and the goal is to call a specific template for any post inside a main category but this isn't working when I need to call a generic template for any other categories... Help, please! This is my code inside single.php:               <?php get_header(); ?>     <?php if ( in_category( 'cat1' ) || post_is_in_descendant_category( 3 ) ) {?>     <?php get_template_part('single-cat-1');?>          <?php } if ( in_category( 'cat2' ) || post_is_in_descendant_category( 1102 ) ) {?>     <?php get_template_part('single-cat-2');?>          <?php } if ( in_category( 'cat3' ) || post_is_in_descendant_category( 81 ) ) {?>     <?php get_template_part('single-cat-3');?>          <?php } else if (array(post__not_in(1102,81,3))) { ?>     <?php get_template_part('single-generic');?>     <?php }?>


After submit comments select the current tab

In my `single.php` I have 3 tabs one for description, others for comments and reviews my question is when I submit the comments, the first tab is always selected. My code:

                         Description                          Comments                         Reviews

                         <?php the_content(); ?>

                         <?php if ( comments_open() || true): ?>                             <?php comments_template( '', true ); ?>                         <?php endif ?>

REVIEW

      How can I pass the attribute `class="selected"` dynamically?


How to get one result using wpdb class?

function asec_get_link_color() {             global $wpdp;         $query = "SELECT value FROM wp_theme_options WHERE property = 'link-color'";         $result = $wpdb->get_results($sql);         return $result;     }      It doesn't return any value.


Can't see gravity form $object

Hey I am using gravity forms v1.7.13 I created a form with two fields name and email and I need to modify form data before creating entries in database for that I am using gform_pre_submission_filter and my code is something like this: I Have added this to my functions.php               function gf_filter($form) {        //Here I am printing the form object i get after submission.          echo '<pre>';         print_r($form);         echo '</pre>';         exit;          }          add_action('gform_pre_submission_filter_1','gf_filter');      but the forms keeps on loading and doesn't shows the $form object I don't know what's wrong.


jQuery cycle thumbnails?

jQuery cycle thumbnails ? Hi all I have a demo here (not in Wordpress) where I'm using the jQuery cycle plugin to create the slideshow and the thumbnails. http://www.ttmt.org.uk/forum/wordpress/ I want to create the same thing in Wordpress http://www.ttmt.org.uk/wordpress/ Here I have one page with the images added directly to the content of the page. I'm using the same cycle code as the non-wordpress page. The image placeholders are added for the thumbnails but not the images. Can anyone see why the thumbnails are not shown? Is there another way to do this. I tried to use Wordpress plugins to do this but they all limited the slideshow images to being the same dimensions. I need the images to be different sizes. --UPDATE-- The home page has this php that simply outputs the page content. The images have been added directly to the page
                   <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
              <?php the_content(); ?>

               <?php endwhile; endif;?>
      This the jquery I'm using to try and create the thumbnails. I'm using Timthumb to resize the thumbs.


Query specific posts from parent by slug rather ID

I'm developing a theme in a local machine and migrating it to a production server. To keep things in sync, i'm trying to avoid any queries of specific ID's On the homepage, i'm trying to query the top 3 pages (by menu_order) from a parent page (NOT the homepage). It works perfectly with the hardcoded ID, but i'm stumped trying to figure out a way to do this without the ID. Seems like I should be able to use the slug, but I can't figure it out. Here's the code i'm working with:               $args = array(     'post_type' => 'page',     'posts_per_page' => 3,     'post_parent' => '74',     'orderby' => 'menu_order',     );     query_posts($args);      So rather than 'post_parent' => '74' I want to use the page slug (e.g. 'books'). Any ideas? This question seems promising, but as others commented, I'd also like to avoid direct DB queries and the second suggestion didn't work working.


Why is the first query affecting the second query, even after wp_reset_query() and wp_reset_postdata(), but not on the second page?

I am literally clueless as to why the code does not function properly on the first page, but functions as expected on the second page. I have already tried running the second query via another WP_Query() to no avail. See for yourself: http://blog.donovanglover.com/ The second query should return the latest 3 posts in the pagination loop, yet it also returns posts from the first query. Instead of 3 posts on the homepage, there are 6, but on the second page, you see the expected 3. My code is below:
     <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
Featured Posts

     <?php wp_reset_query(); ?>     <?php $sticky_query = new WP_Query('nopaging=true'); ?>     <?php if(have_posts()) : while ($sticky_query->have_posts()) : $sticky_query->the_post(); ?>     <?php if(is_sticky()) : ?>
<a rel="bookmark" href="<?php the_permalink(); ?>"><?php echo the_post_thumbnail('full'); ?>
<?php the_title(); ?>

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

The New Stuff

     <?php wp_reset_query(); ?>     <?php query_posts('showposts=3&paged='.$paged); ?>     <?php if(have_posts()) : while(have_posts()) : the_post(); ?>

<a rel="bookmark" href="<?php the_permalink(); ?>">                             <?php echo the_post_thumbnail('full'); ?>                             <?php the_title(); ?>
                         <?php the_excerpt(); ?>

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

                     <?php previous_posts_link('← Newer Entries') ?>                     <?php next_posts_link('Older Entries →') ?>

      Am I doing something wrong, or would this be the expected output?


Functions Error: Impacting Galleries

The function below controls an option inside an options panel. What it does is choose the number of posts being displayed in a particular archive (to_count archives, to_count_home, to_count search are assigned to the homepage, archives.php, and search results respectively). When I change the number of posts being display it also (for some strange reason) changes the number of images being displayed in a gallery via [gallery] inside a post. I'm not sure why this is happening, since these codes are not being called inside single.php               // Posts per page     add_filter('parse_query', 'wpq_parse_query');     function wpq_parse_query($query)     {         if($query->is_archive())         {             $query->query_vars['posts_per_page'] = get_option('to_count_archives', 10);         }         if($query->is_home())         {             $query->query_vars['posts_per_page'] = get_option('to_count_home', 10);         }         if($query->is_search())         {             $query->query_vars['posts_per_page'] = get_option('to_count_search', 10);     }          return $query;         }


Creating a custom login on site.

Evening, I'm trying to make a simple 'login' feature for my site. I'd rather just have a dropdown box of sorts, and to login, the redirect back to the page you submitted it on. I've some code I found (I'm VERY new to wordpress), and it doesn't seem to be working right, when I click 'send', nothing changes. The page gives no errors, and it just sits there, it doesn't say I've logged in, or give any indication it's acting different.               <?php if (!(current_user_can('level_0'))){ ?>
Login
     <form action="<?php echo get_option('home'); ?>../../wordpress/wp-login.php" method="post">     <input type="text" name="log" id="log" value="<?php echo wp_specialchars(stripslashes($user_login), 1) ?>" size="20" />     <input type="password" name="pwd" id="pwd" size="20" />     <input type="submit" name="submit" value="Send" class="button" />
            <input name="rememberme" id="rememberme" type="checkbox" checked="checked" value="forever" /> Remember me            <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />
     </form>     <a href="<?php echo get_option('home'); ?>/wp-login.php?action=lostpassword">Recover password     <?php } else { ?>
Logout
     <a href="<?php echo wp_logout_url(urlencode($_SERVER['REQUEST_URI'])); ?>">logout
     admin     <?php }?>


Jetpack breaks including post (via permalink)

On another website, I've been dynamically including posts `<?php include '[post].php' ?>` via the permalink, from my Wordpress site. I recently installed the Jetpack plugin for my Wordpress site, and now when I try including the post it displays a smiley :) in my content area, then forwards to a completely blank white screen with only the smiley. I know the smiley face is part of how Jetpack functions, but is there any way to get these to function in unison?


How to create a Mashable like collapsing navigation menu in Wordpress?

If you look at the top navigation menu of Mashable you would see that when we resize the view port, the top level menu items collapse under a sub-menu item "More". As we reduce the width of the viewport further, more and more items collapse under a single top level menu list item "More". I want to achieve something like this under Wordpress. Any pointers on this?


Resize post thumbnail produces horrible image quality..Any help?

im having a problem figuring this out. I am displaying a random post on the header of my site but the post-thumbnail looses quality when I add a custom size. How can i make it not loose quality? This is the code in header.php
     <?php     $args = array( 'numberposts' => 1, 'orderby' => 'rand', 'post_status' => 'publish', 'offset' => 1);      $rand_posts = get_posts( $args );      foreach( $rand_posts as $post ) : ?>
<?php the_post_thumbnail(array(730,250)); ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ? >"><?php the_title(); ?>      <?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?>
      <?php endforeach; ?>

          And this is the css               div.post-thumb-title {     width: 730px;     margin: 1em auto;     }          div.post-thumb-title img {     display: block;     min-width: 100%;               div.post-thumb-title p.thumb-title {     margin: 0;     height: 2em;     line-height: 2;     position: relative;     top: -2em;     max-width: 100%;     text-align: center;      color: #fff;     background: rgba(0, 0, 0, 0.7);     }      Image quality is horrible. Am i doing something wrong or is there a fix for this? Thanks for your help


How do I get the slug of a custom taxonomy category of a post?

In my template file, I loop through posts that are categorized either _web_ , _print_ , or _marketing_ in a custom taxonomy _portfolio_. How do I echo the slug of each posts category?


Option doesn't save

I am studying wordpress settings api and tried some tutorials. I want to save the option as an array. I put some defaults for the option and it works fine, but after I save the settings, it becomes blank - string(0). How come? My callback for the form element is this:               function render_checkbox($html_args){     extract($html_args);     $option_name = 'di_theme_options';     $option = get_option('di_theme_options');     printf(         '<input type="checkbox" name="%1$s[%2$s]" id ="%2$s" value = "1" %3$s />',         $option_name,         $id,         checked(1, $option[$id],false)     );     }


"Use as featured image" not working , "Set Featured Image" hangs. GoDaddy Issue

**What my site runs on:**   * Wordpress version: 3.4.2   * Host Gator Shared Server   * PHP 5.3 **What happens when i click use as featured image ?**   * The text "Saving..." appears and the image never gets saved as the featured image **What I tried**   * The problem was on 3.4.1 so i updated it to 3.4.2 ( Issue not resolved )   * Changed the theme to the basic twenty ten ( Issue not resolved )   * Wordpress support forums seem to sway towards the fact that its a wordpress core code issue and not an issue with the themes.


$GLOBALS array for wordpress

is there a file where wordpress defines it's $GLOBALS? i'm just curious as to what wordpress uses it for and for what purpose. That's all!


Are there any action like 'init_frontend'

I've found init and init_admin. Are there any action that executes just in the frontend? Thanks.


wp_logout logging everyone out instead of just the user that clicked the logout link!

I want to display a different menu depending whether a user is logged into the CMS or not. I'm using this for my menu:               <?php if ( is_user_logged_in() ) {     $args = array(         'depth'        => 1,         'show_date'    => '',         'date_format'  => get_option('date_format'),         'child_of'     => 0,         'exclude'      => '5, 80, 83, 138',          'include'      => '',         'title_li'     => __(''),         'echo'         => 1,         'authors'      => '',         'sort_column'  => 'menu_order, post_title',         'link_before'  => '',         'link_after'   => '',         'walker' => '' );     ?>

             <?php wp_list_pages( $args, 'sort_column=menu_order' ); ?>
                 <a href="<?php $redirect = bloginfo('url'); wp_logout_url( $redirect ); ?>">                     Logout

Viewing content for:
Aneurin Bevan Health Board

     <?php } else {     $args1 = array(         'depth'        => 1,         'show_date'    => '',         'date_format'  => get_option('date_format'),         'child_of'     => 0,         'exclude'      => '25, 31, 33, 43, 93, 96, 99, 138',             'include'      => '',         'title_li'     => __(''),         'echo'         => 1,         'authors'      => '',         'sort_column'  => 'menu_order, post_title',         'link_before'  => '',         'link_after'   => '',         'walker' => '' );     ?>

             <?php wp_list_pages( $args1, 'sort_column=menu_order' ); ?>

     <?php } ?>      I'm using the following for a user to logout of the CMS:               <a href="<?php $redirect = bloginfo('url'); wp_logout_url( $redirect ); ?>">Logout      Even though the page reloads after clicking the logout link, the menu doesn't seem to change. Does anyone know what's going wrong? * * * **UPDATE** I've tried using `<?php $redirect = bloginfo('url'); wp_logout( $redirect, $echo ); ?>` which I thought was working perfectly until a colleague shouted across the room that they had been logged out too! Turns out it's logging everyone out instead of just logging out the user that clicked the logout link!


How to display non-hierarchical taxonomy as terms with checkboxes?

I'd like to have a non-hierarchical custom taxonomy displayed in the add/edit posts admin screen for a custom post type. Obviously, when the custom taxonomy is non-hierarchical, the meta box that's displayed is similar to the tags - it's a text field with the auto-suggest. However, I'm more interested in having a flat, non-hierarchical taxonomy display as a list of checkbox terms. In essence, I'd like it's functionality to be the same as categories, with the exception that child terms could not be added. Surely this is something that other developers have done, but the normal Google searches haven't returned much for me. Apparently this was the default behavior when custom taxonomies were originally introduced in v2.8. ![Example of non-hierarchical taxonomy with checkboxes](http://i.stack.imgur.com/Xt0XB.png) I'm really not looking for a plugin solution, however code examples from plugins would be fine. When developing sites for client's it is often beneficial to allow them to see the list of pre-established terms for a certain post type. The customer should be allowed to add additional terms, just not additional child terms.


In What WordPress Version Was the Import/Export Tool Introduced?

I was just looking under my "Tools" menu in my WordPress site and noticed the "Export/Import" functions. I was not aware that this was even available and I've been needing it for some time. What version of WordPress did it originate with?


Sidebar on single.php not showing up

So, my sidebar is working just fine on my blog page: beta.cleantelligent.com/blog However, when you click a single post, I'd like that same sidebar to show up. I am assuming this would be under single.php, right? That code is listed below. Let me know if you need any other code and I'll post it here. I have the 'blog' sidebar in my page attributes on the Edit Page in Wordpress, but it's just not being recognized by the template, I guess? Any help would be great. Thanks!               <?php      get_header(); ?>

     Blog

     <?php     $post_obj = $wp_query->get_queried_object();     $post_name = $post_obj->post_name;     if($post_name == 'blog'){     echo 'Blog';     }else{     $parent_title = get_the_title($post->post_parent);     echo $parent_title;     }     ?>
              <?php while ( have_posts() ) : the_post(); ?>                  <?php get_template_part( 'content', 'archive' ); ?>              <?php endwhile; // end of the loop. ?>

     <?php get_sidebar(); ?>
      The blog page is using index.php               <?php     get_header(); ?>

     <?php     $post_obj = $wp_query->get_queried_object();     $post_name = $post_obj->post_name;     if($post_name == 'blog'){     echo 'Blog';     }else{     $parent_title = get_the_title($post->post_parent);     echo $parent_title;     }     ?>

                  <?php while ( have_posts() ) : the_post(); ?>                           <?php get_template_part( 'content', 'blog' ); ?>                                <?php comments_template( '', false ); ?>                  <?php endwhile; // end of the loop. ?>

          <?php get_sidebar(); ?>

      Here is my sidebar.php:               <?php          $options = twentyeleven_get_theme_options();     $current_layout = $options['theme_layout'];     $nav = sb_get_page_nav($post);     if ( 'content' != $current_layout ) :     ?>     <img class="sidebar-top" src='<?php bloginfo('stylesheet_directory'); ?>/images/sidebar-top.png' />
     <?php         $post_obj = $wp_query->get_queried_object();         $post_name = $post_obj->post_name;         $title = 'cs-' . $post_name;          ?>     <?php         if($post_name == 'news-events'){             if ( ! dynamic_sidebar( 'sidebar-web' ) ) :             endif;         }     ?>          <?php if(!$nav['no_nav']) { ?>
             <?php wp_nav_menu(array('container_id' => 'left-navigation','menu' => $nav['title'])); ?>
     <?php } ?>               <?php if ( ! dynamic_sidebar( 'sidebar-all' ) ) : ?>     <?php endif; // end sidebar widget area ?>     <?php /*
             <?php if(!$nav['no_nav']) {                 wp_nav_menu(array('container_id' => 'left-navigation','menu' =>     $nav['title']));             } ?>
              */ ?>              <?php if ( ! dynamic_sidebar( $title ) ) : ?>         <?php endif; // end sidebar widget area ?>         <img class="sidebar-bot" src='<?php     bloginfo('stylesheet_directory'); ?>/images/sidebar-bot.png' />
          <?php endif;      $parent_title = get_the_title($post->post_parent);     if($parent_title == 'Tour'){     echo"          ";     }     ?>


Woocommerce product image

when I upload in woocommerce image it uploads different sizes:   1. For category   2. Single   3. Thumb and keeps original file which is big... how can I auto delete this original file ?


Custom GD Star Ratings Stars

I have some custom stars that I would like to use for GD Star Ratings.. how do I load my custom star image?


local Wordpress installation with Xampp permalinks issue

I know this question might be asked before but it seems that nothing helped. I have a local Wordpress installation and try to use `permalinks`. What I did in my XAMPP was to open the `conf` file and find `LoadModule rewrite_module modules/mod_rewrite.so` so it was activated and no `#` before. Then I searched for `AllowOverride All` which was fine too. But none of the permalinks work, I always get an `not found` error. Can anyone help?


How to create short urls for sharing and downloadable content?

I want to create something similar to " **youtube.com/long => youtu.be/short** " for my wordpress blog/portfolio/freebie site: " **magicshrooms.com/%cat-etc => mgcsr.mz/link-name** ". Generally, I want to create a short link for each link and also for downloads, since my url is quite long. Of course I will buy short domain and what to do further i am lost... Tried googling it and apparently its more complex than I thought. There are services like bitly, but ridiculously expensive. Also something called YOURLS, but no clue how it works. Is there anyone who has this function implemented and could point me to tutorial or simply explain how to do this. Also, guys what do you think about this url shortening? Good/bad idea? Thanks in advance:)


Query posts and custom post types within the same category

i have a filter on my template which returns posts from a given category and displays them in a slider gallery. This is the code:               <?php      if (is_page()) {          $cat=get_cat_ID($post->post_title); //use page title to get a category ID          $posts = get_posts( array('category' => 16) );          if ($posts) {              foreach ($posts as $post):                  setup_postdata($post); ?>      This works fine with "normal" posts. But I have created 3 custom post types (some of the entries tagged with the same category). And they don't show up. Could anyone please help how to customize this code in order to be able to use it also with CPT's? Thank you, Ralf


How do I display the posts from a custom post type on a category.php page?

I have set up a `category.php` according to this wordpress hierarchy diagram. When I am on the page http://example.com/category/my-category I want to display all posts that are under `my-category` using the loop:               <?php if (have_posts()): while (have_posts()): the_post(); ?>
<?php the_title(); ?>
     <?php endwhile; endif; ?>      Wordpress is not showing the posts. I will also add that this is a custom post type, but that shouldn't matter or should it? I can use `get_posts()` but then what is the point of having a `category.php`? How do I show the posts in the current category using `the_loop`?


Can I leave off plugin textdomain for terms used in core?

I've got a plugin that puts post statuses into post type admin menus. I'm in the middle of internationalizing it, and I'm wondering how to handle this situation. The plugin uses some unique strings that will get a textdomain like this:               __( 'Select the post statuses to exclude from post type admin menus', 'csmpmsi' )      But then there are also cases where I'm using a core-related word for their core-related meaning like this: `__( 'Pages' )`. In this situation, it seems to make perfect sense for me to exclude the textdomain and take advantage of terms that are already localized in core. However, the codex seems very explicit: > If you're trying to translate a plugin, the same advice as above applies, > except that > >   * you must use a domain, which is loaded in a hook of your plugin > >   * every translation call must become __('text', 'domain-name') > > So is this WP-kosher?


Display ONE taxonomy and its assigned pages

Quite a straight-forward question but I haven't been able to find a solution. I have created a page which lists categories within a taxonomy called **'Themes'**. I now want each link in the list to point towards an index page which displays all of the pages for that particular category. The way I see it, it's a bit like a search results page, because I only want to create one template page for the results, but the results will vary depending on what Taxonomy category is clicked. E.g. This is what I want to happen: The post-type is called **Events**. Within **Events** there is a taxonomy called **Themes**. **Themes** has a number of categories such as **Boat** , **Fishing** , **Walking** , **Eating** etc. On one of the pages, user clicks on the **Boat** category listed. User is then taken to a page which displays all of my post-type pages within the **Boat** category under the **Themes** taxonomy. Hope this is clear, if you need any clarification just let me know. Thank you


blocking the admin section (but still using admin-ajax.php)

I am building a community based WP site at the mo and have blocked anyone bar admins from using the admin section on the site with:               add_action( 'init', 'sw_block_users' );          function sw_block_users() {         if ( is_admin() && ! current_user_can( 'administrator' ) ) {             wp_redirect( home_url() );             exit;         }     }      However, I'm also using the awesome power of admin-ajax.php to do a few ajaxy things (as outlined here : http://reallywebdesign.com/2011/09/send-dynamic- data-to-javascript-in-wordpress/), which get blocked by the above function. Is there a different way I can prevent non-admins from getting to wp-admin directory, while maintaining the use of the admin-ajax file? Thanks!


category.php not showing custom post types

in my custom post type i've set `'taxonomies' => array('category')`. However, within my category.php page, none of the custom post types are being displayed, only posts. How do i make ALL post types appear, not just the post?


Apply html elements in php statement

I know this is probably going to sound like a beginner question ... to which it is in some sort. I have this statement in my one plugin that i am working on:               add_post_meta($newpostid, 'name', $formdata['your-first-name'].$formdata['your-last-name']);      Which in turn will add FirstnameLastname in a custom field. What i would like to do is add a space between the first and last name like this: Firstname Lastname I have tried using statements such as:               add_post_meta($newpostid, 'name', $formdata['your-first-name']. echo '&nbsp' . $formdata['your-last-name']);      But obviously that is not going to parse correctly. Is there any Idea on how I can achieve this? Any help would be welcome. :)


Possible jquery / library conflict in plugin usage

I am using the free version of the plugin: WP Feedback & Survey Manager but for some reasons the tab style is not rendered, and I guess it's for a javascript/jquery problem, eventhough I don't get any console errors. This is the plugin public url I installed: http://www.riccardo.it/newtech/questionnaire/ And here it is how it should look like (See tabs in screenshot #4): http://www.intechgrity.com/wp-plugins/wp-feedback-survey-manager/ Any suggestion? Thanks.


how to "not" display new posts with a specific category on the main page?

I've read this and this but I'm just a basic user. I have a "technical" blog that more and more people visit. I'm a freelance, and now, when someone hears about me, he/she wants to search for me, and my blog is #1 (before anything else). The problem is that it was a personal blog, and now it becomes professionnal. So I would still like to post some articles, but when there are some specific tags (like "games", "family" and so on), I'd like them **not** to appear on the main page but only under the category filter (`http://myblog/?s=game`, `http://myblog/?s=family` would be ok, but _not_ `http://myblog/`). How to do this?


Page is defaulting to archive page and not designated template

1. I created a page called "Projects" through the wordpress admin   2. I created a template called "Projects"   3. Set the "Projects" page to use the Projects template. How come when I navigate to the Projects page it shows the archive page and not the Projects template. Also, if I set the "posts page" in settings->reading to "Projects" in the admin then the above happens. But, if I don't set a post page then I can go to the /Projects and this works fine. However, if I go to /projects (lowercase) then this doesn't work and it defaults to the archive page. I'm confused as to what is going on, can anyone help?


Specifying a template for custom post type pages

My main projects page is bringing in some data that I have entered in for custom post types. There are basically a few categories like "photo", "video", etc. When you click on one of these it will go to a subpage like /projects/photo/1. How to I go about specifying a template to use for those subpages? I am using the Ultimate Post-Type Plugin, but that shouldn't really matter since it should work the same way.


Taxonomy terms with edit/filter link in wp-admin, in the list of custom posts

I'm using get_the_term_list and manage_posts_custom_column to display the terms of a custom taxonomy in the list of custom posts, in the WordPress Admin.               add_action( 'manage_mycustompost_posts_custom_column' , 'custom_mycustompost_column', 10, 2 );          function custom_mycustompost_column( $column, $post_id ) {       switch ( $column ) {         case 'category_names':             echo get_the_term_list( $post_id , 'mycustomcategory' , '' , ',' , '' );             break;       }     }      However, for each taxonomy term, I get a link to the public page that shows posts for that term: http://www.myblog.com/mycustomcategory/test/ I would like to get a link that filters the list in the WordPress Admin. I would like a link like: http://www.myblog.com/wp- admin/edit.php?post_type=post&category_name=news The type of link I get in the Posts list, for tags or categories of the default WordPress posts. Is there a WordPress function that does that?


RSS feed not Refreshes

I use RSS widget I put the address of the RSS on RSS widget: http://mysite.tumblr.com/rss I add the code to functions.php                   add_filter( 'wp_feed_cache_transient_lifetime',         create_function('$a', 'return 100;') );      It does not refresh All 100 seconds.


How to find the origin of a file upload from within wp_handle_upload?

I have a plugin that hooks into "wp_handle_upload" filter. Within that scope I'd like to be able to identify where the upload came from, meaning I want to treat it differently if it was uploaded from within a post vs. the media library vs. a plugin/theme settings page (for example the header image for a template). The only thing passed into my function is an array with file,url,type. Is there a way to identify where it came from? I could probably create an exception and examine the stack trace, is that a decent solution? If so, what might I be looking for in the stack? Thanks!


How to check if a user (not current user) is logged in?

I need to display the online status (online/offline) for each author page (custom author page template). is_user_logged_in() only applies to the current user and I can't find a relevant approach targeting the current author e.g. is_author_logged_in() Any ideas? # Answer One Trick Pony was kind enough to prepare the coding for two to three functions using transients, something I hadn't use before. http://codex.wordpress.org/Transients_API Add this to functions.php:               add_action('wp', 'update_online_users_status');     function update_online_users_status(){            if(is_user_logged_in()){              // get the online users list         if(($logged_in_users = get_transient('users_online')) === false) $logged_in_users = array();              $current_user = wp_get_current_user();         $current_user = $current_user->ID;           $current_time = current_time('timestamp');              if(!isset($logged_in_users[$current_user]) || ($logged_in_users[$current_user] < ($current_time - (15 * 60)))){           $logged_in_users[$current_user] = $current_time;           set_transient('users_online', $logged_in_users, 30 * 60);         }            }     }      Add this to author.php (or another page template):               function is_user_online($user_id) {            // get the online users list       $logged_in_users = get_transient('users_online');            // online, if (s)he is in the list and last activity was less than 15 minutes ago       return isset($logged_in_users[$user_id]) && ($logged_in_users[$user_id] > (current_time('timestamp') - (15 * 60)));     }          $passthis_id = $curauth->ID;     if(is_user_online($passthis_id)){     echo 'User is online.';}     else {     echo'User is not online.';}      # Second Answer (do not use) This answer is included for reference. As pointed out by One Trick Pony, this is undesireable approach because the database is updated on each page load. After further scrutiny the code only seemed to be detecting the current user's log-in status rather than additionally matching it to the current author. 1) Install this plugin: http://wordpress.org/extend/plugins/who-is-online/ 2) Add the following to your page template:               //Set the $curauth variable     if(isset($_GET['author_name'])) :     $curauth = get_userdatabylogin($author_name);     else :     $curauth = get_userdata(intval($author));     endif;          // Define the ID of whatever authors page is being viewed.     $authortemplate_id = $curauth->ID;          // Connect to database.     global $wpdb;     // Define table as variable.     $who_is_online_table = $wpdb->prefix . 'who_is_online';     // Query: Count the number of user_id's (plugin) that match the author id (author template page).     $onlinestatus_check = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM ".$who_is_online_table." WHERE user_id = '".$authortemplate_id."';" ) );          // If a match is found...     if ($onlinestatus_check == "1"){     echo "
User is online now!
";     }     else{     echo "
User is currently offline.
";     }


Change next_post and previous_link to navigate throught parent categories only

I have this unchanged code from template-tags.php which links through all of the posts on the site. However I would like to restrict it so that it only links through the articles which are in the same parent category.               <nav role="navigation" id="<?php echo $nav_id; ?>" class="<?php echo $nav_class; ?>">
<?php _e( 'Post navigation', 'IQ' ); ?>
              <?php if ( is_single() ) : // navigation links for single posts ?>                  <?php previous_post_link( '
%link
', '' . _x( '←', 'Previous post link', 'IQ' ) . ' %title' ); ?>             <?php next_post_link( '
%link
', '%title ' . _x( '→', 'Next post link', 'IQ' ) . '' ); ?>              <?php elseif ( $wp_query->max_num_pages > 1 && ( is_home() || is_archive() || is_search() ) ) : // navigation links for home, archive, and search pages ?>                  <?php if ( get_next_posts_link() ) : ?>
<?php next_posts_link( __( '← Older posts', 'IQ' ) ); ?>
             <?php endif; ?>                  <?php if ( get_previous_posts_link() ) : ?>
<?php previous_posts_link( __( 'Newer posts →', 'IQ' ) ); ?>
             <?php endif; ?>              <?php endif; ?>                    The site works like a magazine site, so we have a new issue every few months. The new issue is a new parent category, with new child categories to hold the respective articles. If someone is in Issue 0 -> News i would like them to be able to scroll through all of the articles in Issue 0 from that article. Does anyone know how this could be achieved?


How to redirect user after login to the page called by his first name?

I wonder how to redirect a user after login to the page called by his first name (name used for registration). Example: Username or first name is John, after login he should be redirected to website.com/john page. I tried to combine these 2 examples but without luck.               add_filter( 'login_redirect', 'ckc_login_redirect' );      function ckc_login_redirect() {         // Change this to the url to Updates page.         return home_url( '/Updates' );      }      &               global $current_user;     get_currentuserinfo();     echo 'Username: ' . $current_user->user_login . "\n";     echo 'User email: ' . $current_user->user_email . "\n";     echo 'User first name: ' . $current_user->user_firstname . "\n";     echo 'User last name: ' . $current_user->user_lastname . "\n";     echo 'User display name: ' . $current_user->display_name . "\n";     echo 'User ID: ' . $current_user->ID . "\n";      Please help PHP newbie :)


How to hide a plugin metabox for non admins when a user adds a new post

I've been able to disable all the meta boxes for non admin in their backend but I'm having problems with **Facebook AWD All in one** which creates a widget seen by all the users when they create new posts. How can I disable it? Is there some sort of command that is good for any widget created by plugins that I can add in my functions.php if I know the shortcode of the plugin? I need your help! Thanks... http://wordpress.org/extend/plugins/facebook-awd/ I use the following code to remove meta boxes               ######################################################################     # remove evreything from add a new post     ######################################################################     if (is_admin()) :     function remove_post_meta_boxes() {      if(!current_user_can('administrator')) {       remove_meta_box('tagsdiv-post_tag', 'post', 'normal');     //remove_meta_box('categorydiv', 'post', 'normal');       remove_meta_box('postimagediv', 'post', 'normal');       remove_meta_box('authordiv', 'post', 'normal');       remove_meta_box('postexcerpt', 'post', 'normal');       remove_meta_box('trackbacksdiv', 'post', 'normal');       remove_meta_box('commentstatusdiv', 'post', 'normal');       remove_meta_box('postcustom', 'post', 'normal');       remove_meta_box('commentstatusdiv', 'post', 'normal');       remove_meta_box('commentsdiv', 'post', 'normal');       remove_meta_box('revisionsdiv', 'post', 'normal');       remove_meta_box('authordiv', 'post', 'normal');       remove_meta_box('slugdiv', 'post', 'normal');      }     }          add_action( 'admin_menu', 'remove_post_meta_boxes' );     endif;      This is the code of the metabox   Facebook AWD Manager

Like Button

             Redefine globals settings ?             <select id="awd_fcbk_option_like_button_redefine" name="awd_fcbk_option_like_button[redefine]" class="span3" >             <option value="0" selected="selected" >No</option><option value="1"  >Yes</option>             </select>

             Activate ?             <select id="awd_fcbk_option_like_button_enabled" name="awd_fcbk_option_like_button[enabled]" class="span3" >             <option value="0"  >No</option><option value="1" selected="selected" >Yes</option>             </select>

             Where ?             <select id="awd_fcbk_option_like_button_place" name="awd_fcbk_option_like_button[place]" class="span3" >             <option value="top" selected="selected" >Top</option><option value="bottom"  >Bottom</option><option value="both"  >Both</option>             </select>


Cannot see dropdown shortcut to site dashboard in WordPress network why?

As per title and following screenshot   ![enter image description here](http://i.stack.imgur.com/2NLIQ.png)


Ajax loading duplicate post

I wanna start by apologize for this post being so long, but I feel it may help others since I am having this problem and figured I might as well be as detailed as possible. I am having a problem with this is the loop.php file loading the same post multiple times and I have tried the prevent duplicate post method and nothing working. As you can see below I am loading the function to post into the ajax function and I get a success call but at this point I am not sure if the loop file is the problem. When the site 1st loads it loads the 1st set of post and then when it gets the 2nd set of post its fine but everything after that is all the same post, its like the loop file loads but the query is stuck or something. Any suggestions? Any help is greatly appreciated. loop.php file
     <?php query_posts(array('post__not_in' => $id_merge,'posts_per_page'=>'2'));           $do_not_duplicate = $post->ID;           if (have_posts()) : while (have_posts()) : the_post();      if( $post->ID == $do_not_duplicate ) continue;      $ids[] = get_the_ID(); ?>
     <?php the_title(); ?>
     <?php endwhile; endif; // End the loop. Whew. ?>

     <?php query_posts(array('post__not_in' => $id_merge,'posts_per_page'=>'3'));           $do_not_duplicate = $post->ID;           if (have_posts()) : while (have_posts()) : the_post();      if( $post->ID == $do_not_duplicate ) continue;           $ids[] = get_the_ID(); ?>
     <?php the_title(); ?>
     <?php endwhile; endif; // End the loop. Whew. ?>
      functions.php               add_action('wp_ajax_infinite_scroll', 'wp_infinitepaginate');           // for logged in user     add_action('wp_ajax_nopriv_infinite_scroll', 'wp_infinitepaginate');    // if user not logged in          function wp_infinitepaginate(){         $loopFile        = $_POST['loop_file'];         get_template_part( $loopFile );         exit;     }      ajax               jQuery(document).ready(function($) {         var count = 1;         var total = <?php echo $wp_query->max_num_pages; ?>;         $(window).scroll(function(){                 if  ($(window).scrollTop() == $(document).height() - $(window).height()){                    if (count > total){                         return false;                    }else{                         loadArticle(count);                    }                    count++;                 }         });               function loadArticle(){                     $('a#inifiniteLoader').show('fast');                 $.ajax({                     url: "<?php bloginfo('wpurl') ?>/wp-admin/admin-ajax.php",                     type:'POST',                     data: "action=infinite_scroll&loop_file=loop",                      success: function(html){                         $('a#inifiniteLoader').hide('1000');                         $("#content").append(html);    // This will be the div where our content will be loaded                     }                 });             return false;         }     });


Having issue with WordPress wp_enqueue_style

I am building a full design into `WordPress` for the first time and I am trying to load in stylesheets and script files but all I seem to be getting is the text output of the location. What I have is below..               wp_enqueue_style('reset', bloginfo('template_url') . '/reset.css');     wp_enqueue_style('style', bloginfo('stylesheet_url'), array('reset'));     wp_enqueue_style('rhino', bloginfo('template_url') . '/rhinoslider-1.05.css', array('reset','style'));      Do I need to put this inside the `link` tags or something? I thought it would do it all itself; as what's the point loading it that way if it doesn't do it itself? I know it makes sure the same file isn't included twice or something, but if you have to include the link tags yourself and then WP decides not to include the file then you are left with blank link tags!? I also tried putting the below in my themes `functions.php` file but got the same results.               add_action( 'after_setup_theme', 'mmw_new_theme_setup' );          function mmw_new_theme_setup() {              /* Add theme support for post formats. */            add_theme_support( 'post-formats' );              /* Add theme support for post thumbnails. */             add_theme_support( 'post-thumbnails' );              /* Add theme support for automatic feed links. */            add_theme_support( 'automatic-feed-links' );              /* Add theme support for menus. */           add_theme_support( 'menus' );              /* Load style files on the 'wp_enqueue_scripts' action hook. */         add_action( 'wp_enqueue_scripts', 'mmw_new_load_styles' );          }          function mmw_new_load_styles() {              $foo = bloginfo('template_url') . '/reset.css';         $bar = bloginfo('template_url') . '/rhinoslider-1.05.css';              wp_enqueue_style('reset', $foo);         wp_enqueue_style('style', bloginfo('stylesheet_url'), array('reset'));         wp_enqueue_style('rhino', $bar, array('reset','style'));          }      Thanks!


Change Image Sizes for Mobile Theme

I've got a small challenge, right now I have an existing blog with images that formatted for desktop. I have a mobile child theme that shows the content for mobile. Is there a method to filter a different version of an image when the post displays? More succintly, could I force all images to show their 'medium' versions on the mobile child theme and the full version on the desktop version?


Display all submenus

For a custom jquery menu I'd like to show **all submenus** and hide / show each on demand. However my problem is to show all submenus in the first place. As of now I am managing the **first level** through the **admin menu** section: adding menu items to primary menu. Display works like so:               wp_nav_menu(        array (             'sort_column' => 'menu_order'             , 'container' => 'ul'             , 'menu_id' => 'main-nav'             , 'theme_location' => 'primary-menu'             , 'depth' => 1        )     );      The **second level** is (unfortunately) managed through the **pages section** with post_parent and menu_order. Therefore displaying it works like so:               global $post;     $has_post_parent = $post && $post->post_parent;     $post_id = $post ? $post->ID : -1;     $top = $has_post_parent ? array_pop( get_post_ancestors($post_id) ) : $post_id;     echo '

';     wp_list_pages(         array(             'child_of' => $top             , 'depth' => 1             , 'title_li' => ''         )     );     echo '

';      I already tried to loop through the main menu items (first-level) like the following, but that left me with empty submenus, even though the main items seemed correct at first glance:               $locations = get_nav_menu_locations();     $menu = wp_get_nav_menu_object($locations['primary-menu']);     $menu_items = wp_get_nav_menu_items($menu->term_id);     foreach($menu_items as $menu_item) {         $current_id = $menu_item->ID;         $is_current_class = ($current_id == $top) ? 'current-submenu' : '';              echo "
";         wp_list_pages(             array(                 'child_of' => $current_id                 , 'depth' => 1                 , 'echo' => 1                 , 'title_li' => ''             )         );         echo '
';     }      **EDIT** Even though I have fixed my initial solution, I am still very interested in a solution, where the menu can be **completely managed through the wp-admin menus section**.


Hide upload image fields for the different media upload popups

I am trying to change a few of the options in the `Set Featured Image` popup in the Wordpress admin. I can't seem to find anything that determines if the popup window is a `Featured Image` or an `Add Media` popup. I want to hide **Align** and **Sizes** fields for the `Set Featured Image` popup but have them visible for the `Add Media` panel. I am able to use the `attachment_fields_to_edit` filter to remove certain fields but not for the two different pop up box types. Is it possible to do this?


Posts 2 posts plugin loop echo the_title not working

I have a basic loop (a rough example of what I'm doing) of work, and want to show the client(s) the work was done for. Some work has clients connected and some doesn't. The work that doas have one or more client associated with it echos the clients paragraph, and echos it once for each connect client, so it is recognizing the connections. But it doesn't echo the title, and I cant't seem to figure out why. This is taken straight from the Posts 2 Posts github: https://github.com/scribu/wp-posts-to-posts/wiki/each_connected               <?php     $my_query = new WP_Query( array(         'post_type' => 'work'     ) );          p2p_type( 'work_for_client' )->each_connected( $my_query, array(), 'clients' );               while ( $my_query->have_posts() ) : $my_query->the_post(); ?>              <?php the_title(); ?>              <?php         // Display connected clients                   foreach ( $post->clients as $post ) : setup_postdata( $post );             echo '
clients:
';             echo the_title();              endforeach;              wp_reset_postdata();              ?>


Change The Meta-Description Of Home-Page?

I would like to use this script (found here), but it generates a blank page when I add it to my header.php                    if ( is_home() ) { ?>         <meta name="description" content="Your home page meta description" />     <?php } else {  ?>  <meta name="description" content="Your none homepage meta description" />      <?php } ?>       Thank's!


Display wordpress admin bar outside wordpress in Magento?

I have been trying to get the admin bar to show up under a magento install. I have tried eveything to get it. I can get the user, get the footer but nothing happens to get the admin bar up. from with in a 1column.phtml I called a                   <?php              echo $this->getLayout()->createBlock('core/template')->setTemplate('custom/userpanel.phtml')->toHtml();          ?>       and in that 'custom/userpanel.phtml' I added :                           require_once('/var/www/html/blog/wp-load.php');                 require_once('/var/www/html/blog/wp-blog-header.php');                 require_once('/var/www/html/blog/wp-includes/admin-bar.php');                 require_once('/var/www/html/blog/wp-config.php');                      show_admin_bar(true);                 wp_admin_bar_render();      with out anyluck. I'v tried using                           wp_footer();      but that doesn't get the bar, and even calling the head function doesn't work                           wp_head();                 wp_footer();      But althou i get all the head elements like the and what not which i don't want since it's in the , but still nothing. What is the way to set it up correctly? ## ------------------------------------------------------------------------ **EDIT** ## ------------------------------------------------------------------------ So I thought I'd get tricky and just grab the admin bar from WP and pull it over almost like jquery .load() but at php runtime. This is what i did, but here is the odd part, it fails cause it thinks I'm not loged in? Again in 'custom/userpanel.phtml' of magento which is pull over to WP so when in WP it's all fine but well as of yet nothing here.               <div id="wpfoot">         <?php                        //wp_head();              if ($userUsername ) {                      if ( strpos($_SERVER['REQUEST_URI'], '/blog/') === FALSE ){                               $dom = new DOMDocument();                     $dom->validateOnParse = true;                     $dom->loadHtml(file_get_contents("http://domain.xxx/blog/"));                     echo $dom->getElementById('wpfoot');                      }else{                     wp_footer();                 }             }              //          ?>     </div>


Trying to the deduce shortcode from a function

I have a theme where the wysiwyg button to insert the shortcodes is not appearing. I am trying to manually type in the shortcode that would output the tabs that I need. I am looking at the function that generates the shortcode to try deduce what that might be. The function is                   function display_tabs(){              var code        = '[tabs ';         var tab_names   = '';         var tabs        = '';         var tab_index   = 0;              $('.shortcode-dynamic-items').each( function(){                  $(this).children('.shortcode-dynamic-item').each( function(){                      tab_index++;                      tabs += '[tab id=' + tab_index + ']';                      //input loop for extra attrs                 $(this).children('#options-group').find('.attr').each( function(){                          if( $(this).attr('data-attrname') == 'tab_name' ){                              tab_names += 'tab' + tab_index + '="' + $(this).val() + '" ';                     }                      });                      // if the shortcode has content                 if( $(this).find('#shortcode-content').length > 0 ){                          tabs += $(this).find('#shortcode_content').val();                      }                      tabs += '[/tab]';                  })         });              code += tab_names + ']' + tabs + '[/tabs]';              return code;     }      I have tried a few attempts and have the tabs showing on the page but the content of the tabs is not showing and not toggling between them               [tabs 1 2 3]     [tab]Content for tab one goes here.[/tab]     [tab]Content for tab two goes here.[/tab]     [tab]Content for tab three goes here.[/tab]     [/tabs]      Is it possible to work out exactly what it should be from the function?


How to make the 'delete' button inactive on some categories?

As currently there's no way to declare any new custom post format in WordPress (3.9.1), is there a way I can make the 'delete' button on some categories inactive, so that the Editor can't remove them, and I can call them where necessary with their IDs without any hustle.   ![delete button in categories](http://i.stack.imgur.com/2rFwM.png) I just want it for some specific Categories only -- not for all.


url_to_postid redirected posts

i wanna url_to_postid some urls, it work pretty fine but when it come to auto- redirected posts it fail to return postid. here is my example urls:               http://animup.net/anime/kuroko-no-basket-2/      auto redirect into: (wordpress redirect old slugs into new slugs-like kuroko-no-basket-2 => kuroko-no-basket-2nd-season)               http://animup.net/anime/kuroko-no-basket-2nd-season/      but when i try this:               $url='http://animup.net/anime/kuroko-no-basket-2/';     $postid = url_to_postid( $url );       it return failure ( 0 ); * * * after more search i found _wp_old_slug meta, here is my custom function to return postid of redirected posts:               function url_to_postid_oldslug($slug){     $args = array(         'post_type' => 'any',         'numberposts' => 1,         'meta_key' => '_wp_old_slug',          'meta_value' => $slug     );          $posts=get_posts($args);          if ($posts){         return $posts[0]->ID;     }else{         return 0;      }