Create hierarchical menu for custom taxonomy meta field

I've created a custom fields for a custom taxonomy. All works fine so far, I can save, edit and display these fields. Now I want to display these fields in the admin menu as a hierarchical menu like categories. Some help would be nice : ) Here is my current code for the simple form field.
              <?php _e('Job'); ?>     	              <input type="text" name="term_meta[job]" id="term_meta[job]" size="25" style="width:60%;" value="<?php echo    $term_meta['job'] ? $term_meta['job'] : ''; ?>">
         <?php _e('Job'); ?>
      Best regards Edit: I ended up using the Pods Framework to create taxonomy meta fields.


query_posts pagination will always show identical content

Anyone here see why my pagination won't work? I can get "previous page" to show up, but when navigating to "page-2", the content will stay identical to the content on "page-1".               <?php     /*     Template Name: Generic Trips Template     */     ?>     <?php get_header(); ?>                  <?php get_template_part( "beforeloop", "page" ) ?>                                         <?php $types = $post->post_name; ?>                <?php if (have_posts()) : ?>          <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts(array( 'post_type' => 'trips', 'types' => $types, "posts_per_page" => 5)); ?>             <?php while (have_posts()) : the_post(); ?>                                            <article id="post-<?php the_ID(); ?>" class="post">
          <?php endwhile; ?>          <?php if(function_exists('wp_pagenavi')) : ?>
                 <?php wp_pagenavi(); ?>
             <?php else : ?>
<?php next_posts_link(__('« Older Entries')); ?>

<?php previous_posts_link(__('Newer Entries »')); ?>
             <?php endif; ?>          <?php endif; wp_reset_query(); ?>                                 <?php get_template_part( "afterloop", "page" ) ?>           <?php get_footer(); ?>


Working with multiple values and metaboxes

I have multiple values I need to be able to punch into a meta-box on the post edit screen. EX: I am working with set-list information for concerts.   1. Song 1   2. Song 2   3. Song 3 etc... I am always looking for efficiency in my code, here's the point: Do I just create a brand new id (i.e. song_1, song_2) for every song. Or is there a more condensed way to go about this. Here's a sample of how I would do it as of right now... which would seem like a lot of unncessary code, but then again I am not certain.               <?php        include('preset-library.php');          $meta_box['post'] = array(          // default values, will change to more descriptive values later              'id' => 'post-format-meta',           'title' => 'Additional Post Format Meta',             'context' => 'normal',                    'priority' => 'high',         'fields' => array(             array(                 'name' => 'Song 1',                 'desc' => 'Setlist Song 1',                 'id' => 'song_1',                 'type' => 'text',                 'default' => ''             ),             array(                 'name' => 'Song 2',                 'desc' => 'Setlist Song 2',                 'id' => 'song_2',                 'type' => 'text',                 'default' => ''          // then additional songs                   )         )     );     add_action('admin_menu', 'plib_add_box');     ?>


Sync Local site and Distant site

I want to manage my WP site in local, then sync it to my git, and then automatically deploy it. In fact, I already have my site in production, and trying to make it work in local. The fact is I can make it work in local, but every link send me to the distant domain : mydomain.com instead of managing localhost. How should I manage it??? Tx


Creating an option for writing a post without an author attribution for a group blog on Wordpress

I'm developing a group blog on wordpress (first time working with it) and the client has requested that a 'None' option be added where an item can be posted without a "by" attribution. So basically there would be one article / excerpt template for attributed author's posts and another for the none option where the byline would just be the date posted without the "by [author name]." Is this possible with wordpress? Thanks!


What are examples of large sites running WordPress?

One of the sites I currently maintain have approximately 2000 individual pages, broken down into departments and other such categories. Some of these pages contain "dynamic" content, such as a list of documents that are updated or added to on a monthly basis. We're thinking of migrating to WordPress for this site, but I'm trying to track down a list of sites that are serving the capacity of documents/information that we currently are to see how they do it, and maybe look at any plugins/themes they are running. Is there a list or does anybody know of sites at that capacity?


article pages not displaying on local instance of wordpress site

I've been given a wordpress site to do some development work on (I didn't do any of the initial development on it). I've installed it locally and am running it with XAMPP on Windows 7. I generated the database from a mysqldump file and I made the changes to wp-config to link to the database. After also changing the URL values in the wp_options table (they were set to the path of the live site) I got it working so that all the posts and settings are are showing up in the wp-admin console. Also on the frontpage the blog item excerpts list is populating correctly and all the layout and images are loading fine. The problem is that when I click through to an article it returns a 404 object not found error. The URL path to the article page looks to be correct. Would really appreciate it if anyone had any suggestions on what may be wrong and what I need to do get the article display pages working. I figure it must still have something to do with an incorrect base URL path being set somewhere, but can't find any other places where it would need to be changed Thank you!


Exposing data using a custom Wordpress API

I'm attempting to create an API through Wordpress exposing some of my back-end data. I've come to the conclusion that I cannot have a stand alone page (plugin) exposing this data because Wordpress is always attempting to call it and it had be be behind some sort of action hook. My solution was to create an AJAX call w/o an event to trigger it but a URL. In the theme functions.php file I created two action hooks:               add_action('wp_ajax_nopriv_do_ajax', 'ajax_return_catalog_info');     add_action('wp_ajax_do_ajax', 'ajax_return_catalog_info');      With my method here:               function ajax_return_catalog_info() {              switch($_REQUEST['fn']) {            case 'ajax_call_1':               // do ajax method 1 here                     echo json_encode($output);               break;            case 'ajax_call_2':               // do ajax method 2 here               echo json_encode($output);               break;         }     }      Now to call the AJAX through a web browser with the following URL:               http://mywebsite.com/wp-admin/admin-ajax.php?action=do_ajax&fn=get_brand&id=579      This seems to return JSON which is what I expect but my browser doesn't seem to know it is JSON because it is missing some header information usually returned from the JavaScript I've omitted. My question to the community is if there is a better way to do this?   Am I going about this the wrong way? Much Appreciated


How to programmatically add elements in a custom menu

In my WP custom menu, one item has a dropdown list below it that lists all instances of some CPT. The only way I know to do that is by creating the list somewhere else in the DOM with PHP and then moving that list right inside the custom menu item with Javascript. Problem: this requires Javascript. Is there a way to do the same thing by "hacking" the function that builds the custom menu so that, when the menu gets created by PHP, it already incorporates this lists of CPT instances?


Sub folder CSS that's read by Admin panel

I'm in the process of creating a theme that will have several different setup options based on input from the administrator. One of the options will be to have a Zurb or Basic type layout. I'm working with SCSS and want to have my stylesheets in a separate sub folder from the main theme files, cleanliness aside this is the easiest way for me to build/upload the files using my configuration of Sublime Text. I've been able to accomplish this easily enough and tell WP where to find the CSS folders for the specific setups. But WP STILL requires me to have a style.css document in the root of the theme or the admin panel will tell me the theme is broken. I realize this is due to WP looking for the Theme Header information located in the style.css/index.php files. Is there a way to tell Wordpress to look else where for the Theme Header info? I know you can `@import` the CSS files into this main style.css easily enough. I however would prefer that the style.css file in the main folder not exist entirely. Is there a function call / hook / filter / ect. that can be used to tell the WP admin panel that the main template/stylesheet files are actually in a different sub folder? All of the other articles I've read on the subject will explain how to do the `@import` feature into the main style.css file, or suggest using `stylesheet_directory_uri();`. Both of these methods still require you to have a style.css in the root folder. I haven't seen a suggestion that actually addresses forcing WP to handle it differently. Even if this means editing the core (which is something I normally would never do) I'm fine with that. I just want to know how. The solutions I mentioned above will solve my problem if all else fails.


How to use wp_schedule_event in a class?

This is first time that I tried the OOP method of writing an application. I don't quite understand it yet. Currently I have this cron hook:               if( !wp_next_scheduled( 'my_cron_hook' ) ) {         //schedule the event to run daily         wp_schedule_event( current_time( 'timestamp' ), 'daily', 'my_cron_hook' );     }     add_action('my_cron_hook',array($this,'do_daily_job'));      It seems that it can't use `if` within a class directly. Do I need to put the entire code above into the `__construct()` function? Also, I found this in WordPress `wp_schedule_event` documentation.               function my_activation() {         if ( !wp_next_scheduled( 'my_hourly_event' ) ) {             wp_schedule_event( current_time( 'timestamp' ), 'hourly', 'my_hourly_event');         }     }     add_action('wp', 'my_activation');      What dose 'wp' hook here means? I have never seen this in the hook API. Should I wrapped my cron code (above) in a function and put this 'wp' action in the `__construct()` function, like this?               function __construct() {         add_action('wp', array($this,'my_activation'));     }          function my_activation() {         if( !wp_next_scheduled( 'my_cron_hook' ) ) {             //schedule the event to run daily             wp_schedule_event( current_time( 'timestamp' ), 'daily', 'my_cron_hook' );         }         add_action('my_cron_hook',array($this,'do_daily_job'));     }


ID Conditional User Contact Methods Not Saving

I'm working on a plugin which adds fields to the contact methods on the user profile page. It checks to see if the user is added to the plugin database and returns 1 if he is. This works and the plugin only shows the contact fields to the users who are added by it won't let them save changes in the contact field.               add_filter('user_contactmethods', 'contactmethods');          function contactmethods($user_contactmethods){     global $wpdb;     global $profileuser;     $id = $profileuser->ID;     $table  = $wpdb->prefix . "table";     $myrows = NULL;     $myrows = $wpdb->query($wpdb->prepare('SELECT 1 FROM ' . $table . ' WHERE id = %d LIMIT 1', $id));         if($ba_myrows == 1){             $user_contactmethods['option'] = 'link';         }         return $user_contactmethods;     }


Query by custom dates in UNIX Time

I actually have a custom date registered in UNIX Time in my database like this: meta_key : custom_date meta_value : 1322697600 and the type of the meta key is a longtext I would like to retrieve specific post according to the year of this custom_date I would like something like this :               $args = array(         'paged' => $paged,         'posts_per_page' => 10,         'post_type' => 'custom',         'post_status' => 'publish',         'meta_query' => array(         array(                     'key'=>'custom_date',                     'value'=> '2010'                 )     );      Anyone knows how to convert the custom date in Date in the query and get only the year of this date?


How to set classname for <li> tag in wordpress menu?

I am using.               <?php wp_nav_menu($args); ?>      to get menu from WordPress. It returns the menus with `<ul> and <li>` structure.   How can i set class name for every `<li>` tag uniquely.


Add function to add element on all page

I would like to add a function to add for example a link in the top and in the bottom of all my pages. The best would be to create a plugin in order to activate or disable it. Thank you so much.


htaccess and htpasswd

im trying to lock my admin panel from my users with adding htpsswrd file to wp-admin folder. but also i want my users can edit their profiles. so i create this file (htaccess) AuthName "Username and password required" AuthUserFile ...../wp- admin/.htpasswd Require valid-user AuthType Basic Order deny,allow Allow from all satisfy any which works but, now when i try to access profiles, the site still askes password but also i can login. i think there are more files behind. anyone know profile.php is using which files behind other than (user- edit.php)|(profile.php)|(users.php)


email notification to specific email adress

i was creat a custom post type. now i need to send specific email notification! is possible to send email notification of some Post Type to specific user?


Modifying Custom Post Type after registration (will it affect content?)

I have a CPT (defined in `functions.php`) that I have set to as non- hierarchical. A lot of content has already been uploaded into the database. If I change the definition to `'hierarchical' => true`, will the change affect any of the posts in that CPT?


wp_mail isn't making the from header correctly

So I've got a couple of different plugins which I'm attempting to change the from address of the email header. I've tried using the filters, but it's simply sending the email as the admin user account on the site.               add_filter( 'wp_mail_from_name', 'my_mail_from_name' );      function my_mail_from_name( $name )      {          return "My Name";      }           add_filter( 'wp_mail_from', 'my_mail_from' );      function my_mail_from( $email )      {          return "test@dev.dcac.co";      }       I've tried setting an array, and passing that to wp_mail directly. And that doesn't work either.               $header[] = 'From: "test" <test@dev.dcac.co>';     $header[] = 'Content-Type: text/plain'."\r\n";      Can anyone see what I've done wrong here? I'm stumped.


Changing Atom feed read frequency

Thanks coders for your help on this site. I admin a radio station site that displays current Artist/Title playing which is read from an atom feed. In the past I have used a piece of Flash code, but it's too heavy and not supported on other devices. I'd like to use the WP RSS plugin, but the update frequency is not adequate. I have tried inserting (1 at a time) the following in my child theme functions.php file: > From RSS feed not Refreshes > > add_filter('wp_feed_cache_transient_lifetime', 'my_rss_interval'); function > my_rss_interval( $seconds ) { return 10; } and: > From http://www.techytalk.info/change-wordpress-rss-widget-refresh-interval/ > > add_filter('wp_feed_cache_transient_lifetime',create_function('$a', 'return > >20;')); Neither seem to update the displayed data as desired. Is there something I'm missing? Thanks


How to install cool javascript feature in Wordpress?

Im trying to install this menu http://tympanus.net/codrops/2013/08/13/multi- level-push-menu/ on my Wordpress site.However the javascript can not be loaded.Here is my murkup I used the menu as menu.php, i called this using `<?php include (TEMPLATEPATH . '/menu-bar.php' ); ?>` in index.php and the markup

All Categories

                                 Devices

Devices

                                             Mobile Phones

Mobile Phones

Super Smart Phone

Thin Magic Mobile

Performance Crusher

Futuristic Experience

                                             Televisions

Televisions

Flat Superscreen

Gigantic LED

Power Eater

3D Experience

Classic Comfort

                                             Cameras

Cameras

Smart Shot

Power Shooter

Easy Photo Maker

Super Pixel

                                 Magazines

Magazines

National Geographic

Scientific American

The Spectator

The Rambler

Physics World

The New Scientist

                                 Store

Store

                                             Clothes

Clothes

                                                         Women's Clothing

Women's Clothing

Tops

Dresses

Trousers

Shoes

Sale

                                                         Men's Clothing

Men's Clothing

Shirts

Trousers

Shoes

Sale

                                             Jewelry

                                             Music

                                             Grocery

Collections

Credits

                                                                        The only js feature that worked in my site just.http://tympanus.net/codrops/2010/06/02/smooth-vertical-or-horizontal- page-scrolling-with-jquery/ and now I am getting frustrated Can someone help me resolve this? sorry if my english so bad, thanks


TinyMCE - Insert media at the beginning of post

I want to modify TinyMCE in WordPress so that it inserts media (image etc.) always at the beginning of post contents. For this I need to change the cursor position to the beginning, insert media and possibly restore old cursor position. I am not sure how to achieve it. Please advise.


Adding custom post type archives to a WordPress menu

Is there a way (besides adding a Custom Link) to add a custom post type archive to a menu in WordPress? If it's added using a custom link (e.g. /cpt- archive-slug/), WordPress does not apply classes like `current-menu-item` to the list element, which presents challenges when styling the menu. If the custom link contains the entire URL (e.g. http://site.com/cpt-archive- slug/), those classes are added. However, that's probably not a 'best practice'.


Wordpress and Htaccess

Removing RewriteBase / from my htacess has sped up my site which is still working correctly. Is it really required and what is it for?


Something is filtering my shortcodes... Can't figure out what

Something seems to be filtering out my shortcodes. I'm not sure what or where, and I've looked just about everywhere trying to find it. Is there anything I can do to find out what filters are being applied before output is generated so I can try and see where the culprit is? I've already read through all the likely code, and disabled all the plugins, but still nothing.... Thanks!


Recommend a flexible lightbox that allows an image or HTML to be used

Can anyone recommend a flexible lightbox plugin that allows the popup lighbox to use an image and/or HTML? I want to overlay some sort of help instructions on top of my WP home page. Thanks!


wp_nav_menu() custom container and container_id

So today I started work on my first Wordpress theme and so far it's been a lot of fun. However, I have had difficulty in getting wp_nav_menu() to do what I want. Here's what I want:

Home

About

           Looking in the documentation, I would expect the following call to do what I want:               <?php wp_nav_menu(array( 'container' => 'nav', 'container_id' => 'topnav' )); ?>      But instead I get this:

Home

About

      To me it looks like my custom parameters are being ignored as the output from `wp_nav_menu()` is exactly the same. Is there something I need to turn on somewhere to enable this or is there something else going on? **EDIT** Curiously, if I change `menu_class` it alters the div's class (I expected the div to be the container) but changing `menu_id` does nothing. **EDIT 2** Even going into nav-menu-template.php and changing the defaults for container, container_id, container_class, menu_id does nothing. Changing menu_class to yyy will change the div's class from menu to yyy.


Is there a way to implement a commenting system such as that on medium or sitepoint in WP?

Both Medium.com and SitePoint allows users to comment on individual paragraphs. I'm not sure how it's implemented but is there a way to do something similar in wordpress? See screenshots below to see what I mean: ![Medium comment system](http://i.stack.imgur.com/B469A.jpg) ![SitePoint comment system](http://i.stack.imgur.com/lBL89.jpg) Thanks in advance for the help.


Best way to add custom / magic / flutter fields into RSS feed

Using Wordpress 3, creating write panels with Magic Fields, how do I add custom fields to my RSS feed? For example, I have an 'image of the day' write panel, with a custom field for the photo credit. How can I include all that as part of my feed? Thanks.


what is option_name on database that store the information of current initiate widget in frontend sidebar?

what is option_name on database that store the information of current initiate widget in frontend sidebar ?


Is there a plugin that will post directly to your facebook feed and twitter account? I'm not looking for a plugin that adds buttons to my post for different services, I want the plugin to publish the content directly to Twitter and Facebook upon the first publish. I've tried Wordbook (x2), Wordbooker, and a ton of others, doesnt seem like it should be that hard. Any ideas?


Create search form in menu as in Twenty Fourteen theme

I would like to replicate the search form in Twenty Fourteen's menu. I have tried to hide and show the search button with jQuery. My Problem is that the button is not sliding from left to right and right to left it just "appears" and "disappears". If someone could take a look it would be great! This is my HTML code
                         <form class="form-inline" id="forminline"role="form">

                                                                  <?php _ex( 'Search for:', 'label', 'categories', 'lagnogruppen' ); ?>                                 <input style="display: none;" type="search" class="form-control form-search" id="box-search" placeholder="<?php echo esc_attr_x( 'Sök på hemsidan …', 'placeholder', 'lagnogruppen' ); ?>" value="<?php echo esc_attr( get_search_query() ); ?>" name="s">
                     </form>
      and this is my simple jQuery code               jQuery(document).ready( function(){          jQuery('#btn-search').click( function(event){         event.stopPropagation();         jQuery('#box-search').toggle();     });          jQuery('#box-search').click(function(event){         event.stopPropagation();                 });          jQuery(document).click( function(){         jQuery('#box-search').hide();     });      });


Use different categories for a custom post

I was wondering if it was possible not to mix the categories across my different custom post ?


Add file while inserting post

Is it possible while adding post through wp_insert_post also upload images to this post from url.


How not to show author's name when sharing blogposts on Facebook?

(I'm a WP-Beginner and have to work on a WP-Blog someone else build & heavily modified, so please bear with me) On my WP-blog, I'm not showing the authors name on individual posts (or anywhere else). I'm using the following code in my single.php to let readers share posts on Facebook:               <a href="http://www.facebook.com/sharer.php?u=<?php the_permalink(); ?>&t=<?php the_title(); ?>"      target="_blank"      title="share this post on Facebook">

           this works great; however inside this shared information the author's name shows up. My clients don't want that. Is there any way to only share the actual content of the post, but not its author? Thanks in advance!


jQuery HoverIntent is not a function

I am working on a site that uses jQuery for a number of functions but I am having a repeating error: > hoverIntent is not a function I have referenced similar questions on this forum and they almost universally say that it is due to multiple references to jQuery, however, I have carefully reviewed the code and the source code and cannot find any duplicate references. There is just this one in functions.php               // Load jQuery     if ( !is_admin() ) {        wp_deregister_script('jquery');        wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"), false);        wp_register_script('jquery', ("js/jquery.dropmenu.js"), false);        wp_register_script('jquery', ("js/jquery.dropmenu2.js"), false);          wp_enqueue_script('jquery');     }      I would really appreciate another set of eyes to help pinpoint and resolve this dilemma.


Some shortcodes breaking after AJAX call

I have a content slider that displays my Academic posts on my website. Some of my posts have shortcode in order to display an accordion menu and some columns. I am using AJAX to fetch the posts and display them, but when the posts with shortcodes are displayed, the shortcode functionality is gone (ie. Accordion menu isn't clickable) Another issue I suspect is that when I pass the post content through the_content filter it breaks the shortcodes. Has anybody run into this before or know a fix? Here is the function that AJAX is calling to get the previous post:               function getprev()     {         global $post;         $post = get_post($_POST['id']);         $prevPost = get_previous_post();         $prevcontent = apply_filters('the_content', $prevPost->post_content);         $previd = $prevPost->ID;                   $emptyprev = checkprev($previd);         $emptynext = checknext($previd);              echo json_encode(array($prevcontent, $previd, $emptyprev, $emptynext));                   die();     }      And here is the AJAX call:                   setTimeout(function (){            $ajaxurl = "http://localhost/personal site/wp-admin/admin-ajax.php"       var data = {         "action": "getprev",         "id":currid       };       $.post($ajaxurl, data, function(response){                   var result = $.parseJSON(response);             $('#academiccontent').html(result[0]).animate({ 'opacity': 1 });             $('#post_id').attr("value", result[1]);       })      The plugin I'm using for the shortcodes is Olevmedia Shortcodes. Thanks again for any insight you guys can offer!


Why is my cookie not unsetting upon logout?

if (is_user_logged_in()){         if(!isset($_COOKIE['alertuser'])){             // set cookie             $timer = time()+86400;             setcookie('alertuser', '1' $timer);                  // show alert             function load_alert(){                 wp_register_script('alert', get_template_directory_uri() . '/js/alert.js', array( 'jquery' ));                 wp_enqueue_script( 'alert');             }             add_action('admin_enqueue_scripts', 'load_alert');              }     } else {             $timer = time()-86400;             setcookie('alertuser', '', $timer); // <-problem here     }      I'm trying to attach a js file only when a customer first logs in. Upon signing out the cookie should get deleted, but isn't. Why? (Maybe this is more of a php question that WP specific, if so, sorry for posting it here.)


Links from affiliate companies

I am very new to this and have recently set up a website to promote affiliate holiday companies. I am having trouble putting the code from distributive travel but every time I try and put it into the system it never shows in the page, could you give an 'idiots' guide into where I am going wrong?


Extending arrays in parent theme without completely overriding the files

I am new to all child-theming things and trying to override an array value which is declared in one of the php files. I also don't want to override the whole php file, because it has many other functions in that file that I don't want to duplicate. How can I do this? The `maintemplate-somefile.php` :               ...          $Icons = array(     ....     );          ...


Getting ID from ajax response of async-upload.php

Its a **wordpress+jQuery** question. Can't post it on stackoverflow because i believe it involves wordpress knowledge too. **What I am trying to achieve:** I am attaching the wordpress async media uploader on "add post" page metabox so user can upload lots of images simply drag and drop them into the uploader and don't have to insert them once at a time (see the image). ![image uploader](http://i.stack.imgur.com/zKRfn.jpg) I am saving the attachment ids on a post meta so user can attach one image to more then one post. **Question:** When the uploader send the upload request to the `async- upload.php` it sends back an html response which contains the whole form for adding title, caption, description for the attachment. Very first of the response comes with this:               <input type='hidden' id='type-of-106' value='image' />      You can see a full response here. My question is **how to I get the attachment id from that html response?** I am guessing I have to listen for any ajax response that comes from the `async- upload.php` then look through the response.


Three Column Loop

I have a theme that creates two columns of categories with child posts from that category. I've tried messing with the code that inserts the after two posts are listed, but it's not working (because I don't know what I'm doing). The current php renders as follows:

...

...

      I'd like it to render as:

...

...

...

      Here is the theme's code that renders the HTML:               $st_categories = get_categories($st_hp_cat_args);      $st_categories = wp_list_filter($st_categories,array('parent'=>0));     if ($st_categories) {     foreach($st_categories as $st_category) {      $st_cat_counter++;          if ((!is_int($st_cat_counter / 2)) && $st_cat_counter != 1) {      echo '

';} elseif ($st_cat_counter == 1)      { echo '
';}     echo '
';     echo '
 term_id ) . '" title="' .     sprintf( __( 'View all posts in %s', 'framework' ), $st_category->name ) . '" ' . '>' .     $st_category->name.'';     if (of_get_option('st_hp_cat_counts') == '1') {     echo '(' . $st_category->count.')';       }     echo '
';      Thanks in advance.


Getting all the users who have author privilege

Can anyone tell me how to get all the users who have author privileges by querying the DB in WordPress and order them by number of posts written by them. I use the following query to get all the users from DB:               $authors = $wpdb->get_results(         "SELECT ID, user_nicename from $wpdb->users ORDER BY display_name"     );


How do I make script load after jquery?

function load_my_script(){     wp_register_script( 'my_script', get_template_directory_uri() . '/js/myscript.js', 'jquery' );     wp_enqueue_script( 'my_script', 'jquery');     }     add_action('wp_enqueue_scripts', 'load_my_script');      myscript.js is loading before jquery, why? And how do I make it load AFTER jquery? Thanks.


How to make image in TinyMCE clickable

I'm trying to use the tinyMCE in the Wordpress front end and not using wp_editor() because I need the editor to be created through Ajax (something that a wp_editor can't handle as far as I know). Does anyone know where in the Wordpress core they create the functionality where an image within the tinyMCE textarea can be clicked to edit its settings? Alternatively, if you know of a way to make wp_editor work with Ajax, that would be awesome.


How to use control_callback when creating a widget via functions.php or plugin?

I've created a dashboard widget in my functions.php file. I want to have it be able to update some stuff in the database upon form submittal. According to the codex documentation, I should be handling my post submissions with the 4th argument of wp_add_dashboard_widget(), $control_callback. So I've created my handler function and included it in my functions.php file. When I have my form submit, nothing happens. I thought about it for a minute, and then I hooked the callback function to wp_dashboard_setup with add_action(); My call back function now runs, but its doing so regardless of whether I pass the control_callback function to wp_add_dashboard_widget() making me feel like my solution is kind of hacky. Am I doing this wrong and is there a better way to do tthis? Also, is my form supposed to submit anywhere fancy or can it just submit right back to where its drawn? Heres my full code:               function custom_dashboard_widget_coach() {             echo "
Finalize Game
             <form method='post'>
                 Class                 <select name='team' id='team'>                     <option value='5a'>5A</option>                     <option value='4a'>4A</option>                     <option value='3a'>3A</option>                     <option value='2a'>2A</option>                 </select>
                       <input type='submit' value='Report Game Result' />             </form>             ";         }              function custom_dashboard_widget_coach_handle()         {             var_dump($_POST);exit;              }              function add_custom_dashboard_widget_coach() {             wp_add_dashboard_widget('custom_dashboard_widget_coach', 'My Team', 'custom_dashboard_widget_coach', 'custom_dashboard_widget_coach_handle');         }         add_action('wp_dashboard_setup', 'custom_dashboard_widget_coach_handle');         add_action('wp_dashboard_setup', 'add_custom_dashboard_widget_coach');


Highlight static blog page link in header

I created a navigation bar like tab system for my header and I can get all but my news button to highlight on that page. The news is a static page for all of my blog/news post. Not sure if it's my code but if anyone has any ideas, much thanks to you.               <?php     $parent_title = get_the_title($post->post_parent);     ?>                      <?php                     $items = wp_get_nav_menu_items("main-nav");                     foreach($items as $item):                  ?>                 <a <?php  if($item->title == $parent_title){ echo 'class="active '.$parent_title.'"';}else{ echo 'class="'.$item->title.'"';} ?> href="<?php echo $item->url; ?>"><?php echo $item->title; ?></a>                 <?php endforeach; ?>


is_plugin_active() not properly returning true

I have a plugin activated and working, and I installed and activated another plugin I wrote to communicate with it. However when I run is_plugin_active() I get false returned - does anyone have any idea why and how to rectify it? EDIT: some basic code. I am in the admin area, and I'm trying to use the functions of the other plugin ultimately. But the initial check is quite basic:               if (is_plugin_active('Plugin2')) {         echo 'Thanks for installing Plugin2';     } else {         echo 'Please install Plugin2';     }      EDIT2: Per the codex, you do NOT need the filepath if you're using in the admin side. But I tried with the full path, as modified here, which also did not work.               if (is_plugin_active('Plugin2/Plugin2.php')) {         echo 'Thanks for installing Plugin2';     } else {         echo 'Please install Plugin2';     }


Strange permalink issue: can't rename /company-2/ to /company/

I created a page titled company. But the permalink turned it into /company-2/, trying to change it to just /company/ doesn't work. The website just has 8 pages and none is called company (don't know if company as page title is used in the past?). What can i do and what is the cause? Where should i look? Not afraid to use phpmyadmin ;) regards


Remove Post Custom Meta Box

I created a custom post type. When I click "Add new" for this post type, I see among other meta boxes a "Main Slider Item SEO" meta box. This SEO is superfluous. Can I remove it?               add_action( 'init', 'create_post_type' );     function create_post_type() {         register_post_type( 'main_slider_item',             array(                 'labels' => array(                                       'name' => __( 'Main Slider Items' ),                                       'singular_name' => __( 'Main Slider Item' ),                                       'menu_name' => __( 'Main Slider' )                             ),                             'description' => "A banner with a text and button",                             'public' => true,                             'exclude_from_search' => true,                             'show_in_nav_menus' => false,                             'map_meta_cap' => false,                             'supports' => array('title', 'thumbnail'),                             'has_archive' => false,                             'show_in_nav_menus' => false,             )         );     }      I also want to remove editing layout for this custom post type. In fact for this post type I am going to display only the excerpt on the mainpage and am not going ever to display the page of the post.


I need a "Choose from existing content" popin

I'd like to create a field that allows the admin to select from other existing post types. Specifically, I want to create an options box to choose which events display on the homepage. For now, I've just put a "on the homepage" checkbox on each event, but this does not help with ordering or reviewing the list of "featured" events. The ideal UX is a meta box added to only the homepage admin screen, that allows the user to add/remove existing events a list and reorder them before republishing the homepage. It would have an "add event" button, which when clicked, opens a post selector similar to the popin you get when you link text in the WYSIWYG. "Insert/edit link", "... link to existing content". I suppose I could just build my own popin, but I'd be happy to find out I could reuse this "post selection popin" that the link button uses.


Local to testing server now the category gives a page not found?

With my locally created WP theme i used the wrong category for some posts, so i changed it to another one. Everything worked ok. But on my testing website it gives me a 404 page not found. i just moved some posts from category our- products to category products. i also edited category.php with               elseif (is_category('our-products') || is_category('products')):                 get_template_part('loop', 'products');      mydomain.com/products just gives a 404 mydomain.com/our-products gives the posts not yet moved How do i fix this?? [edit] i already did the setting permalink trick by going to default and save. And made my custom settings again: /%category%/%postname%-%post_id%/ [edit] i renamed the WP's original uncategorized to products could this be the cause?


Sidebar Widget Registration without a name, how is it assigned to new named sidebar widget?

In my current theme version, I'm registering sidebars with names. However, in previous versions, I only had one sidebar and registered it without a name like so...               if ( function_exists('register_sidebar') )         register_sidebar(array(             'before_widget' => '
',             'after_widget' => '
',             'before_title' => '
',             'after_title' => '
',         ));      But now in my updated theme, I register several sidebars and give them all a name. However, when I update the old theme to the latest version, the sidebar widget that was registered without a name is seemingly getting arbitrarily assigned to one of the new "named" sidebars, but not the one I need it to. I need that unmamed sidebar widget to be reassigned to the one named "Sidebar" in the updated theme. Here are my new sidebar registrations...               if ( function_exists('register_sidebar') )         register_sidebar(array(             'name' => 'Featured_Home',             'before_widget' => '
',             'after_widget' => '
',             'before_title' => '
',             'after_title' => '
',         ));          if ( function_exists('register_sidebar') )         register_sidebar(array(             'name' => 'Featured_Inside',             'before_widget' => '
',             'after_widget' => '
',              'before_title' => '
',             'after_title' => '
',         ));          if ( function_exists('register_sidebar') )         register_sidebar(array(             'name' => 'Featured_Category',             'before_widget' => '
',             'after_widget' => '
',             'before_title' => '
',             'after_title' => '
',         ));          if ( function_exists('register_sidebar') )         register_sidebar(array(             'name' => 'Sidebar',             'before_widget' => '
',             'after_widget' => '
',             'before_title' => '
',             'after_title' => '
',         ));          if ( function_exists('register_sidebar') )         register_sidebar(array(             'name' => 'Home_PreFooter',             'before_widget' => '
',             'after_widget' => '
',             'before_title' => '
',             'after_title' => '
',         ));          if ( function_exists('register_sidebar') )         register_sidebar(array(             'name' => 'Inside_PreFooter',             'before_widget' => '
',             'after_widget' => '
',             'before_title' => '
',             'after_title' => '
',         ));


How to programatically set the post title of a CPT on wp-admin

I've been playing with custom post types & custom fields, using a combination of the `types` plugin and the `advanced custom fields` plugin, also having done the same manually. Occasionally I want to create a CPT where a `title` would be inappropriate - for example, an FAQ where I want two fields labelled `Question` and `Answer`. This does work without a title, however they all get saved as `(No Title)`. What I'd like to do is either set the `title` to the value of the `Question` custom field, or somehow define my own `title` field that I can label as I like. Does anyone have any pointers on how to acheive this?


Can a WordPress plugin or theme contain a virus?

Is it possible to write a virus in a form of a WordPress plugin/theme? Is it possible to:   * steal user data?   * damage existing WordPress installation?   * (optionally) self-spread the virus? Are there any existing cases of this kind of viruses?


I need to display a joomla table into a wordpress site

I need to display a database that is made in joomla, into a wordpress site. I tried to import CSV file, I get the data but display is wrong. I want to see the database in wordpress the same way I see it here http://www.conectandoatitlan.org/base-de-datos-de-proyectos any one has a clue on how to do this?


How to hook into Add New Member in BuddyPress

I have a hook into the WordPress Add New User process via an `add_action('user_register', 'doMyFunction');` hook. What results is that I am (Step 1) adding a new user through WordPress and then (Step 2) having to add the same user to BuddyPress in order to get the user fully activated in WP/BP with the proper role. I would prefer to just add a new user/member once through the Buddy Press Add User page and have it go through my hooked function. Is there a Buddypress hook I should change too on the hook I show above in order to eliminate the 1st step described in my process? Thanks for helping. **Expanding for better clarity** We do not use the BuddyPress signup process. We (as an Admin) setup new users ourselves. The reason is we have our own login authentication system that all users must pass through. So I have hooked into WP's `add_user` in order to (1) programmatically capture the user id I am creating and write it externally to our authentication systems' list of vald users and (2) send a custom email to the user newly created. Then I have to go into the BuddyPress admin page and setup the new user again so I can assign their role and let BP know they are good to go. I would much rather hook right into BuddyPress' add new user and do my external write and launch my custom email. I have tested and I know that the Add New User in BP adds it to WP as well. I just don't know what BP's hook is -- the one comparable to WP' s `add_user`. _Hope that clarifies._


Edit/revise option for authors to suggest improvement to posts

I have a multiple author blog with 300 authors. Is it possible to add a edit type of button where authors can suggest improvement to other authors published articles? If an improvement suggesting is added, the entry should only be visible to users with author permission and the original author of the article can make the decision of implementing the edit. This feature would be highly beneficial for content heavy sites. Do anyone knows if such plugin is available? Or an alternative solution?


List Table API - Safe to use?

Just curious what developers think about extending the `WP_List_Table` class for use on plug-ins. I am working on a plug-in that will show a list of users (ID, name, email) then pull data from another plug-in that created a subscription date and access level in the user meta table.   The plug-in will be in the admin area of WP and only available to administrators. I was hoping to use the class to be able to select multiple users and edit the data of multiple users at one time. Is the class safe to use in this case or should the table be re-created?


WPTouch - how to remove shortcodes or make shortcodes function

So as the title states - using WPTouch Mobile plugin (NOT Pro) I either want to make the shortcodes work as they should or remove them altoghether. Currently they render on the page as `[shortcode]` which is no good. I am good with a hack or any other solution.


Problem in disabling canonical 301 redirect

I need to disable canonical redirection of category slug. My url structure for a category page looks like > www.sitename.com/categorybase/categoryslug/subcategory/ Now when i change the categoryslug in the url to any other word, say `catslug`, it still takes me to the same page. I want this url to return a 404 page. My `.htaccess` file has the following:               # BEGIN WordPress      <IfModule mod_rewrite.c>         RewriteEngine On         RewriteBase /         RewriteRule ^index\.php$ - [L]         RewriteCond %{REQUEST_FILENAME} !-f         RewriteCond %{REQUEST_FILENAME} !-d         RewriteRule . /index.php [L]     </IfModule>     # END WordPress      I think that the solution is somewhere else as the same htaccess file is used on a different website and that site shows up a `404` page when i do the same stuff over there. Thanks.


Use external fonts in Wordpress stylesheet

I'm having a go at designing a premium WP theme, and I've found numerous plugins that allow you to load fonts from Google Web Fonts and other services. However, how do I let administrators actually configure the site-wide heading and body text fonts? **To clarify:** When writing a stylesheet, I need to type in the name of the fonts that will be used (e.g. `h1 { font-family: Cuprum }`. However, I want to be able to choose different fonts _for my CSS_ from my admin panel by picking from available Google Web Fonts. One option I can think of is using `font-family: HeaderFont`, `font-family: BodyFont`, etc. in my CSS, and then loading whichever fonts have been chosen under those names using `@font-face`, e.g.               @font-face {       font-family: 'HeaderText';       font-style: normal;       font-weight: 400;       src: local('Cuprum'), local('Cuprum-Regular'), url(http://themes.googleusercontent.com/static/fonts/cuprum/v3/sp1_LTSOMWWV0K5VTuZzvQ.woff) format('woff');     }      But that seems like quite a complex solution, and I haven't seen it done that way. What's the accepted way to do this?


What is the correct method for updating post content from a plugin?

I would like to create a plugin which updates the post's content in the Admin panel. For example, on the Edit post page, the user sees his draft content. If he clicks on a button from a meta box plugin, I want new HTML to be appended to the post content. Ideally without refreshing the page. Zemanta does this and I am trying to figure out the right method for achieving that effect. NOTE: I am brand new to coding with Wordpress, so please let me know if/how my question needs to be clarified further.


WordPress Retrieve Post by Title

The following code works brilliantly for retrieving certain pages, but I can't get it to retrieve POSTS by name. I'd like exactly the same code, but to retrieve posts rather than pages. Any help appreciated.               <?php         function get_my_content($page) {             $my_id = $page;             $post_id = get_post($my_id, ARRAY_A);             $content = $post_id['post_content'];                  return $content;         }     ?>              <div id='test'>         <?php              $page = get_page_by_title('testpage');             echo get_my_content($page);         ?>     </div>


How to remove a plugin filter's priority on specific loops (custom queries)?

So I have a review plugin that is automatically sorting all my site based on the score rating. It seems here are the filters the plugin is applying globally:                   //Post sorting         $sort = get_option('rs_sort');         if ($sort == 'rating') {                  add_filter('posts_fields', 'rs_weighted_fields');             add_filter('posts_join', 'rs_weighted_join');             add_filter('posts_groupby', 'rs_weighted_groupby');             add_filter('posts_orderby', 'rs_weighted_orderby');              } else if ($sort == 'comments') {             add_filter('posts_orderby', 'rs_comments_orderby');         }          }      These filters are taking priority over the whole site. Even some custom loops where I want it to use the wordpress default (sort by newest) and others where I want to sort by random. Specifically here is an example loop that I am trying to make:               <?php $custom_query = new WP_Query('category_name=FreaturedIndex&orderby=rand'); ?><?php while ($custom_query->have_posts()) : $custom_query->the_post(); ?>      Right now, its just sorting by rating and ignoring the orderby=rand. Is there some code that can be applied to remove these filters by applying it to specific queries? Thanks for the help!


Problems with Wordpress in subfolder, posts show a blank page

I have wordpress installed in a subfolder and using permalinks but I'm getting a blank page when I try to access to any post. This is what I have in the root folder .htaccess:               RewriteEngine On     RewriteCond %{HTTP_HOST} ^(www.)?site.com$     RewriteCond %{REQUEST_URI} !^/wordpress/     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule ^(.*)$ /wordpress/$1     RewriteCond %{HTTP_HOST} ^(www.)?site.com$     RewriteRule ^(/)?$ wordpress/index.php [L]      And this is what wordpress put in the subfolder .htaccess:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      I'm using custom permalinks with `/%postname%.html`, the posts have the permalink correctly but when I try to access it shows only an empty blank page.


Only display link to author social media when it exists

I've added the following code to my functions.php to expand the functionality of the user profile page and be able to add links to the social media of the authors.               function my_new_contactmethods( $contactmethods ) {     // Add Site     $contactmethods['mysite'] = 'My Site';     // Add Google Plus     $contactmethods['google_plus'] = 'Google Plus';     // Add Behance     $contactmethods['behance'] = 'Behance';     // Add Twitter     $contactmethods['twitter'] = 'Twitter';     //add Facebook     $contactmethods['facebook'] = 'Facebook';     return $contactmethods;     }     add_filter('user_contactmethods','my_new_contactmethods',10,1);      On the author.php I call the links like this:               <a title="Follow me on Twitter" href="<?php the_author_meta( 'twitter', $author_id ); ?>">     <a title="Follow me on Facebook" href="<?php the_author_meta( 'facebook', $author_id ); ?>">     <a title="Follow me on Behance" href="<?php the_author_meta( 'behance', $author_id ); ?>">     <a title="Follow me on Google+" href="<?php the_author_meta( 'google_plus', $author_id ); ?>">      The problem with this solution is that it shows the image and link even if the author has not filled the corresponding field. Would it be some easy way to just echo the links that have been previously filled?


Count custom post type based on two meta data

I am trying to count my custom post type called 'appointments' that match two meta data values . The meta data keys are 'location' and 'timestamp' So in english my query is: How many appointments are scheduled at Location at Time How can this be done?


Ajax Plugin Not Echoing Response

I have created a plugin that will submit a form via ajax. Below is the php function.               add_action('wp_ajax_nopriv_audience_intel', 'audience_intel_ajax');     add_action('wp_ajax_audience_intel', 'audience_intel_ajax');     function audience_intel_ajax() {         $likeit = $_POST['likeit'];         $response = $_POST['response'];         $postid = $_POST['postid'];              add_option( 'testing_form_like', $likeit );         add_option('testing_form_response', $response);              global $wpdb;         $tablename = $wpdb->prefix . "intel";              $newdata = array(             'radio' => $likeit,             'feedback' => $response,             'postid' => $postid         );                      $wpdb->insert (             $tablename,             $newdata         );              $result = "
Finished successfully!
";         // json_encode($result);         echo $result;     }      Here is my script.               jQuery(document).ready(function($) {     $('.audience_intel_container .close').click(function(){         $('.audience_intel_container').fadeOut('fast', function(){              });     });          $('.audience_intel_container button').click(function(){         console.log('clicked');         var formdata = $('#audience_intel_form').serialize();         $.ajax({             type : "post",             dataType : "html",             url : audience_intel_js.ajaxurl,             data : 'action=audience_intel&'+formdata,             success: function(response) {                 alert(response);                 $('.audience_intel_container').html(response);             }         })     })        });      The form data is added to the database correctly, but I am not able show an output message after the request is complete. I have tried both return, echo, and echo json_encode in the ajax function. I appreciate any insight.


Analyze uploaded images to get colour values

I have a site that uses large background images, uploaded by the user, that has content on top of it. I'd like to be able to analyze the image and apply a class to the body that will have black text if the brightness of the image is very light, and white text on a dark background. I think having it populate a meta field attached to the image with the analyzation results upon upload would be the easiest, but haven't found anything that does that sort of sorcery. How would one apply such an analysis to the image meta upon upload?


Show box only on edit post

I've made a video custom post type and on the edit page I've placed a meta box where I display a shortcode associated to the post, to make it easier for the user. However, I wish the shortcode and/or the box to be visible on the edit post page only and not on the new post page, where it's not yet relevant - what am I looking for here? I have this nagging feeling I've done this/something similar before but just can't think of what to search for. ETA: This is what I did with the help I got below, might be useful to someone else too:               add_action( 'add_meta_boxes', 'my_video_add_custom_box' );     function my_video_add_custom_box() {         if (get_post_status( $post->ID ) != 'auto-draft') {             add_meta_box(                 'my_video_shortcode_custom_box',                 __( 'Shortcode', 'my_video' ),                 'my_video_shortcode_custom_box',                 'my_video', 'side', 'default'             );         }     }      Works like a charm, thanks!


portfolio custom type tags support

I have **portfolio-post-type.php** which contains this:               <?php     add_action( 'init', 'create_portfolio_post_type' );     function create_portfolio_post_type() {         register_post_type( 'portfolio',             array(                 'labels' => array(                     'name' => _x( 'Portfolio', 'post type general name', 'flowthemes' ),                     'singular_name' => __( 'Portfolio Item', 'post type singular name', 'flowthemes' ),                     'add_new' => _x('Add New', 'portfolio', 'flowthemes' ),                     'add_new_item' => __('Add New Portfolio Item', 'flowthemes' ),                     'edit_item' => __('Edit Portfolio Item', 'flowthemes' ),                     'new_item' => __('New Portfolio Item', 'flowthemes' ),                     'view_item' => __('View Portfolio Item', 'flowthemes' ),                     'search_items' => __('Search Portfolio Items', 'flowthemes' ),                     'not_found' =>  __('No portfolio items found', 'flowthemes' ),                     'not_found_in_trash' => __('No portfolio items found in Trash', 'flowthemes' ),                      'parent_item_colon' => '',                     'menu_name' => _x( 'Portfolio', 'flowthemes' ),                      ),                 'public' => true,                 'exclude_from_search' => true,                 'has_archive' => false,                 'supports' => array('title', 'author', 'custom-fields', 'revisions', 'page-attributes', 'post-formats', 'comments', 'trackbacks', 'excerpt' ),                 'rewrite' => array('slug' => 'portfolio')             )              );         register_taxonomy('portfolio_category','portfolio',array(         'hierarchical' => true,         'labels' => array(             'name' => _x( 'Portfolio Categories', 'taxonomy general name', 'flowthemes' ),             'singular_name' => _x( 'Portfolio Category', 'taxonomy singular name', 'flowthemes' ),             'search_items' =>  __( 'Search Categories', 'flowthemes' ),             'popular_items' => __( 'Popular Categories', 'flowthemes' ),             'all_items' => __( 'All Categories', 'flowthemes' ),             'parent_item' => null,             'parent_item_colon' => null,             'edit_item' => __( 'Edit Portfolio Category', 'flowthemes' ),              'update_item' => __( 'Update Portfolio Category', 'flowthemes' ),             'add_new_item' => __( 'Add New Portfolio Category', 'flowthemes' ),             'new_item_name' => __( 'New Portfolio Category Name', 'flowthemes' ),             'separate_items_with_commas' => __( 'Separate Portfolio category with commas', 'flowthemes' ),             'add_or_remove_items' => __( 'Add or remove portfolio category', 'flowthemes' ),             'choose_from_most_used' => __( 'Choose from the most used portfolio category', 'flowthemes' )         ),         'show_ui' => true,         'query_var' => true,         'rewrite' => false,         ));     }     ?>      What I want to make is to add also support for tags, to be able to add also tags on portfolio post in the back-end. How can I accomplish this ?


Get the Current Blog URL of User in Multi Site?

I have a WordPress Multi Site installation and several blogs. On the frontpage (domain.com) I have a login form and when the user is logged in, it shows two links at the moment (Admin Panel and Log out). But I also want to include a link that goes to the current blog site of the user, eg: blog.domain.com.
<a href="<?php <some code> ?>">Show blog


Wordpress auto picking featured image

In the past when I created a news post, the featured image was automatically assigned to the post when I uploaded an image in the post. But now, that doesn't work anymore :( The only thing that changed was that I installed certain plugins for testing and deactivated them afterwards. First I found out that I didn't add theme support for featured images. Added this code in my functions.php:               // This theme uses post thumbnails     add_theme_support( 'post-thumbnails' );       I can now see the featured images in the back-end and add it manually. But how come it was automatically in the past? I'm using WordPress 3.7.1–nl_NL with my custom theme and the following plugins:   * All In One SEO Pack   * Google XML Sitemaps   * Jetpack by WordPress.com   * Limit Login Attempts   * SI CAPTCHA Anti-Spam   * WP Anti Spam


Apply Filters Causing a 500 Internal Server Error

I have a custom post type and need to display it in a certain way. I would like other posts to display as normal. When I tried to use the following code to accomplish this, I get a 500 Internal Server Error.               global $post;               //do this only for custom type       if (!(get_post_type()=='customt'))       {         $rawContent = $post->post_content;         $formattedContent = apply_filters('the_content',$rawContent);         echo $formattedContent;         return;       }      I have googled around and found a lot of things regarding .htaccess but I don't think that is the case here. If I comment out the apply filters line (`$formattedContent =...`) and echo raw content, the post displays, but without formatting of course. What am I doing wrong when I am trying to apply a filter?


Remove admin menu

Ho do you remove admin menu items and dissable acces for users below admin ? The right way...               // 1 - Remove Menu Items     function my_remove_menu_pages() {         if ( !current_user_can( 'administrator' ) ) {             remove_menu_page('options-general.php'); // Settings             remove_menu_page('tools.php'); // Tools             remove_menu_page('upload.php'); // Media             remove_menu_page('plugins.php');             remove_menu_page('themes.php');             remove_menu_page('edit-comments.php');             remove_menu_page('edit.php?post_type=page');             remove_menu_page('link-manager.php');         }     }     add_action( 'admin_init', 'my_remove_menu_pages' );          // 2 - Redirect users if they visit links from non visible menu items     function no_permission_admin_redirect() {         if ( !current_user_can( 'administrator' ) ) {             if (stripos($_SERVER['REQUEST_URI'],'tools.php') !== false                  || stripos($_SERVER['REQUEST_URI'],'options-general.php') !== false                  || stripos($_SERVER['REQUEST_URI'],'upload.php') !== false                  || stripos($_SERVER['REQUEST_URI'],'media.php') !== false                  || stripos($_SERVER['REQUEST_URI'],'edit-comments.php') !== false                  || stripos($_SERVER['REQUEST_URI'],'post-new.php?post_type=page') !== false                  || stripos($_SERVER['REQUEST_URI'],'post-new.php') !== false                  || stripos($_SERVER['REQUEST_URI'],'media-new.php') !== false                  || stripos($_SERVER['REQUEST_URI'],'edit.php?post_type=page') !== false                  || stripos($_SERVER['REQUEST_URI'],'link-manager.php') !== false) {                  wp_redirect(get_option('siteurl') . '/wp-admin/index.php?permissions_error=true');              }         }     }     add_action('admin_menu','no_permissions_admin_redirect');               // 3 - Show error message to users if they visit links from non visible menu items     function no_permissions_admin_notice() {              echo "

".__('You do not have permission to access that page.')."

";         }          function no_permissions_show_notice() {             if($_GET['permissions_error']) {                 add_action('admin_notices', 'no_permissions_admin_notice');             }         }     add_action('admin_init','no_permissions_show_notice');      This code works but unfortunately users can access some of the pages by typing the url on their browsers without getting any error or redirection. Is there a simple way to remove menu items and redirect users to the dashboard if the visit the page by typing the url on their browsers without using plugins ?


Custom post type 404 error on "default" or "numeric" permalinks

I wrote a plugin for WP.org that uses a custom post type with the slug "reading-list" and I cannot view mysite.com/reading-list/ when I have either the "default" or "numeric" permalinks setting in wp-admin. Does anyone know why this would be, i.e. why it only affects these two settings? I use flush_rewrite_rules() after registering the custom post type in the plugin and I checked all of the parameters according to the Codex but nothing seems to help. Thanks.


get_the_term_list & url

I have 2 custom post type and i want to link them together with an **url** from the first one and a **image** from the second one. I can get the **title** and the **url** of my taxonomy like that : ( CPT = 'traductions', TAX = 'nom-origin' )               $url = get_the_term_list($post->ID, 'nom-origin');      But i don't want a title, i just want to link this **url** with this **thumbnail** that i can get like that : (CPT = 'livre')               <?php         $args = array(             'post_type' => 'livre',             'orderby' => 'date',              'order' => 'ASC'          );         $livres = new WP_Query( $args );         if( $livres->have_posts() ) {             while( $livres->have_posts() ) {                 $livres->the_post();     ?>     <?php                global $post;          <a href="<?php echo $something ?>"><?php the_post_thumbnail(array('thumbnail_size_w'), array('class' => 'alignleft')); ?>      So, what should i write instead of _$something_ ? Or i am completely wrong about the whole approach ? I have been stuck on this for a while so any help would be appreciate. thanks


Setting locale based on URL in Wordpress - a better way than this?

I've been searching and experimenting for so long trying to figure this out. How do I set the language on a per request basis in Wordpress? Currently I'm using this:               function mysite_lang_support()     {         return array(             'en' => 'en_GB',             'zh' => 'fr_FR'         );     }          function mysite_lang_endpoints()     {         $langs = mysite_lang_support();         foreach ($langs as $lang => $isoCode) {             add_rewrite_endpoint($lang, EP_PERMALINK | EP_PAGES | EP_ROOT | EP_CATEGORIES);         }         add_rewrite_tag('%lang%','([a-z]{2})');     }     add_action('init', 'mysite_lang_endpoints');          function mysite_set_locale()     {         $requestLang = basename(filter_input(INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_STRING));         $supportedLangs = mysite_lang_support();         if (array_key_exists($requestLang, $supportedLangs)) {             return $supportedLangs[$requestLang];         }         return current(array_keys($supportedLangs));     }     add_action('locale', 'mysite_set_locale');      Is this an advisable way to go about this?


If post has ANY term attached to it, get the first one only

I am developing a theme that has several custom taxonomy that act as radio buttons. How do I write a conditional that does... `if(post_has_any_terms($post->id, 'custom-taxonomy')) { echo $term; }.` I feel like this should be so simple, but nothing that I have tried works. Thanks!


Is it possible to enqueue the Youtube API script or does it have to be inline?

The code below is the main part of a function in my functions.php which returns a `div` and `script` which ultimately output a youtube API iframe to the template where the code had been called from. At the moment it's working fine; however I would like to enqueue the javascript, or at least move it out of my PHP code. I tired moving it to my main JavaScript file ( which is enqueued in the footer ) but it doesn't work when I move it there. **_Edit** : I had hardcoded the vars to avoid having to use `wp_localize_script` so as to out of the picture_. Surely there's a better way ( or WordPress way ) of doing this?               $return = '

                            ';          return $return;


Why is this page using the homepage template and not the one it should?

* * * One of my clients has installed a theme where when a visitor enters their username and email to register as a new user they get shown a link to download a custom report file. This was working fine on my clients test installation, but now they've converted the site to a live site the download link doesn't show and instead the page uses the homepage template... I'm stumped as to why it's happening so any advice would be great. Here's the test page Here's the live page Here's a jsFiddle of the PHP code


How to query posts for custom post type with featured image for first 2 post?

I am trying to write a custom post query for a specific post type in a way where only first 2 thumb/featured-image will be shown & other will be just title & other metadata (i.e the picture in attachment). It would be great if someone help me regarding this issue with proper guideline. Thanks in advance. ![attachment](http://i.stack.imgur.com/JAh7Z.png)


Fetch post meta in the same query as the main loop

I have a custom post type "staff" and each as a custom field "_staff_purpose" (describing its function). I would like that the archive-staff.php template display all staff members, sorted by their _staff_purpose, so that i can then loop through the result using the _staff_purpose as a heading. The result i'd like to have is like this:               ID  |   post_title    |  _staff_purpose     -----------------------------------------     1   |   Tracy Chap.   |  administrator     -----------------------------------------     2   |   John Doe.     |  teacher     -----------------------------------------     3   |   Robert Smith  |  teacher     -----------------------------------------      The raw SQL should be this:               SELECT * FROM `bj_posts` p          LEFT JOIN (         SELECT post_id, meta_value as purpose         FROM `bj_postmeta` pm          WHERE  `meta_key`='purpose'         ) pm ON p.ID=pm.post_id     WHERE p.`post_type`='staff' AND p.`post_status`='publish'     ORDER BY purpose ASC, post_title ASC      I've tried this:               add_action( 'pre_get_posts', 'fetch_staff_people' );          function fetch_staff_people( $query )     {              if ( is_page_template('archive-staff.php') && $query->is_main_query() )         {             $query->set( 'post_per_page', '-1' );             $query->set( 'meta_key', '_staff_purpose' );             $query->set('orderby', 'meta_value title'); // sort by purpose, then by staff name.             $query->set( 'order', 'ASC ASC' );                       } else {                     return;             }              return $query;     }      The query seems to work but the custom field value does not appear in the loop.


How to speed wordpress disqus plugin loading?

When I'm testing my blog page loading time in pingdom tools and webpagetest.org, both of these services display disqus plugin takes 5-10 seconds to load. Are there any way to speedup its page loading time? Are there any way to load disqus only if the visitor only need to comment or view the comments? ![enter image description here](http://i.stack.imgur.com/mjYAl.png)


Can't sort order of wp_query with 2 meta keys

I'm trying to display custom post types by excluding the sold ones but also by displaying them in alphabetical order from the county meta_key. I'm trying to use pre_get_posts but I'm not sure that I doing it correctly Here is my code on a page template:               $args = array(         'post_type'      => 'property',         'orderby'        => 'meta_value',         'meta_key'       => 'random_775',         'order'          => 'ASC',         'posts_per_page' => 100,     );           $view_all_properties_sorted = new WP_Query( $args );       and here is the function in my functions.php file:                add_action( 'pre_get_posts', 'sort_view_all_properties' );      function sort_view_all_properties($view_all_properties_sorted) {          $view_all_properties_sorted->set('meta_key', 'sold');         $view_all_properties_sorted->set('meta_value', 'true');         $view_all_properties_sorted->set('meta_compare', '!=');      }      When I use this code, I'm getting a 404 error when I add this line:               $view_all_properties_sorted->set('meta_key', 'sold');      Is it because meta_key has already been set? Any suggestions on what I may be doing wrong?


linking pic previews to posts

This site is a twentytwelve child theme, and it's located at www.travelwithcastle.com I'd like to link the pictures on the post previews (on the homepage) to the actual post -- right now when i click the picture, it is not linked. Only the title text is linked. I like that, and I'd like to also link the picture preview. Does anyone know how i can do this? My guess is that it has to do with how i code the permalink in the content.php file, though I couldn't swear by that. To that end, here is my content.php code as it currently looks.               <?php     /**      * The default template for displaying content. Used for both single and index/archive/search.      *      * @package WordPress      * @subpackage Twenty_Twelve      * @since Twenty Twelve 1.0      */     ?>              <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>             <?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
                 <?php _e( 'Featured post', 'twentytwelve' ); ?>
             <?php endif; ?>                              <?php the_post_thumbnail(); ?>                 <?php if ( is_single() ) : ?>
<?php the_title(); ?>
                 <?php else : ?>
                     <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?>
<?php the_date(); ?>
                 <?php endif; // is_single() ?>                 <?php if ( comments_open() ) : ?>
                         <?php comments_popup_link( '' . __( 'Leave a reply', 'twentytwelve' ) . '', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
                 <?php endif; // comments_open() ?>                       <?php if ( is_search() || is_home() ) : // Display Excerpts for Search and Homepage ?>                  <?php else : ?>
                 <?php the_content( __( 'Continue reading →', 'twentytwelve' ) ); ?>                 <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:', 'twentytwelve' ), 'after' => '
' ) ); ?>
             <?php endif; ?>                           <?php if ( is_singular() && get_the_author_meta( 'description' ) && is_multi_author() ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries. ?>

                             <?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentytwelve_author_bio_avatar_size', 68 ) ); ?>

<?php printf( __( 'About %s', 'twentytwelve' ), get_the_author() ); ?>

<?php the_author_meta( 'description' ); ?>

                                 <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">                                     <?php printf( __( 'View all posts by %s →', 'twentytwelve' ), get_the_author() ); ?>

                 <?php endif; ?>


Why is my get_post_meta always empty

I made this action hook which will send an email to the users every time a new post in the custom post type "events" is made.               function email_members($post_id) {     global $wpdb;          $usersarray = $wpdb->get_col("SELECT user_email FROM wp_users");     $users = implode(",", $usersarray);          if( ( $_POST['post_status'] == 'publish' ) && ( $_POST['original_post_status'] != 'publish' ) ) {         $subject = 'Event Reminder';              $post_url = get_permalink($post_id);         $post_title = get_the_title($post_id);         $event_date = get_post_meta( $post_id, 'ch_event_date', true );              $message = "APAC Ministries Event Reminder for: ".$post_title."\n\n";         $message .= "Date: ".$event_date;              wp_mail($users, $subject, $message );       }     }          add_action('publish_th_events', 'email_members');      However, the `$event_date` is always empty. I tried running this code in a different file and it works:               global $post;     $test = get_post_meta($post->ID, 'ch_event_date', true);     echo $test;      I have also tried using `global $post;` and using `$post->ID` as the ID. I have also tried getting the terms, and it displays fine. I'm just having trouble displaying the meta. Any alternative solutions are welcome. Thanks!


Displaying just one post from each category on archive page

My categories look like this. Each has one or more posts               -Main Category     --Main Category Sub-category 1     --- 1 post here     --- 1 post here     --Main Category Sub-category 2     --- 1 post here     --- 1 post here     --- 1 post here     --Main Category Sub-category 3     --- 1 post here      When viewing Main Category archive page I only want the first post from each of the subcategories. So in my case I would only have 3 posts. Using twentythirteen theme. Don't want to change too much. I hope it can be done with query_posts.                       <?php /* The loop */ ?>             <?php query_posts($query_string . '&??????'); ?>             <?php while ( have_posts() ) : the_post(); ?>                 <?php get_template_part( 'content-category', get_post_format() ); ?>             <?php endwhile; ?>


removing the featured image from the post

This is a twentytwelve wordpress child theme, and it's located at www.travelwithcastle.com I'd very much like to delete the enormous preview pic that shows up on top of the actual post page. It's the feature pic I chose to be the preview pic for the homepage. I love the picture, but that picture is already within the post content, so there is no need for it appear above the post as well. I took at look at content.php, thinking that would be the place to look, but I'm a little stumped. Perhaps I'm misunderstanding the code, but it seems to me that any change I make there will also affect the actual preview of the post on the homepage. I thought I was removing the image for example by deleting the thumbnail, but that removed the image completely from the homepage preview. Can anyone explain how I can instruct the site to not show the preview pic at the top of the post, while keeping it on the homepage as a preview? Perhaps I need to structure the files differently? to be clear, the picture i choose as the featured image for the post (the one that shows up on the homepage preview) also shows up at the top of the actual post, before the title. I'd like it not to be there since it's already in the post content. I did peruse your past questions, and while a lot of very similar questions are asked, this one is not. Many thanks. Kelly content.php is posted here for your reference:               <?php     /**      * The default template for displaying content. Used for both single and index/archive/search.      *      * @package WordPress      * @subpackage Twenty_Twelve      * @since Twenty Twelve 1.0      */     ?>              <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>             <?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
                 <?php _e( 'Featured post', 'twentytwelve' ); ?>
             <?php endif; ?>                              <?php the_post_thumbnail(); ?>                 <?php if ( is_single() ) : ?>
<?php the_title(); ?>
                 <?php else : ?>
                     <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?>
<?php the_date(); ?>
                 <?php endif; // is_single() ?>                 <?php if ( comments_open() ) : ?>
                         <?php comments_popup_link( '' . __( 'Leave a reply', 'twentytwelve' ) . '', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
                 <?php endif; // comments_open() ?>                       <?php if ( is_search() || is_home() ) : // Display Excerpts for Search and Homepage ?>                  <?php else : ?>
                 <?php the_content( __( 'Continue reading →', 'twentytwelve' ) ); ?>                 <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:', 'twentytwelve' ), 'after' => '
' ) ); ?>
             <?php endif; ?>                           <?php if ( is_singular() && get_the_author_meta( 'description' ) && is_multi_author() ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries. ?>

                             <?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentytwelve_author_bio_avatar_size', 68 ) ); ?>

<?php printf( __( 'About %s', 'twentytwelve' ), get_the_author() ); ?>

<?php the_author_meta( 'description' ); ?>

                                 <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">                                     <?php printf( __( 'View all posts by %s →', 'twentytwelve' ), get_the_author() ); ?>

                 <?php endif; ?>


Require Custom Taxonomy for Custom Type

I have created a fairly unexciting custom type (Event) and an equally vanilla custom taxonomy (Venue). Whenever a user creates an Event, I want them to be required to either create a new Venue or select an existing Venue. How can I make this a required field when publishing? It seems like the sort of thing that should be rather trivial but I've been going up and down http://codex.wordpress.org/Function_Reference/register_taxonomy and haven't found anything obvious. Am I going about this in the wrong way? Any assistance would be appreciated.


Number Unread comments/posts

I am having trouble getting an unread posts and comments plugin to work on my site. I have multiple authors which I am trying to control with role scoper. Only certain people can access certain categories. Unfortunately none of the plugins for number of comments/posts seem to work with rolescoper defined roles; the changes still show up, but the user can't click them... Anyway, maybe it would be easier to create a plugin where a user clicks a button next to each post they read, with a 'unread post' counter that begins only when the user registers... Hm... Is this possible? It would be a useful feature to have because then if someone doesn't want to read a post right away, they can come back to it later... maybe even tag it in a separate way so that there's a section on the site where they can read all the stuff they tagged...


How would you feed Custom Post Types to Facebook?

I have this dilemma whereby I'd like FB-Connect or a similar tool to automatically push custom data found in Custom Post Types to Facebook. Here's an example (it only works because it's a manual workaround). The final result is/should be this: ![Result with manual workaround](http://i.stack.imgur.com/eBn9H.jpg) I can achieve that by placing this in the header:               if (is_singular('adoptions')) {     echo '<meta name="description" content="';     echo 'New Pet for Adoption! ' . $name . ' is a ' . $age . ' year old ' . $gender . ' ' . $breed . ' who needs a home!';     echo '" />';}      It's great because I can exactly influence the excerpt (but the downside is everything needs to be done manually). Not so with Custom Post Types and auto- publish where the empty content of the post type then only shows an image and '...', in other words giving the reader no clue what this is about. What I'm thinking is that I can either:   * Modify the automatic publisher from WP to push content in this manner (not even sure where to start), or.. and this seems easier;   * Create a custom RSS feed which is then imported into the page via an RSS app? The added benefit is that the feed can be used elsewhere too. What does the dream-team think? :) Thank you!


Possible to create a paginated blogroll archive?

I'd like to have a separate blogroll archive whereby I can display them more or less in the same manner as posts/post types. IE: an archive which can be paginated and also with links to the separate categories to filter. How to create an archive which can be paginated and: what are the url's of my blogroll categories? Kind regards


Pagination on taxonomy archive pages breaks

I've created archive pages for all my taxonomies (taxonomie-{taxonomy- name}.php) and this works fine. The slug of my taxonomies are the same as the slug of it's post-type. This makes it possible to create neat hierarchy in the url, ie: when post-type 'products' has 'type' as a taxonomy with the values book, cd and dvd. post-type1 has the slug 'product' and taxonomy1 has the same slug: 'product'. This way I can list the taxonomie-archives in the following way: products/book products/cd products/dvd and this works great. However: the pagination works on the products archives but on the products/{type} archive it gives a 404. Any clue? Code of the taxonomy template is as follows:                 <?php get_header(); ?>

<?php previous_posts_link(''); ?>

<?php next_posts_link(''); ?>

                       <?php while ( have_posts() ) : the_post(); ?>         <?php         $post_type = get_post_type( get_the_ID() );         ?>             <article class="hentry publicaties artikel <?php echo $post_type ?>">                                  <?php the_title( '
' . the_date('d.m.y', '', '', false) . '', '
' ); ?>

<?php $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large'); echo ''; the_post_thumbnail('thumbnail', array('class' => 'artikel-thumbnail')); ?>
                     <?php $this_excerpt = get_the_excerpt(); echo $this_excerpt; ?>... <a href="<?php the_permalink(); ?>" class="lees-verder">Lees en luister

         <?php endwhile; ?>

<?php previous_posts_link(''); ?>

<?php next_posts_link(''); ?>

       <?php get_footer(); ?>


Background Updates Not Happening

I have some sites which are not updating with the background updater. I installed the Background Update Tester plugin and everything looks fine. Currently they are at 3.9 but they are telling me that 3.9.1 is available. Am I mistaken in thinking that the 3.9.1 update should be applied automatically?


using $wpdb to get custom post type with term

I'm trying to get the title of the first custom post type with a specific term in a taxonomy.   But I'm not great at SQL so therefor not great with using `$wpdb`. Here is my code:               $posts = $wpdb->get_results("         SELECT ID, post_title          FROM $wpdb->posts          LEFT JOIN $wpdb->term_relationships         LEFT JOIN $wpdb->term_taxonomy         WHERE post_type = 'property'         AND $wpdb->terms.name = 'Locked'         AND $wpdb->term_taxonomy.taxonomy = 'status'     ");     echo $posts[0]->post_title;      Any suggestions on how to get the title of the first custom post type of 'property' with the term 'Locked' in the taxonomy 'status'? **Update**   This is how I attempted this using `WP_Query`:               <?php         $args = array(             'post_type' => 'property',             'tax_query' => array( array(                 'taxonomy' => 'Status',                 'field' => 'slug',                 'terms' => $term             ))         );              $loop = new WP_Query( $args );              while ( $loop->have_posts() ) :             $loop->the_post();             the_title();             echo '
';             echo get_the_post_thumbnail();             the_content();             echo '
';         endwhile;     ?>      where `$term` is `"Locked"`. What I really need is a way that I can query by multiple terms and taxonomies in an array or multiple arrays.   Any hints?


Wordpress Frontend Check If Current User Is Administrator

I am trying to check if current user that accessing a page if administrator using `current_user_can()`, but it is not working and returning this message instead:               Fatal error: Call to undefined function wp_get_current_user() in /home/******/public_html/wordpress/wp-includes/capabilities.php on line 1329      What can I use to check whether a user is admin or not in the front end? I am using a separate php file to do it, like this:               <?php         if(current_user_can('manage_options')) {         // do stuff here..         }     ?>      I know it can be fixed by adding this line of code `require_once('pluggable.php')` in the second line of file named `capabilities.php`. But I don't want user bothering about it.


How do I remove weird characters in text?

Help, my site is suddenly populated with weird characters, like this: > â€œDo what you love and do it often,â€ â€œIf you donâ€™t like your job, > quit,â€ and â€œTravel often; Getting lost will help you find yourself.â€ What do I do to remove it? Link to Website. ![Here's an example.](http://i.stack.imgur.com/i6Nx1.jpg)


Use have_posts() with array of post results retrieved by $wpdb->get_results

I don't know if I'm retarded, crazy or just plain genius or not, but I've decided to use tags as a way to link content site-wide (a big ol' many-to-many relationship website for archiving various aspects of a huge project). Unfortunately, this means that some custom post types utilised by some plugins don't exactly link up properly with other objects (posts, pages, etc.) as they use other taxonomies (and in the case of media 'attachments' they don't use taxonomies at all, unless I pork in a plugin to fix that -- which there is and I'm using it and it uses a different taxonomy...). Actually, some plugin types have specific taxonomies hard-coded in so I can't really go through and change their core code or else a plugin upgrade would wipe all my hard work. To address this fragmentation and perception of long, arduous work of hacking the plugins and/or Wordpress, I initially used the Advanced Taxonomy stuff with `WP_Query` and that was working well, until I found I needed some extra information with meta tags and to even change the default ordering based on the `post_type` and `meta_values` specific to the `post_type`. So now I'm going the shorter "long, arduous" work route and have written my own custom SQL builder to fetch the objects based on the tag/meta relationships with the custom ordering per `post_type` as required by the project. One thing I'd love to do, so I can use both this new custom query and the existing `WP_Query` methods, is find out some way to wrap the custom query results in a `WP_Query` class so I can use `have_posts` and `the_post` -- basically all the nice `$post` stuff. `$wpdb->get_results` only gives me a plain array of results and I'm not so clued up on `WP_Query` and `$wpdb`'s niggly bits; can `WP_Query` let me do some funky custom selects, joins and then order based on the columns selected? Can I just flick an SQL query to `get_posts()` to get the `WP_Query` wrapper and its glorious Loop functionality? It's late and I'm oh-so-close to solving this riddle, so I'd appreciate your help, Obi Wan Kenobi; For the moment the simplest solution looks to be the `have_posts()` functionality applied to a plain array of post results retrieved via the `$wpdb->get_results` function, to then easily and seamlessly initiate a WP Loop on that set of post results. If you may know of any other way to do this (Custom Queries, mayhaps?) I'm all ears.


Add a Fancybox automatically to post type "post" images

Currently, on my homepage (which is a list of posts), if you click an image it opens in the same window as a full size image. I'd like to change it so that when a user clicks said image it opens into a Fancybox pop-up. I've got my Fancybox code, which works on my Custom Post Type pages (because I've been able to set the class/rel for these images):               // fancybox     jQuery( document ).ready( function( $ ) {         $("a img.fancybox").fancybox({             'transitionIn'  :   'elastic',             'transitionOut' :   'elastic',             'speedIn'       :   600,              'speedOut'      :   200,              'overlayShow'   :   true,             'overlayOpacity':   0.7,             'overlayColor'  :   '#333',             'titlePosition' :   'over'         });     });      But I don't know how to add Fancybox to the code that WordPress automatically gives to its linked images in posts:

Amazonas Magazine - now in English!

      Any suggestions? Is there a way I can do this using just the jQuery selector on Fancybox, or will I have to implement a WP filter to amend post-inserted image links so that they include a specific id/class? Thanks in advance,


WordPress Install Issue, Receive Warnings But Successful Install

I get the following warning on my installation. It installs successfully but I'm not sure whether or not these issues are vital to my blog. I'm using IIS, anyone know why I'm having these issues and what I can do to get rid of these errors? > Warning: unlink(C:\Inetpub\wwwroot\bozack/5505560414c7fd72a81f63.tmp) > [function.unlink]: Permission denied in C:\Inetpub\wwwroot\bozack\wp- > admin\includes\misc.php on line 585 > > Warning: unlink(C:\Inetpub\wwwroot\bozack/web.config) [function.unlink]: > Permission denied in C:\Inetpub\wwwroot\bozack\wp-admin\includes\misc.php on > line 585


What plugin should I use for booking events and receiving payments?

What plugin would you recommend for booking events and receiving payments. I have approx 70 classes per year in a swim club that people can sign up for.


Customizing the Subject Field in WordPress' Notification Emails?

Can I customize and edit the subject field in the "Password Reset" notification mails sent from our multisite blogs? I have tried some plugins like My brand login and white label CMS etc. But I can't edit this in password reset notifications . Does anyone help me understand how to edit it ? **Update:** Today I tried with another installation .But it is not making any change.The Word 'wordpress' in from mail address is still there.I have added - `add_filter ( 'wp_mail_from_name', 'my_filter_that_outputs_the_new_name' );` to the code given by Doug .Am I missing something?Could you help me to solve this?


Load Javascript for a widget Worpress

I want to load a special Javascript File just when the widget is loaded in the sidebar. Where do I have to put my `wp_enqueue_script(...)` lines?               class controller_widget extends WP_Widget {         function controller_widget() {             $this->color = "red";                  $this->dir = plugin_dir_url(__FILE__);             $widget_ops = array('classname' => 'controller_widget', 'description' => __('Benutzerfreundlicher Controller zur eingrenzung von Objekten'));             $control_ops = array('width' => 350, 'height' => 400);             $this->WP_Widget('controller_widget', __('Controller'), $widget_ops, $control_ops);                  // At the moment I load the code here, but I want to proof that it is just loaded when the widget really is shown in the sidebar.             }         }              function widget( $args, $instance ) {...}     }      Thank you!


How to store post meta in an array

I am creating a plugin, where the user can create forms with an unlimited amount of fields. I would like to store each field the user creates as an array in a post meta field. What would the code look like for this please? (This is the first plugin i've ever created). @Wyck previously touched on this topic below, but didn't outline the complete code. I'm quite confused about the requirements. Link to this topic discussed previously Thanks!


jQuery in header or footer

From my reading it seems there is a good case for loading scripts like jquery and dependencies into the footer as a preference if possible; however 2 things confuse me which. Firstly the default for wp_enqueue_script() is to put the script in the footer and second (and possibly related) there is a line from the codex > Note that you have to enqueue your script before wp_head is run, even if it > will be placed in the footer. Is this to say that even if the script is set to load into the footer it still loads early on and so we loose several of the advantages of footer placement? **Edit** - Just in case the above incorrect statement confuses anyone in future. I realised since that I'd been reading the codex wrong and that the default for `wp_enqueue_script()` is **NOT** to put the script in the footer


Most viewed post of custom post type

Im using following code for getting most populer post with thumbnail.I have a custom post type taxonomy (Talks). Custom post types(video) have 6 category. But my code not working. It just getting 1 post.But i have 10 post. How can i fix it?                   <?php          $args = array(         'post_type' => 'video',         'showposts' => 10,         'order' => 'DESC',         'meta_key' => 'post_views_count',         'orderby' => 'meta_value_num',              'tax_query' => array(             array(                 'taxonomy' => 'Talks',                 'field' => 'id',                 'terms' => array(                     371,                     372,                     373,                     374,                     375,                     376                 )             )         )     ); //      $loop = new WP_Query($args);     while ($loop->have_posts()):         $loop->the_post();     ?>
                                    <a class="box-over" href="<?php         the_permalink();     ?>">                                                     <?php         if (($video_thumbnail = get_video_thumbnail()) != null) {             echo "";         }     ?>
<a href="<?php         the_permalink();     ?>"><?php         the_title();     ?>

                                        <?php     endwhile;     ?>