Get post content intro text on category.php?

For some categories on my site there's introduction text that needs formatting (so using the category description isn't an option) and placing at the top of `categories.php`. I've added a post ID to the category description field thinking I could then use `get_post()` to load the relevant post's content then list all the posts in the category underneath. However it doesn't work and breaks the loop. The error I get is > Fatal error: Only variables can be passed by reference in /wp- > content/themes/pap_01/loop.php on line 39 and line 39 is               $secintro = get_post(439);     print_r($secintro);      I've tried resetting post data and rewinding the loop after this but nothing helps. And `print_r($secintro);` does show anything either.


Echo the Last Child Taxonomy only (not parents)?

I have a question about how to echo a child taxonomy only. My taxonomy is location. I have a parent location and child locations like so: London (parent)   * West London (Child)     * Chelsea (Grandchild) I need to echo just the last term (in the case above, it's Chelsea). At present the code I am using is: $terms_as_text = get_the_term_list( $post->ID, 'location', '', ', ', '' ) ; echo strip_tags($terms_as_text); Unfortunately, this echo's both parens/superiors as well. How would i display just the last child term? Many Thanks in advance Paul


Hide editor while keeping add media button in custom post type

How do I remove Editor in custom post type keeping the Add media button. When I used as following in custom post type declaration, it removes the Add Media button and I don't need editor in my post type.               'supports' => array( 'title', 'thumbnail' ),      Thanks


If a Script has been enqueued but not registered can I still removed it?

There is a plugin that's conflicting with mine when the user loads the admin pages of my plugin, therefore I want to deregister and remove the conflicting script on these pages. Here is the code for the conflicting script:-               add_action( 'admin_head', 'function_name' );          function function_name() {     if ( is_admin() ) {         wp_enqueue_script(             'script_name',             plugins_url('/js/some_javascript_file.js', __FILE__ )         );     }     }         So In my code I check to see if the user is in our admin pages and if so I try to deregister the script as follows:-               function admin_hc_deregister_conflicts() {      wp_deregister_script('script_name');     }          add_action('admin_head', array($this,'admin_hc_deregister_conflicts'),11);      The problem is that the script is still being loaded in my admin area causing a lot of problems! Please can someone advise:- i) Is it possible to remove a script that has been enqueued but not registered? ii) What can I add to my plugin to remove this script from being loaded in our admin pages so that there are no conflicts? Thanks in advance!


Add more levels to menu

I have a menu with more than three levels. The issue is that the menu just shows until level 2, the next child levels don't show. I am using Maya template and WordPress 3.5.2 What i have to do and what file i must edit to make this work? Thanks for your help. EDIT Go to wp-content/themes/templatename/ and then in header.php go to his line               'depth' => apply_filters( 'yiw_main_menu_depth', 3),       Just change the number and done!


Admin-ajax.php is dying "0" without processing function

I am trying to learn how to process AJAX requests in Wordpress the correct way. To do this I am adapting this tutorial to create a super simple AJAX request to place the ID of a post (from a link) into my page content. **The Logic**   1. When the `#our-work a` links are clicked _[js]_   2. Get the post ID (from the `data-id` attribute) & store it as `postID` variable _[js]_   3. Pass `postID` via an AJAX (using the WP's `admin-ajax.php` file) _[js]_   4. The `example_ajax_request` function will pick up the ID & simply echo it _[php]_   5. If successful, append the server response to the `#hero` div. I realise this has no benefit but once I have that working I will amend the function to serve a real purpose. **My Code** Here is a copy of the function I have created in the plugins folder:               wp_enqueue_script( 'my-ajax-request', plugin_dir_url( __FILE__ ) . 'acl-plugin.js', array( 'jquery' ) );          wp_localize_script( 'my-ajax-request', 'MyAjax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );          function example_ajax_request() {         if ( isset($_REQUEST) ) {             $postID = $_REQUEST['postID'];             echo $postID;         }         die();     }     add_action( 'wp_ajax_nopriv_example_ajax_request', 'example_ajax_request' );      And here is a copy of the JS file               jQuery(document).ready(function($) {         $('#our-work a').click( function() {             var postID = $(this).attr("data-id");                  $.ajax({                 url: MyAjax.ajaxurl,                 data: {                     'action':'example_ajax_request',                     'postID' : postID                 },                 success:function(data) {                     $('#hero').append( "Well this seems to work" + data );                 },                 error: function(errorThrown){                     console.log("This has thrown an error:" + errorThrown);                 }             });             return false;         });     });      **The Problem** Upon clicking the link the JS does fire but yields the following response:               <div id="hero">         Well this seems to work 0     </div>      Using an alert I know the ID is being picked up before the AJAX request. So the problem is in my function. To find out more, I (temporarily) tweaked WP's `admin-ajax.php` file, so that I could find out which `die();` was yielding the response of "0". It is the very last one in the file which I thought wouldn't fire as I have a `die();` command in my own function. Can someone please point out where I am going wrong?


WooCommerce product permalinks

How can I do to have my product links as mysite.com/name-of-my-product? I tried the WooCommerce options but I can't remove the base string before the product`s name from the url structure. Thanks


Custom display post query by categories

I have like 50k posts in wp_posts and they not belong to any categories. Now i want to add another ~3k posts and i want to add them to a category so i can query and display them apart from the first 50k`s. How can i query the posts by the category? I have no ideea where to start. I readed a bit from codex but nothing concrete. And another question, where can i check the category id that i just created? Thanks:)


Multisite - network language settings not updating individual sites

I have a multisite installation of Wordpress / Buddypress. (Versions 3.6.1 and 1.8.1 respectively). I have created a .mo language file which I have named en_GB, because I want to customise some language strings in the Wordpress interface without touching core files. (e.g. changing 'Howdy, ' to 'Hello, '). I set the new language as the default network language in the Network admin pages. When I then visit individual sites in the network, the new language is selected in settings, but the interface does not reflect that. Only when I save the individual site's language settings are the new language strings applied. I have thousands of sites, so obviously I can't update them all by hand. Is this a known issue, and can anyone suggest a solution? Thanks.


How to access page list themes

I am modifying a WP theme. How do I access the list of WP pages? (As in _what functions do I use_?)


Getting Wordpress Permalinks to match menu navigation

I am trying to get my permalinks to match the location of where the page/posts lie in the navigation menu at the top of my page. For example, my travel site has has a post about Torres del Paine National Park that lives Adventures -> South America(%category%) -> Chile(%country%) -> Torres del Paine (%postname% on the navigation menu, then i want the permalink to be: websitename.com/adventures/southamerica/chile/torresdelpaine. I am knew to wordpress, and I do not know php and very basic HTML. Is there some sort of tag I can put in the custom structure field under Settings -> Permalinks in Wordpress?


Making a Wordpress site into a Web App using a Third-Party BaaS

I would like to use a BaaS service for my mobile apps. Parse.com seems like it will fit my needs, and it offers login (to Parse) through Facebook and other Social sites. The difficulty I am facing is that I am also trying to pull this data into my already existing Wordpress website. I would like a user to be able to login to Parse through my website, manually or via Facebook (the key is that the user is logging into _Parse_ either way to be able to access the data on their Parse account through the site). I would like the User to be able to read and write data to Parse by performing specific actions on the website. I am pretty lost as to how to best accomplish this. I am a novice programmer, and while I can make my way through mobile programming, web programming is brand new to me. Is there any way to integrate Wordpress with a 3rd party database like Parse? Possibly through a plugin or a service? I have found several plugins that will integrate Facebook login with a Wordpress user, but none that can help with a 3rd party database user. Parse does have a Rest API, and I feel like this is the way to go, but things are still very foggy for me and I could use some help if you care to give it. Thanks!


How to sent a email outside Wordpress?

I am setting up a paid membership page on WordPress. It uses a form to get credit card information and an email address, then runs the card and on success sets up a new user. I can run the card, and creates a new user, but it doesn't send them a Welcome email so they can establish their own password. I have tried to find the right combination of include files for this PHP page (using echo statements to see where the code breaks) and have addressed a lot of the missing functions by including them at the top of the page, but I still get "Fatal error: Call to a member function get() on a non-object in /[...]/wp-includes/cache.php on line 113". Here is the code I have created to try to send a notification email:               require_once('../wp-includes/capabilities.php');     require_once('../wp-includes/cache.php');     require_once('../wp-includes/option.php');     require_once('../wp-includes/pluggable.php');     require_once('../wp-includes/plugin.php');     require_once('../wp-includes/formatting.php');     function setWP($username){         global $wpdb, $wp_hasher;         echo("Globals
");              $user_login=$username;         echo($user_login."
");              if(empty($user_login)){             return false;         }else if(strpos($user_login, '@')){             $user_data=get_user_by('email', trim($user_login));             if(empty($user_data))                 return false;         }else{             $login=trim($user_login);             $user_data=get_user_by('login', $login);         }         echo("user_login
");              do_action('lostpassword_post');                   if(!$user_data) return false;              // redefining user_login ensures we return the right case in the email         $user_login=$user_data->user_login;         $user_email=$user_data->user_email;              do_action('retreive_password', $user_login);  // Misspelled and deprecated         do_action('retrieve_password', $user_login);         echo("retrieve_password
");              $allow=apply_filters('allow_password_reset', true, $user_data->ID);              if(!$allow)             return false;         else if(is_wp_error($allow))             return false;         echo("allow
");              $key=wp_generate_password(20, false);         do_action('retrieve_password_key', $user_login, $key);              if(empty($wp_hasher)){             require_once ABSPATH . 'wp-includes/class-phpass.php';             $wp_hasher=new PasswordHash(8, true);         }         $hashed=$wp_hasher->HashPassword($key);         $wpdb->update($wpdb->users, array('user_activation_key' => $hashed), array('user_login' => $user_login));         echo("hashed
");              $message=__('Welcome!') . "\r\n\r\n";         $message .= __('If you did not request a training series, send an email to info@url.com.') . "\r\n\r\n";         $message .= __('As a new student, you will need to set a password. Visit the following address:') . "\r\n\r\n";         $message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . ">\r\n";         $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";              if(is_multisite())             $blogname=$GLOBALS['current_site']->site_name;         else             $blogname=wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);         echo("is_multisite
");              $title=sprintf(__('[%s] Password Reset'), $blogname);              $title=apply_filters('retrieve_password_title', $title);         $message=apply_filters('retrieve_password_message', $message, $key);         echo("Prep to send
");              if($message && !wp_mail($user_email, $title, $message))             echo('The e-mail could not be sent.');         else             echo("Message sent.");          }      Is there a way to send a Welcome email to the user outside of the WordPress framework?


SOAP parsing WSDL error ("wp_remote_post() failed")

I have this strange error now, on my Wordpress+Woocommerce small e-shop. Whenever i try a purchase, i get this:               Payment error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://connect.icepay.com/webservice/icepay.svc?wsdl' : failed to load external entity "https://connect.icepay.com/webservice/icepay.svc?wsdl"      Icepay says their webservice is working fine. What technology does SOAP needs to work properly? **update** Woocommerce status reports               "WP Remote Post: wp_remote_post() failed. PayPal IPN won't work with your server. Contact your hosting provider. Error: connect() timed out!"      **update2** The message has now disappeared and all is back to normal. Really wonder what did fail. If you have any more info, i'd be interested to read about it.


Display what taxonomies a custom post has?

I've trying to search high and low for this but am having a really hard time. Essentially, I have a custom post type called `locations` with taxonomies. The posts in "locations" are categorized under several taxonomies called `markets`, `products`, `size`, `country`, etc." I just need to know how I can get it so my custom post type on the front end displays what taxonomies the post is categorized into. Does anyone know how I can do that? To clarify, I just basically need to emulate this page to a tee (which is a drupal site) where you can see what categories the post if under. > http://www.playtime.com/Acadiana-Mall-Lafayette-LA Would greatly appreciate ANY guidance or feedback.


Can I show also the post date using the wp_get_archives() function?

I am pretty new in WordPress theme development and I have some doubt about the **wp_get_archives()** function: http://codex.wordpress.org/Function_Reference/wp_get_archives In my website I have create the following **page template** that use the **wp_get_archives()** function to show the posts list:               <?php               /**          * Template Name: Posts Archive          *          * A custom page template for displaying all posts.          *          * The "Template Name:" bit above allows this to be selectable          * from a dropdown menu on the edit page screen.          *          * @package WordPress          * @subpackage Twenty_Ten          * @since Twenty Ten 1.0          */              get_header();           ?>

Associazione per la Tutela dei Diritti Umani del Popolo Eritreo

Association in Defense of the Human Rights of the Eritrean People

Archivio post

             <?php wp_get_archives('type=postbypost'); ?>

          <?php get_footer(); ?>      It work and this is the result (I only need to set the right CSS related to the font size): http://lnx.asper-eritrea.com/archivio/ Ok, now my question is: using the **wp_get_archives()** function can I show the post date before each posts?. I want to obtain something like: ** 10/04/2014 - POST TITLE** rather than the mere post title. Can I do it passing some parameters to the **wp_get_archives()** function? Or the only solution is do not use this function and create a custom loop into my template page?


Facebook 'Share' and 'Like' on individual posts

As the name of the thread indicates, I want to add to my website a Facebook 'Share' and 'Like' buttons to each of my individual posts. On each post page I will have those two buttons so people can like or share that individual page. I can't seem to find a way to do that, so i would like to ask you guys how can i achieve that effect (with a plugin or a code solution).


Use wp init hook to call other hooks?

I want to know if it is a good practice according to WordPress theme or plugin development.               add_action('init','all_my_hooks');          function all_my_hooks(){          // some initialization stuff here and then          add_action('admin_init',-----);     add_action('admin_menu',----);          // more like so          }      thanks


get_the_category_list() does not give me all my categories

I am trying to use `<?php echo get_the_category_list(); ?>` in my `footer.php` file to display my categories. On the home page, this function is showing only two categories and in inner single posts it shows that post's related category. In pages, this tag shows nothing. I have even tried to use `<?php wp_reset_query(); ?>` after each `WP_Query`, but that did not help. How do I make this work properly?


Compare custom taxonomies of updated post (or new post) [Updated with progress]

I am using the Transients API to cache category loops for a custom taxonomy. All works fine, but if I add a new post or update an existing one, I woud like to compare the taxonomy values and then clear the transients based on the difference in IDs and then clear the others. Transients have the following format, `_transient_mouldings_cat_loop_141` where `141` is the ID. Does anyone have any suggestions on grabbing the tax values before the post is saved (existing terms) (which I thought would be `category_save_pre()`, but that only references post categories, and then on-save, use `save_post()` to grab the new values, find the difference and then delete the needed transients? Thanks! # Update I was able to delete category transients with `save_post()`:               function mouldings_delete_transient_teaser($post_id) {         switch (get_post_type()) {             case 'moulding_profiles':                 // delete teaser transient                 delete_transient('mouldings_moulding_profiles_teaser_'.$post_id);                      // delete profile category transient                 $post_terms = get_the_terms($post_id, 'profile_categories');                 foreach ($post_terms as $post_term) {                     delete_transient('mouldings_cat_loop_'.$post_term->term_id);                 }                 break;         }          }     add_action('save_post','mouldings_delete_transient_teaser');      but I still need to be able to plug into the initial load. I was thinking `load_(page)` might do the trick, an I could possibly create a function in there that grabs the posts before an item is saved, but then calling that function in `save_post()` would probably just give me the new categories (which I already have). Any suggestions are welcome # Thoughts I'm wondering if this is more along the lines of storing the category IDs in a session variable - then on `save_post()` compare those with `get_terms()` (which will have the new ones) and then the unique IDs would be run through the `delete_transient()` function --- as I have still yet to come across anything... _Thoughts continued_ : It sounds like sessions are not used in WordPress and while you can enable them via `wp-config.php`, I'm wondering if there is a simpler way that I'm missing. # Update #2 After more than a few back 'n forths with Tom, I believe this is the correct way to go:               function mouldings_delete_transients ($object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids) {              if (get_post_type() == 'moulding_profiles' || get_post_type() == 'moulding_combination') {             $changed_cats = array_diff($tt_ids, $old_tt_ids);             foreach ($changed_cats as $changed_cat) {                 delete_transient('mouldings_cat_loop_'.$changed_cat);             }         }     }     add_action('set_object_terms', 'mouldings_delete_transients', 10, 6);      The only problem I'm having with this is `$old_tt_ids` are not being called when a post is saved. So, what I'm trying to do is compare the current categories, `$tt_ids` with the old categories, `$old_tt_ids` and detect the changes between the two. So, if a new category has been chosen, that would be part of the diff. And, if a category was removed (unchecked), that would also be chosen. It seems to grab the new ones, but not the old ones. Anyone have any ideas? Thanks!


Lightbox Effect Not Working

I followed the steps to create a lightbox gallery. The gallery is created, but does not open with the lightbox. It just opens as a post. Does anybody know the step I've missed? Here is the site in progress. (I also must mention that pretty much nothing in this theme I bought seems to work) http://www.gregtaylordesignstudio.com/absinthe/gallery/ Any insight would be greatly appreciated. I'm relatively new to wordpress


WAMP Wordpress installation cannot get past step 1, loads indefinitely

I am trying to install Wordpress on WAMP I changed my localhost path to `localhost:11245` in the WAMP config file, so when I load my apache admin screen I go to `localhost:11245` When I loaded Wordpress, `localhost:11245/wordpress`, it prompted me to enter the admin information, that is what I entered :   * Database Name : `wordpress`   * User Name : `wpadmin`   * Password : `blank`   * Database Host : `localhost:11245`   * Table prefix : `wp_` When I click `Submit`, it loads indefinitely. Somehow I made it come up with the following error. I imagine this has something to do with me changing the port number. > Welcome to WordPress. Before getting started, we need some information on > the database. You will need to know the following items before proceeding. > >   * Database name >   * Database username >   * Database password >   * Database host >   * Table prefix (if you want to run more than one WordPress in a single > database) > > > If for any reason this automatic file creation doesn't work, don't worry. > All this does is fill in the database information to a configuration file. > You may also simply open wp-config-sample.php in a text editor, fill in your > information, and save it as wp-config.php. > > In all likelihood, these items were supplied to you by your Web Host. If you > do not have this information, then you will need to contact them before you > can continue. If you’re all ready… How can I get it to install? **EDIT** I was able to get WAMP to route to `localhost`, then I ran `localhost/wordpress` and went through the setup screen again with these settings :   * Database Name : `wordpress`   * User Name : `root`   * Password : ``   * Database Host : `localhost`   * Table prefix : `wp_` I just ran a php page with this info on it and it returned `Connection OK`               <?php      $link = mysql_connect('localhost','root','');      if (!$link) {          die('Could not connect to MySQL: ' . mysql_error());      }      echo 'Connection OK'; mysql_close($link);      ?>


Specifying multiple categories in URL (permalink)?

For example: `http://www.example.com/dell/studio/studio-1558` where `dell` and `studio` are categories A few months back I heard from someone that it is not possible. I need to know why? Which part of code prevents it? Is there any workaround for this?


Recommended Themes for a Developer-related Topics Blog?

_( **Moderator's note:** Was previously titled: "What is the best theme used for a developer like me?")_ I'm a developer and write a blog to share my knowledge with readers. I'm looking for a theme which is best suited with me but not sure which ones. Please share if you've ever visited a nice theme.


How to add Custom Blog Options to new blog setup form?

Seems like a simple enough requirement, but I'm struggling:   1. **I want to add an option field to the "Add New Site"**.   A simple text option is fine. How do I do this?   2. **I need to save this custom blog option when the site is created.** I know I can use the 'wpmu_new_blog' hook, which passes the `$meta` variable with supplied options, but I'm wondering if there's a way to do this all in one step so I don't have to perform another DB query, or worse yet, override/replace the whole site creation process? **Notes:** I'm using WP 3.3.1 with a MultiSite setup. I'm writing a plugin that lists all the Sites which match the specified custom field value (let's call it "type"). Also, I'm an experienced PHP developer but I'm still relatively new to WordPress hacking, so please assume I am not yet intimately familiar with all of the various WP functions and hooks.


Wordpress sort custom field values in alphabetical order

I am using WordPress Custom Content Type Manager to build a Literary Agency website. The page I'm stuck on is the Authors page which displays thumbnails of all the books related to the author. The code i have below does just that, however I want it displayed in alphabetical order. This is the code:               <?php if (get_custom_field("authimage:get_post")):?>

Titles by this Author

     <?php $my_post = get_custom_field("authimage:get_post");     if(!empty($my_post)){     foreach ($my_post as $a) {     print '

';}}?>

     <?php endif;?>      I've searched everywhere, but struggle adapting the solutions into my existing code. Heres the link to the CCTM plugin: Custom Content Type Manager Plugin


The title is the question : How to develop a theme while having another show up I already have a DB and a theme.... i like, when log as admin see another theme... just for the time making it clean and final... and then, remove the old one and have the new one able to be see for everybody... any plugin that do that ? * * * some research and result : http://wordpress.org/extend/plugins/theme-test- drive/ and http://wordpress.org/extend/plugins/nkthemeswitch/ not sure what it's worth....


Some doubts about how the loop work (trying debugging it)

I am very new in WordPress development (and also in PHP development, I came from Java and C#). Today I have installed Aptana and configured _XDebug_ to inspect what happens into the **TwentyTwelve** theme. In particular, I am trying to understand how WordPress load the posts in the loop (debbuging it). So, up until now, I only know how create a loop in a WP theme, but I don't know how exactly it work. So, in the _TwentyTwelve_ I find the post loop, this code snippet:               <?php while ( have_posts() ) : the_post(); ?>         <?php get_template_part( 'content', get_post_format() ); ?>     <?php endwhile; ?>      From what I can understand the loop is composed by a `while()` cycle where the `have_posts()` result is the condition to execute the while body. Ok, now probabily the following question is related to my ignorance in PHP, but what exactly does this construction means:               <?php while ( have_posts() ) : the_post(); ?>      `have_posts()` is the condition to execute in the while but what exactly means the `: the_post();` Is `the_post()` call the first operation of the cycle or what? Then I have put a breakpoint into the `have_posts()` function definied into the _query.php_ file.               function have_posts() {         global $wp_query;              return $wp_query->have_posts();     }      What exactly is the _query.php_ file? Is it a class or what? Looking at its code it seems to me that it is not a class. Why? And what exactly represent `$wp_query` variable? Is it an object or what? (PHP is not typed so how can I know what a variable contains?) What means this operation:               $wp_query->have_posts();      I think that it call another version of the `have_posts()` function (definied into the _query.php_ file) that check if exist some other post to show or if they are ended. But how exactly work? Reading the PHP OO documentation the `->` operator call a method of an object but I don't know if `$wp_query` is an object or if in this contents the `->` operator have another sense... Can you help me to understand how exactly it work?


Getting trackback spam, even with trackbacks disabled

I'm having a heck of a time having trackbacks being disabled period on my self-hosted blog. I've disabled the "Allow link notifications from other blogs (pingbacks and trackbacks)" option, and have all comments going through disqus, yet for some reason I'm getting 20-50 trackbacks a day to the blog directly (not through disqus). Is there something obvious that I'm missing?


Which built-in Wordpress files are safe to edit?

I begin to work with Wordpress, I'm developing a theme with many functionnalities into it, and I'm good with that. My question does not have to do with theme development, but more with general knowledge about Wordpress. I would like to know which files are safe to edit in a standard Wordpress installation : files that will not be overwritten when we perform an update of Wordpress for instance. I know of `wp-config.php`, but are all others at the root safe too ? I ask this because I want to add filters in my Wordpress website and those filters will be independant of a plugin or a theme. Currently I added them in `wp-settings.php` but I found nowhere if this file is safe to edit.


Login and Forgot password in Lightbox

How do i get Wordpress Login & Forgot password forms in one light-box which can then be displayed inside pages where the user has to be logged in to see the content? Can i just copy some of the code in wp-login.php and then put it in a light box and alternate between the forms using anchor links as tabs would normally work? So for example, when you click forgot password, the login form is hidden and and the forgot password form becomes visible. Then when the user enters their details for example, they are logged in and without being redirected to the default login page.I want the login in and the forgot password to all work within the light-box without leaving the page.


Overriding Parent Theme... will cause plugins failure?

I overrides the parent theme by copying "header.php" and "footer.php" files to the "child" folder, it is working nicely. But I wonder if I install a plugin that need to edit the "header.php" or "footer.php" files, what will happen then?? Since I override those php files, will the plugin edit the files in "child" folder as well?? Thanks!!


Change Theme Location for Multiste's single Blog

I want to change the directory, where the theme is located for only one Blog in the Multiste. the other ones shall keep as they are. I found a snippet which does that for uploads:               add_filter('upload_dir', 'fix_my_upload_dir');          function fix_my_upload_dir($uploads) {         $blogdir = [...] find a subdirectory you want to use [...];              $uploads['basedir'] = '/var/www/somedirectory/' . $blogdir;         $uploads['baseurl'] = 'http://content.bloxxx.net/' . $blogdir;              $uploads['path'] = $uploads['basedir'] . $uploads['subdir'];         $uploads['url'] = $uploads['baseurl'] . $uploads['subdir'];              return $uploads;     }      Is there a smiliar function or a another wy, to set the them dir for just on blog? Many Thanks in advance, Lars


Questions about MU database schema and how to list all blogs

What is the best way of retrieving a list of all blogs and their URLs in a MU network? Can I find them somewhere in the database? I'm also confused about the database schema. I have two different networks, one network has lots and lots and lots of tables with names such as wp_{id}_posts whereas the other network - which is admittedly much simpler - only has one of each kind of table. Notably it also has a table wp_blogs which I cannot find on the first network. Could this be because of the first network was installed way back when the MU feature was new (3.0) and the other network is recent (3.4)?


Custom page template not working

I followed this tutorial for the page specific template -- http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates Created a page through wordpress admin panel - `Blog Page` URL like -- `http://localhost/wordpress/blog-page/` and set template to my template "Swapnesh" from the admin panel itself. Created my specific page template as `page-blog-page.php` containing following code --               <?php          /*     Template Name: Swapnesh     */               get_header(); ?>

                          <?php while ( have_posts() ) : the_post(); ?>                              <?php get_template_part( 'content', 'page' ); ?>                              <?php comments_template( '', true ); ?>                          <?php endwhile; // end of the loop. ?>
                      <?php get_sidebar(); ?>
          <?php get_footer(); ?>      Now when im navigating to `http://mysite/wordpress/blog-page/` im not getting that border so that i can proceed further, let me know what im doing wrong. note-- Under "`Reading Settings`" mu post page selection was "Blog Page" when i dis select this option its showing me the `red border` but no posts then :(


How do translated, escaped strings (esc_attr) in Themes work?

I was looking at the `TwentyEleven` code and found this:               esc_attr__( 'Permalink to %s', 'twentyeleven' )      This is come code that came out of the title tag for a post; the full code within the title tag being:               printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) );      I checked out the documentation for the `esc_attr` function (appears to be the same as the `esc_attr__` function?) and it states it only takes one parameter, so how is this passing it two parameters?


After Migration, Warning: include_once() errors on all pages

We migrated our site to a new host and changed the domain name, and now all pages are displaying errors: > Warning: include_once(includes/class-wc-download-handler.php) > [function.include-once]: failed to open stream: No such file or directory in > /home/content/34/11939834/html/wp- > content/plugins/woocommerce/woocommerce.php on line 258 > > Warning: include_once() [function.include]: Failed opening 'includes/class- > wc-download-handler.php' for inclusion > (include_path='.:/usr/local/php5_3/lib/php') in > /home/content/34/11939834/html/wp- > content/plugins/woocommerce/woocommerce.php on line 258 > > Warning: session_start() [function.session-start]: Cannot send session cache > limiter - headers already sent (output started at > /home/content/34/11939834/html/wp- > content/plugins/woocommerce/woocommerce.php:258) in > /home/content/34/11939834/html/wp-content/plugins/ninja-forms/ninja- > forms.php on line 294 We are also unable to login at wp-login.php Our site url is _www.dv8sports.com_ Any suggestions to what the problem might be? **UPDATE 8/6/14** The files in question were _uploaded_ to the GoDaddy server, but they were _deleted_ by GoDaddy without a Failed Upload notification. Here is what comes up in FileZilla               Command:    STOR class-wc-download-handler.php     Response:   150 Accepted data connection     Response:   226-File successfully transferred     Response:   226-0.312 seconds (measured here), 156.34 Kbytes per second     Response:   226 *** MALWARE DETECTED ***     Status: File transfer successful, transferred 51,704 bytes in 1 second


Latest/Recent posts widget title link

I have been struggling with this for a few hours now... I want to add a link to my recent posts widget title. I have tried a number of options given in forums but nothing seems to work. Tried adding link tags around and in between `echo $before_title . $title . $after_title;` but must be going wrong somewhere. Please can you have a look at the widget code and let me know if adding a link to widget title is possible?               <?php     /**      * Widget Name: Recent Posts with Excerpts Widget      * Description: A widget that allows to display a recent posts with excerpts and date and author info (optional).      * Version: 0.1      *      */          /**      * Add function to widgets_init that'll load our widget.      * @since 0.1      */     add_action( 'widgets_init', 'latest_posts_load_widgets' );          /**      * Register our widget.      * 'Latest_Posts_Widget' is the widget class used below.      *      * @since 0.1      */     function latest_posts_load_widgets() {         register_widget( 'Latest_Posts_Widget' );     }          /**      * Custom Category Widget class.      * This class handles everything that needs to be handled with the widget:      * the settings, form, display, and update.  Nice!      *      * @since 0.1      */     class Latest_Posts_Widget extends WP_Widget {              /**          * Widget setup.          */         function Latest_Posts_Widget() {             /* Widget settings. */             $widget_ops = array( 'classname' => 'widget-latest-posts', 'description' => esc_html__('The most recent posts with teaser text', 'purevision') );                  /* Widget control settings. */             $control_ops = array( 'width' => 150, 'height' => 350, 'id_base' => 'latest-posts-widget' );                  /* Create the widget. */             $this->WP_Widget( 'latest-posts-widget', esc_html__('Digi - Recent Posts', 'purevision'), $widget_ops, $control_ops );     }          /**      * How to display the widget on the screen.      */     function widget( $args, $instance ) {         extract( $args );              /* Our variables from the widget settings. */         $title = apply_filters('widget_title', $instance['title'] );         $category_id = $instance['category_id'];         $num_posts = absint( $instance['num_posts'] );         $post_offset =  absint( $instance['post_offset'] );              /* Before widget (defined by themes). */         echo $before_widget;              /* Display the widget title if one was input (before and after defined by themes). */              if ( $title ) echo $before_title . $title . $after_title;              /* Display the Latest Posts accordinly... */         echo '
';         $cats_to_include = ( $category_id ) ? "cat={$category_id}&": '';         $num_posts_query = new WP_Query( "{$cats_to_include}showposts={$num_posts}&offset={$post_offset}" );         if( $num_posts_query->have_posts()) : ?>

                         <?php while( $num_posts_query->have_posts()) : $num_posts_query->the_post(); update_post_caches($posts); ?>         <?php         $thumb = get_post_thumbnail_id();          $postimage = vt_resize($thumb, '', 58, 58, true );         ?>

<a title="<?php the_title(); ?>" href="<?php the_permalink() ?>"><?php the_title(); ?>

         <?php endwhile; ?>

         <?php endif;         echo '
';              /* After widget (defined by themes). */         echo $after_widget;     }          /**      * Update the widget settings.      */     function update( $new_instance, $old_instance ) {         $instance = $old_instance;              /* Strip tags for title and name to remove HTML (important for text inputs). */         $instance['title'] = $new_instance['title'];         $instance['num_posts'] = strip_tags( $new_instance['num_posts'] );         $instance['post_offset'] = strip_tags( $new_instance['post_offset'] );         /* No need to strip tags for dropdowns and checkboxes. */         $instance['category_id'] = $new_instance['category_id'];              return $instance;     }          /**      * Displays the widget settings controls on the widget panel.      * Make use of the get_field_id() and get_field_name() function      * when creating your form elements. This handles the confusing stuff.      */     function form( $instance ) {              /* Set up some default widget settings. */         $defaults = array( 'title' => esc_html__('Latest Posts', 'purevision'), 'category_id' => '', 'num_posts' => 3, 'post_offset' => 0);         $instance = wp_parse_args( (array) $instance, $defaults ); ?>
             <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e('Title:', 'purevision'); ?>             <input id="<?php echo $this->get_field_id( 'title' ); ?>" type="text" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" class="widefat" />

             <label for="<?php echo $this->get_field_id( 'category_id' ); ?>"><?php esc_html_e('Pick a specific category:', 'purevision'); ?>             <?php wp_dropdown_categories('show_option_all=All&hierarchical=1&orderby=name&selected='.$instance['category_id'].'&name='.$this->get_field_name( 'category_id' ).'&class=widefat'); ?>

             <label for="<?php echo $this->get_field_id( 'num_posts' ); ?>"><?php esc_html_e('Number of posts to show:', 'purevision'); ?>             <input id="<?php echo $this->get_field_id( 'num_posts' ); ?>" type="text" name="<?php echo $this->get_field_name( 'num_posts' ); ?>" value="<?php echo $instance['num_posts']; ?>" size="2" maxlength="2" />
             <?php esc_html_e('(at most 15)', 'purevision'); ?>

             <label for="<?php echo $this->get_field_id( 'post_offset' ); ?>"><?php esc_html_e('Number of posts to skip:', 'purevision'); ?>             <input id="<?php echo $this->get_field_id( 'post_offset' ); ?>" type="text" name="<?php echo $this->get_field_name( 'post_offset' ); ?>" value="<?php echo $instance['post_offset']; ?>" size="2" maxlength="2" />
             <?php esc_html_e('(offset from latest)', 'purevision'); ?>


wp_query: implicit paging? I get less posts that I should

A newbe wp_query question: I set a wp_query as follows, but instead of 17 posts I only get the first 10 posts from the selected Category with ID=5. Is there an implicit paging directive on the results?                   $myPosts = new WP_Query();          $args_posts = array('cat' => 5);         $myPosts->query($args_posts);                    while ($myPosts->have_posts()) : $myPosts->the_post();                           ?>

<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?>

<a href="<?php the_permalink(); ?>" rel="bookmark,nofollow" title="Permanent Link to <?php the_title(); ?>"><img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo $img ?>&h=80&w=120&zc=1" width="120" height="80" alt="<?php the_title(); ?>" />
                 <?php } ?>
<?php the_excerpt(240, __('read more »')); ?>

                               <?php endwhile;                      }     }       ?>


Dynamically assign same page template to child page as parent

How to assign parent page template to its child pages dynamically?


Stop WordPress from showing images on non post pages

With regards to how WP displays "preview" text on the home page, category page etc for each post, how do you stop it from including images in this section. I'm not talking about the featured image for each post, I'm talking about if the post has any included images within the post - I don't want them to show up in the preview text. This is the code that outputs the content for example..               <?php the_content( __( 'Continue reading →', 'twentyeleven' ) ); ?>


Wordpress: code structure

EDIT: I've posted them separately here wordpress.stackexchange.com/questions/137672/… and here wordpress.stackexchange.com/questions/137673/…. I'll vote to delete this one. I'm working on a Wordpress site, and I'm having a few questions about structuring my PHP code. Although I've have experience with structuring code in other frameworks, I'm wondering how you would do this in Wordpress. I might have known some of this if I was more fluent in PHP. More specifically:   * Separation of view and logic I find that very easily my views become cluttered with logic, e.g. null checks, email validation, and retrieving values from the post object. How would you separate this out in Wordpress? Is there any sort of MVC framework?   * Common functionality between my own plugins I read that when creating new post types, creating a settings page, and creating a new taxonomy, you should create a plugin. So I have done that. But I have functionality, which could be generalized, or are identical, in my plugins. An example of this would be the function which saves to the database. Since everything seems to be put in the global scope, if there is such a thing in PHP, should I create another plugin with shared functionality, or put shared functionality in the `functions.php` file?   * Is everything global? As I mention above, is everything global in Wordpress? My impression is that other plugins might very well have function names that clash with my function names; that's why you prefix functions with your themes theme name. Is there a way to avoid this? Thank you for your time, and sorry if this is duplicate questions.


Make custom thumbnail size image in media_sideload_image function

I am using customize `media_sideload_image` just as provided in this post by @G.M. Now I want to create different sizes of images other than which WP default uses. Please provide suggestion


Wordpress get_pages sub nav show current page

I'm using get_pages in Wordpress to create a sub nav on a page. I know I can use wp_list_pages but I wanted to control the links at different screen sizes in bootstrap. Using this sort of code is it possible to indicate with a class name the current page in the sub nav. In wp_list_pages it would be 'current_page_item'               <?php          $page_args = array(              'child_of' => $post->post_parent,         'sort_column' => 'ID',         'sort_order' => 'ASC'          );          $pages = get_pages($page_args);          ?>

              <?php     foreach($pages as $page){     ?>
                          ID ) .'">                              <?php echo $page->post_title;?>
     <?php     }     ?>

          <?php        ?>     ?>


Can I filter a post type based on comment moderation settings?

I want to block front end submitted posts if they contain certain words or website addresses and such. I can set the post type all to draft when submitted but want to keep set up to publish but be able to moderate them somewhat. I am currently submitting the post with a gravity form. I want my cpt to be like a comment really and hoped I could hook into the comments system to moderate posts based on settings in the discussion settings. I am looking for direction or suggestions on how to best do this. A pro coder I am not but I can figure things out with a start or good tutorial. Everything on moderation I find is for comments.


Add a class at specific element in custom Menu Walker

I have customised my menu in wordpress by extending the Nav_Menu_Walker class and now i cannot figure it out how could i add a class at a specific ul element. I have this function which adds classes by depth:               function start_lvl(&$output, $depth) {      $indent = str_repeat("\t", $depth);      if ($depth >= 1)         $output .= "\n$indent
\n";      else         $output .= "\n$indent
\n";          }      When the $depth is 0 i would like to add a different class at the third element from $depth =0 rather than "submenu". Could you please provide me some suggestions ?


How to make shortcode to hide selection of text from post or page?

is there any shortcode or a plugin that will add new quicktag, like this example: [hidemytext]some hidden text[/hidemytext] and any text inside those tag is hidden from the post or from the page. Thanks and regards


Single post content custom order

In my post I have a shortcode for [video] than text content. Single post page displays first entry-meta, than title, than content [video] + text. What I need is to add some condition in single.php so that the order for display to be [video] ->entry-meta ->title ->text. Or maybe there is a function to check if I have [video] shortcode in post to display it first than the title and after rest of the content. Can anyone please help? I know that tut but I don't know how to use it in single.php.               if(has_shortcode('your_short_code')) {           // perform actions here  ...          // I want to have: do shortcode [video id] or something like this     }        I need an example in single.php I just want to have in single.php displayed first the [video id] after meta than Title +Content OR               the_content([with video]);          the_content(without video);


How to include external library in wordpress plugin

How can I make an external PHP library available with my plugin. Where the library files need to be placed?


Don't show attachments if they are inserted in post

I have attached images that I have inserted into my posts but they also appear in the attachments box at the bottom of the post. I'd like to know how to make them not appear in the attachments box if I have inserted them in the post. example post: http://www.fanboybuzz.com/2012/12/sexy-thor-girl-cosplay-2/ I don't want the smaller thumbnail image at the bottom of the post to show up since I've inserted the image in the actual post. Can anyone help me?


WordPress feeds and publish date

By default WordPress feeds have a tag which contains the date the article was first published. How can I change the content of that tag to contain the value from the post_modified field rather than post_date field for posts?


Organizing uploaded media with wp_insert_post() and wp_handle_upload according to time parameter

I'm retroactively creating a post with wp_insert_post() and attaching a featuring image to it. I need the image to go into the folder that corresponds to the post's publishing date. I'm using time parameter in wp_handle_upload function that supposed to move files to the directories according to the parameter value (see in the code - $upload_date - static value for now). But right now the image moves to the current year/month folder ignoring $upload_date (Ex.: Supposed to go **2007/11** , goes to **2012/12** ).                   $output_dir = $uploads['path'];         new_filepath = $output_dir.'/'.$file;               // INSERT POST AND GET POST ID           $my_post_id = wp_insert_post($my_post);               // Copy image from my folder to WP Uploads         rename($filename,$new_filepath);               // required for wp_handle_upload() to upload the file         $upload_overrides = array( 'test_form' => FALSE );              $upload_date = '2007/11'; // Using this date for testing purposes              $movefile = wp_handle_upload( $new_filepath, $upload_overrides, $upload_date );               $wp_filetype = wp_check_filetype(basename($new_filepath), null );         $attachment = array(              'post_mime_type' => $wp_filetype['type'],              'post_title' => $post_title,              'post_content' => $post_content,              'post_status' => 'inherit'         );         $attach_id = wp_insert_attachment( $attachment, $new_filepath, $my_post_id );         $attach_data = wp_generate_attachment_metadata( $attach_id, $new_filepath );         wp_update_attachment_metadata( $attach_id, $attach_data );               // ADD FEATURED IMAGE TO THE POST         add_post_meta($my_post_id, '_thumbnail_id', $attach_id);


exclude category in loop.php

I am using twentyten theme. I am trying to exclude category 1 from author posts. I used the following code in loop.php               query_posts(cat='-1');     while ( have_posts() ) : the_post(); ?>      But no post is displaying. How to fix this?


Gallery shortcode - change link file image size? (not using default fullsize image)

I am using this for my gallery -               <?php echo do_shortcode('[gallery size="gallery-thumb" link="file"]'); ?>      and I am using the jquery fancyapps fancybox. But some full-size images that are in my gallery are are really big and take forever to load... Instead I want the link file in the shortcode to use my custom image size below...               add_image_size( 'fancyapps-image', 1024, 1024 );      Can any one help with out using another plugin?    * * *    I am using similar script on my post/pages body where images are inserted manually and aligned etc. So something similar surely could work? This script combo functions ajax call basically scans all the images in my posts and changes the link url to the 'fancyapps-image' size... **script**               var raw_class, image_id = new Array();     $('.entry a img').each(function(i){         var img_class = $(this).attr('class');         if(img_class && img_class != undefined){              raw_class = $(this).attr('class').split(" ");             for(j=0;j<=raw_class.length-1;j++){                 if(raw_class[j].match(/wp-image-/))                     image_id[i]= raw_class[j].slice(9);             }         }     });          var image_ids = image_id.toString();     var data = { type: 'get_data', action: 'wp_get_large_image_url', data: image_ids }          $.post( wp_ajax, data, function(message){         if(message){             var raw_data = message.split(',');             for(i=0;i<=raw_data.length-1;i++){                 var image_data = raw_data[i].split('%-');                 $('.wp-image-'+image_data[1]).parent('a').attr('href', image_data[0]);             }         }     });      **admin-ajax.php call**               <?php echo "var wp_ajax = '" . admin_url('admin-ajax.php') . "';" ?>      **functions.php**               function wp_large_image_data(){         unset( $_POST['action'] );         if($_POST['type'] == 'get_data'){             $data = $_POST['data'];             $image_ids = explode( ',',  $data );             $image_large_url = array();             foreach($image_ids as $image_id){                 if($image_id){                     $attachment_data = wp_get_attachment_image_src( $image_id, 'fancyapps-image' );                     $image_large_url[] = $attachment_data[0].'%-'.$image_id;                 }             }             $image_data = implode( "," , $image_large_url);             echo $image_data;                }         die;     }     add_action('wp_ajax_wp_get_large_image_url', 'wp_large_image_data');     add_action('wp_ajax_nopriv_wp_get_large_image_url', 'wp_large_image_data');         Any ideas would be great thanks.


Bluehost WebHost and performance problems with W3TC

I'm currently arguing with Bluehost over slow server times and they pointed to a report at gtmetrix.com in which I found inefficient CSS selectors. There were 55 very inefficient CSS selectors from the login page alone. Some including: > `#adminmenu li.menu-top:hover .wp-menu-image img` Tag key with 3 descendant > selectors and Class overly qualified with tag There are many others but the CSS file is pointing to > /wp-admin/css/wp-admin.css?ver=20111208 So this is WordPress' CSS files. Is this normal? Or this referring to other CSS stylesheets that reference the same selector? **UPDATE** I'm running W3TC and I get an error: > It appears Page Cache URL rewriting is not working. If using apache, verify > that the server configuration allows .htaccess or if using nginx verify all > configuration files are included in the configuration. I'm not sure why since when I open up .htaccess, W3TC has written all the browser cache and page cache settings.


How to show main category related to that post

On my main page I have a few post from two categories, but I only want it to display only one Here is my code               <?php     /* translators: used between list items, there is a space after the comma */         $categories_list = get_the_category_list( __( ', ', 'themename' ) );             if ( $categories_list && themename_categorized_blog() ) :     ?>     <?php printf( __( '%1$s', 'themename' ), $categories_list ); ?>       Is it possible to do it by adding this `[0]` in the code somewhere, if so, where?


Add Metabox to all custom post types

Ok, I've looked through the forum here, but haven't found quite what I'm looking for. I wanted to see if it was possible to add a Metabox to all custom post types without the need to setup an array? Or, maybe just the CPTs created using Custom Post Types UI plugin? Here's the code I'm testing, but it only shows up on regular Posts.                   add_meta_box( 'my-meta-box-id2', 'Enter your PDF location for your post category below:', 'cd2_meta_box_cb', 'post', 'normal', 'high' );


Showing Custom Menus in the sidebar

I want to get custom menu in my top level page and the sub pages which are not child of the top level pages. I got many examples using wp_list_pages but it requires the sub pages should be the child of the top level page. How do use the wp_get_nav_menu_items function to show the custom menu in child page and the toplevel page Thanks


Wordpress Rewrite Url with arugments

I did not find any useful tips from google search and I wrote the same question in wordpress forum but there is no reply I am writing the complete step here First step I am redirect page to custom post archive page add_action( 'template_redirect', 'plu_redirects' ); //I am saving in the session the post_id which is the event $_SESSION['event_page'] = $_GET[ 'event' ]; wp_safe_redirect( get_post_type_archive_link('plug') ); In the archive page I am trying to get the post by id or if session not exists then get the latest post.                   if ( !isset($_SESSION['event_page'])) :             $args = array(                 'post_type'=> 'plug',                 'posts_per_page' => 1,                 'order'    => 'ASC',                 'tax_query' => array(                     array(                         'taxonomy' => 'event_type',                         'field' => 'slug',                         'terms' => 'schedule'                     )                 )             );             query_posts($args);         else :             $args = array(                 'post_type'=> 'plug',                 'posts_per_page' => 1,                                     'p' => $_SESSION['event_page'],                 'order'    => 'ASC',                 'tax_query' => array(                     array(                         'taxonomy' => 'event_type',                         'field' => 'slug',                         'terms' => 'schedule'                     )                 )             );             query_posts($args);         endif;      But this is always getting the last record when session is set ...Why? I need to is there a better way it code can be written instead of using the session and also I don't require the loop as I am getting only one record. I am having the problem in the archive page and the code which I have added is working . but not professional..


Am I allowed to license my Wordpress theme under the aGPL

I was interested in the recent conversation about whether WordPress themes need to be licenced under the GPL or whether they can be closed source. The video can be reached from matts blog and my favourite discussion about it is Dave Winers blog post. My question is - am I allowed to license my theme under the aGPL? or is this the same argument as if I wanted to use a closed source license?


WP_Query + random

Is there any way to get this               <?php      $pc = new WP_Query ('category_name=cat1&posts_per_page=5');      ?>       but each time display a RANDOM different batch of 5 ones?


JavaScript Errors when Loading NextGEN Gallery

I am using NextGEN Gallery and NextGEN GalleryView. _**(Editors Note: Not sure what this sentence means)_**   But I can't get the image those image was hidden. When I check the css and js files, all of file are included when I check in firebug the below error is shown:               jQuery.timer is undefined     ...for: http://192.168.1.210/hotel.com/wp-content/plugins/nggGalleryview/j...          jquery...r=1.1.2 (line 144)     jQuery("#ngg-gallery-1-133").galleryView is not a function               easing: 'easeInOutQuad'


How to query different post types in specific order?

I have 3 posts types, `articles`, `news` and `tips`. On the home page I want to query 20 posts in this order:               article, article, news, news, tip, ...// same order again until 20      If I use a custom query like so:               $query = new WP_Query(array(       'post_type' => array('articles', 'news', 'tips'),       'posts_per_page' => 20,     ));      I get 20 items but how to order them? Would it be possible to make 3 different queries and then merge the results?


Make pages visible to only logged in members

I want to make a page for each user on my website. When a user logs in, I want them to be able to click on pages that are just designed for them (basically when they log in, I want them to be able to view their own profile). When another user logs in, I want them to be able to view their own profile. Note: I want their profile called 'MY ACCOUNT' and I need to show that on the nav bar Any ideas?


Multisite vs Role Scoper

I have a website with several sections. Each section will have their own user to administer content on. These wouldn't be large sections, maybe a few pages to a dozen at most. My question is whether it would be worth the initial work setting up a Multisite or somehow using role scoper so that a user can only add child pages to a particular parent page If role scoper is the way to go, what's the best way to go down this avenue? Thanks


where is the code that executes the template hierarchy?

I can see a picture of the template hierarchy here, but where is the actual wordpress code which decides that it's a "category page" or an "archives page" or a "search page"?


Facebook profile pic used as avatar

I'm trying to add an avatar option for my blog and would like to avoid using Gravatar or custom avatars so I wish to use Facebook profile pic instead of an avatar. I know that there are plugins for that but they're all a bit cumbersome. I tried Incarnate but the issue with it is that there is no authentication so anyone can use any publicly available username thus misrepresenting themselves. Also, if a person doesn't have a publicly available FB profile, they can't use their profile pic. To sum up, I'd like a plugin or a code so that visitors to my blog are automatically represented with their FB profile pic (if they are already logged in to Facebook) without the need for them to register or log in with FB details to my blog. If a person is not logged in to FB, then a custom avatar is to be used. Please suggest a solution.


Wordpress category loop offset possible?

I have been on this for a while now and haven't really come across a solution to filter the posts on a category page using a sort of offset in php. There are plugin for posts and pages but I am trying to achieve this with pure php and specifically for a category page. Scenario example: A blog with 7 posts, setting the offset to say 3 would begin the loop on the category page to only show (Post4, Post5, Post6, Post7) and NOT (Post1, Post2, Post3). I am wondering if this would be possible at all and be dynamic enough to apply to all categories without the need to specifically identify which posts to exclude via id numbers.


Make wp_list_pages print slugs instead of titles

By default wp_list_pages spits out an unordered list of post titles. To save space in a sidebar menu I´m trying to create a list of page slugs instead of page titles. I suppose I´ll need to write a custom walker.. I was hoping someone can help me with an easier solution or a code snippet.


Change status of page after an event (Looking for best practice advice)

I'm looking for a best practice/ideas for modifying the status/data of a page after an event. Here's an example of what I'm trying to accomplish - This WordPress site would allow users to sponsor people (just one sponsor per person). Each person that is eligible for sponsorship has their own page, which is created via a custom content type I created called "People". That's all the easy part, it's just a basic page that give descriptive information about the person looking to be sponsored. You can then go to PayPal and pay to sponsor them. Now, the part I need help with is after they have paid and get sent back to the site how could I trigger the status of that now sponsored person's page to switch to "Sponsored". So, that no one else tries to sponsor them. I'm assuming I should go about this with Hooks, Actions and Filters, though, I haven't used them much. Anybody have any thoughts on how to accomplish something like this? If I had the basics I could take it and run with. Thank you!


Users: List A to Z, for Users

I would like to create a list of all the alphabets that represent each user in my site. Example:               A -> Link that shows list of all users whose **nickname** starting with letter "A"     B -> ...starting with letter "B"     C -> ...starting with letter "C"     D -> ...starting with letter "D"     E -> ...starting with letter "E"     F -> ...starting with letter "F"     .     .     Z -> ...starting with letter "Z"      I would like to list every alphabet regardless of if there is or isn't a user for it. But would also to know how to only show alphabets with users. Im not sure exactly which method I'll end up using, but I just want to have the option. Ive searched online but couldnt find anything for my particular situation. Id appreciate any help with this. Thanks a lot


Using only %postname%

So I see everyone's arguements against using this, but that seems like a huge flaw in Wordpress because a domain name as close to the root is crucial to a site's SEO. I want my site which has rough 8 pages total to be able to be found by their simple titles, if they're preprended by a date, it just look convoluted and out of standards with most web standards. Fast forward to me adding `%postname%` to my custom permalinks tab, all my url's were updated, and clicking on them brings me a 404. No .htaccess file was made so I made one from scratch and included this :               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /Websites/Garden%20Terrace/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /Websites/Garden%20Terrace/index.php [L]     </IfModule>          # END WordPress      **Update** Any of the permalinks except for the post ID option do not work. None of them work. What o' what am I missing from this to make it actually work? **UPDATE 12/13/2011** Wordpress 3.3 was just released. And all these problems still exist. Clicking on any of the permalinks writes this to your .htaccess . The same text for _any_ of the options :               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /Websites/Garden%20Terrace/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /Websites/Garden%20Terrace/index.php [L]     </IfModule>          # END WordPress     #      Using `/%postname%` doesn't work. At all.


A problem with date archives

I downloaded a widget for my blog, which works just like the calendar widget but displays a custom post type instead. It correctly marks my CPT-posts and creates links, such as http://localhost:8888/wp/?m=201105 for a certain month and http://localhost:8888/wp/?m=20110510 for a certain day. Now I want to create the required archive template, but it keeps falling back to index.php instead of date.php or archive.php - and the loop in index.php returns empty. I am flabbergasted, has anyone seen this before? My hypothesis: it returns empty because I does not include custom post types. It does not explain why date.php / archive.php isn't being used (and is_date() appears to return false), but it would explain why the loop is empty because I have no other articles yet. If this is the case, how can I include CPTs?


Were the language toggles removed from WP recently?

I need to change my weblogs language to "English". I am refering to the article: http://en.support.wordpress.com/language- settings/ which allegedly was "Last modified: July 16, 2012". I only looked for this option in v.3.4 forward and I cannot find it. It's also absent in v.3.5 beta 1. I initially installed and still use the German locale. Thus: 1). Were these simple drop-down menus removed from more recent versions? Because I can find neither of the two. 2). Could my webhoster be at fault somehow? They offered the "WP One-Click- Install" option, which I thought shouldn't hurt things - I guess I was wrong... 3). Could be my German locale at fault, i.e. maybe only the "international" or "English" version has this toggle, but not any of the downloadable locales? Just a guess. I am aware of the fact that I can change the language of WP manually, but first I need a clarification what happened to the above feature since July 16th this year.


Custom Function for SEO by Yoast plugin

We use a very customized version of WordPress for some of our index/root site pages where we use a custom meta box for custom permalinks. What we are looking for is a custom function that basically looks to see if the custom permalink field is being used and if it is, to grab that as the canonical url. This helps with duplicate content being indexed by search engines and we're gearing up to use Outbrain, who will be crawling our canonical urls. I came across this post on Stack Overflow but am not sure how to edit for my needs.               function design_canonical() {        global $post;             if ( get_post_type( $post->ID ) == 'design' ) {            return site_url( '/design/' . $post->post_name );        } else {            // Leave blank and Yoast SEO will use default canonical for posts/pages        }     }     add_filter( 'wpseo_canonical', 'design_canonical' )      I'm thinking the `post->ID` doesn't need the `'design'` and the `return site_url` should be my custom meta box. How to edit it properly?


How can I set a vote on the comments?

In this wordpress blog, one can vote the comments. I am wondering how can I set up this function in my wordpress blog? ![enter image description here](http://i.stack.imgur.com/ymbkC.png)


WordPress object for comments frame

For two days I have tried to make this code work. I want to add a comment frame in `single.php`. I got this code to put it in the single page's template:               <script type="text/javascript" charset="utf-8">     initFrame({ app_id: 'xxx' ,     object_id: 'ARTICLE_ID' ,     object_title: 'ARTICLE_TITLE' ,     object_content: 'ARTICLE_CONTENT' ,     object_url: 'ARTICLE_URL' ,     arguments_container: 'comment' ,     width: '610' })     </script>      and they said: Replace strings with some logic:   * ARTICLE_ID: id of the article in your website.    * ARTICLE_TITLE: title of the article    * ARTICLE_CONTENT: body content of the article   * ARTICLE_URL: the url to the article    * DIV_ID: the div id where Naqeshny arguments box appears The question is: what should I write in ARTICLE_ID, ARTICLE_TITLE, etc. to change in every topic I write on my website?


Fields don't reflect previous Quick Edit changes when clicking Quick Edit a second time

I've added a column to the edit screen and add an input for that column in the quickedit. Everything saves and displays like I'd expect with one small hiccup. If I click on Quick Edit for a particular post, make a change to the custom input, and save.... well the column updates properly. However, if I click Quick Edit _again_ (without refreshing the page) the custom input maintains the original input.... the input isn't getting the new value, even though I am using `.on()`, `inlineEditPost.revert()` and even though the hidden value _is_ being properly updated (I can see it with Chrome's dev tools). Perhaps this is strictly a JS error, but I figured I would post here first. **This is the content of my custom column:**               echo $sub = get_post_meta(get_the_ID(), 'kia_subtitle', true);     echo '
' . $sub . '
';      **This is the jquery I am using to set the custom input's value in Quick Edit mode:**               $( '.editinline' ).on( 'click', function(){              // revert Quick Edit menu so that it refreshes properly         inlineEditPost.revert();              posttitlelabel = $( ':input[name="post_title"]', '.inline-edit-row' ).parents( 'label' );          tag_id = $( this ).parents( 'tr' ).attr( 'id' );             subtitle = $( 'div.kia-subtitle-value', '#' + tag_id ).text();                $( 'input.kia-subtitle-input', '.inline-edit-row' ).val( subtitle ).parents( 'label' ).insertAfter( posttitlelabel );          });      The `posttitlelabel`, and `insertAfter` parts are just to move the input so that it immediately follows the regular Title.


While loop inside another while loop

OK, so I've read like 20 different articles about using a while loop inside another while loop, but still can't get this to work, and I'm about to burst from frustration. My scenario: using the Advanced Custom Fields plugin along with the WP Coda Slider. My goal is to display a small gallery of images (that are loaded via the ACF plugin, on a custom post type) inside a Coda Slider. The images in the ACF are also using the Repeater addon for ACF. This requires the use of a while loop to output the images. Facts: parent field for images: portfolio-images field key for images: image php that ACF says will display the images:                <?php while(the_repeater_field('portfolio-images')): ?>      <a href="<?php the_sub_field('link'); ?>">      <img src="<?php the_sub_field('image'); ?>" alt="image" />            <?php endwhile; ?>      I'm already running this loop for the WP Coda Slider: `                           <div id="post-<?php the_ID(); ?>" <?php post_class('panel'); ?>>

{

<?php the_field('tagline'); ?>

}

<?php the_title(); ?>

                                  <?php the_content(); ?>

                    <?php endwhile; else:                    endif;          wp_reset_query(); ?>      I don't know what else to try at this point. Any help is very appreciated. Thanks.


Removing /blog/ from multisites cause infinite redirection

I have a wp installed with multisite enabled and working with subdirectories. I noticed that in the main blog (the one that exists by default on the root), the posts links had a "/blog" in the url before the permalink. So logged as the network admin I went to "All Sites > Edit" and I removed "/blog" from the permalink setting. But now when I visit a post at for example mydomain.com/post-name, I get a 301 redirect to the same url (/post-name), so the redirection is infinite. Why am I doing wrong?


how to arrange the bullet list items in vertical

This is my test_site .In there the list items are displaying not in order. I know this is because of some silly css problem. but I don't know how to write the css to make them to display neatly. I tried `display:inline,display:block` no use. can anybody please help me to attain this?


Separete trackbacks/pings and numbered comments

I've been googling around for tutorials of how to a) number the comments in the comment list and b) seperate trackbacks/pings from the rest of your comments. All the tutorials seem to be out of date?! They all suggest you look for something in your comment.php file that I haven't seen in any newer theme lately, namely:               <?php if ( $comments ) : ?>      or               <?php foreach ($comments as $comment) : ?>      I don't seem to have anything like that in my comment.php. I also checked the comment.template and comment.php in the wp-includes folder, but couldn't find anything. Also no luck looking through the function.php. Here's the comment-related snipped of my function.php:               function mytheme_comment($comment, $args, $depth) {     $GLOBALS['comment'] = $comment; ?>     <li <?php comment_class('clearfix'); ?> id="li-comment-<?php comment_ID() ?>">      <?php echo get_avatar($comment,$size='63'); ?>      <div id="comment-<?php comment_ID(); ?>">
         <?php printf(__('%s'), get_comment_author_link()) ?><?php edit_comment_link(__(''),'  ','') ?> <?php printf(__('%1$s @ %2$s'), get_comment_date('Y/n/j'),  get_comment_time('G:i')) ?>
           <?php comment_text() ?>

       <?php if ($comment->comment_approved == '0') : ?>          <?php _e('Your comment is awaiting moderation.') ?>
       <?php endif; ?>
          <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>

      And here's my comment.php: pastebin I'd really appreciate your advice. Thanks a lot.


Save user-specific options in WordPress admin

I'm writing a plugin that need to save user specific option in an admin page. I'm only thinking of adding username-prefix to option, for example:               $options = get_option('username-plugin_options');      Is there any better way doing that?


How to Removing fields from the Media Uploader/Gallery on a Custom Post Type Edit Page

This post shows how to remove unwanted fields from the media uploader. It works great, but I want to limit it to a custom-post-type and I can't seem to figure out how to do it. I've tried the following code, but it doesn't seem to work:               add_filter('attachment_fields_to_edit', 'remove_media_upload_fields', 10000, 2);     function remove_media_upload_fields( $form_fields, $post ) {     global $my_admin_page;     $screen = get_current_screen();     if ( 'slider' == $screen->post_type ){          unset( $form_fields['image-size'] );     unset( $form_fields['post_excerpt'] );     unset( $form_fields['url'] );     unset( $form_fields['image_url'] );     unset( $form_fields['align'] );          }          return $form_fields;     }      Any ideas on how to get this to work? Thanks, Moshe


Which action does wp_update_user triggers?

I am working modifying an ecommerce plugin, and it makes uses of wp_update_user() function, and everytime the function runs another table (created by the plugin), gets updated too. The problem is that the updated data on that second table is incorrect, and I am having troubles finding the part of the code that does it. **So I was wondering, does the wp_update_user( ) function triggers some "action" so I can search for that in all the files?** like those used in for example:               add_action('wp_logout', 'logout_handler');


term_exists returns NULL

According to the codex ( http://codex.wordpress.org/Function_Reference/term_exists ), term_exists returns some mixed results but not NULL. In my case, I'm getting NULL, what am I doing wrong? In this particular example 'Videos' term does not exist under category. Shouldn't it be returning a false or 0? Why NULL?               $term_exists_results = term_exists($term, 'category');          echo "
term_exists('{$term}', 'category')?";      echo "
";     var_dump ($term_exists_results);     echo "
";          /*     outputs...           Taxonomy: [category Term: [Videos]          term_exists('Videos', 'category')?               NULL                                        */


show only sub categories if available?

Hii i want that when i click on category link that show sub category if available instead of posts list If No Sub category available then show normal posts how to do this that if available sub categories only show just sub categories not any other posts Mean which extra code i add in my archive page that show sub categories if available otherwise show posts Thanks


Feeds not working on my wordpress site

I just made my wordpress website live finally and now trying to set up the RSS. I came across a couple tutorials saying that you have to go to www.yoursite.com/feed copy the link and place it into the URL area in your feedburner account. However what happens if nothing shows up when you go to www.yoursite.com/feed ? It says the URL does not exist, however I have a blog on the site. Is it because my permalinks aren't set to a custom permalink?


Remove "You are using Wordpress 3.2.1" from Right Now Dashboard Widget

I'm looking for a to hide the text on the dashboard that says "You are using WordPress 3.2.1" in the Right Now widget. Not that we don't love WordPress, but for our use-case (where we'll be providing this WP install to dozens, if not hundreds of people), I'd like to get as much stuff out of there that's not needed (and that could eventually confuse them). I saw that the Right Now Dashboard is in /wp-admin/includes/dashboard.php -- but can't figure out how to change/remove that text. Thanks!


Overide a function that is inside a plugin

I would like to change the behavior of one function in a plugin. Instead of rewriting the file and having to deal with updates I would prefer a solution that works similar to the way add_filter works for the wordpress core. Is this possible using either php or wordpress?


plugins_url vs plugin_dir_url

Im seeing WordPress plugins either use plugins_url or plugin_dir_url when creating constants to some of their folders. Is one better than the other? examples:               define( 'MEMBERS_URI', trailingslashit( plugin_dir_url( __FILE__ ) ) );     define( 'WPACCESS_INC', plugins_url( 'inc', __FILE__ ) , true );


Creating a function that receives the taxonomy terms that have been changed in a custom post type

Ive been looking into actions and hooks etc... from wordpress, but cant seem to do a very simple thing. I just want to execute a function whenever a post is updated, and within the function I want the names of the terms that have been changed on that save. So maybe some sort of before and after comparison of terms?? Could somebody please just give me a hint at the direction to go in? I started off with:               add_action('save_post', 'myFunction');      But I cant seem to pass the before and after taxonomy terms to it for a comparison to see which have just been selected.. if that makes sense. Thanks :)


Dont’t change active Button while I’m listing a category?

I have a simple Navigation: _Blog, About, Contact_. Mainsite is _Blog_. To keep the current Button highlighted, I used this in my CSS:                   li.current_page_item a{        border-bottom: 1px solid #212121;         padding-bottom: 1px;      }      It works pretty fine. But I want to keep _Blog_ still active while I’m listing an item from my categories. What is the best way to do this?


Combining multiple stylesheets into one conditional block

I have multiple IE specific stylesheets that I need to add to my theme (combining them is not an option at this time), in addition to the standard ones. I am able to get this to work using the `wp_enqueue_style` and `$wp_styles->add_data` but each are output in it's own conditional block. Is there a way to combine them all into one? Example Code               wp_enqueue_style('styles','//mydomain.com/assets/styles/build/screen.css',array(),'1.0','screen and (min-width:1px)');     wp_enqueue_style('screen-medium','//mydomain.com/assets/styles/build/screen_medium.css',array(),'1.0','screen and (min-width:768px)');       wp_enqueue_style('styles-ie8','//mydomain.com/assets/styles/build/screen.css',array(),'1.0','screen');     wp_enqueue_style('screen-medium-ie8','//mydomain.com/assets/styles/build/screen_medium.css',array(),'1.0','screen');          $wp_styles->add_data('styles-ie8', 'conditional', 'lte IE 8');     $wp_styles->add_data('screen-medium-ie8', 'conditional', 'lte IE 8');      outputs:               <link rel='stylesheet' id='styles-css'  href='//mydomain.com/assets/styles/build/screen.css?ver=1.0' type='text/css' media='screen and (min-width:1px)' />     <link rel='stylesheet' id='screen-medium-css'  href='//mydomain.com/assets/styles/build/screen_medium.css?ver=1.0' type='text/css' media='screen and (min-width:768px)' />     <!--[if lte IE 8]>     <link rel='stylesheet' id='styles-ie8-css'  href='//mydomain.com/assets/styles/build/screen.css?ver=1.0' type='text/css' media='screen' />     <![endif]-->     <!--[if lte IE 8]>     <link rel='stylesheet' id='screen-medium-ie8-css'  href='//previewext.3m.com/3m_theme_assets/themes/3MTheme/assets/styles/build/screen_medium.css?ver=1.0' type='text/css' media='screen' />     <![endif]-->      where what I would like is...               <link rel='stylesheet' id='styles-css'  href='//mydomain.com/assets/styles/build/screen.css?ver=1.0' type='text/css' media='screen and (min-width:1px)' />     <link rel='stylesheet' id='screen-medium-css'  href='//mydomain.com/assets/styles/build/screen_medium.css?ver=1.0' type='text/css' media='screen and (min-width:768px)' />     <!--[if lte IE 8]>        <link rel='stylesheet' id='styles-ie8-css'  href='//mydomain.com/assets/styles/build/screen.css?ver=1.0' type='text/css' media='screen' />        <link rel='stylesheet' id='screen-medium-ie8-css'  href='//previewext.3m.com/3m_theme_assets/themes/3MTheme/assets/styles/build/screen_medium.css?ver=1.0' type='text/css' media='screen' />     <![endif]-->      I tried using an array for the `$wp_styles->add_data(array('styles-ie8', 'screen-medium-ie8-css'), 'conditional', 'lte IE 8')` but that didn't work and errored out the page. Any example I've found searching only uses one stylesheet per conditional block. I need to add about 5 or 6 with the same condition, so would ideally like to combine them, yet still use `wp_enqueue_style`.


Custom category URL not displaying posts

I have a custom post type with custom categories using the following:               add_action( 'init', 'create_post_type' );     function create_post_type() {         register_post_type( 'products',             array(                 'labels' => array(                     'name' => __( 'Products' ),                     'singular_name' => __( 'Product' )                 ),             'capability_type' => 'post',             'supports' => array('title','editor','comments'),                'public' => true,             'has_archive' => true,             'rewrite' => array( 'slug' => 'products' ),             )         );     }          function news_init() {         // create a new taxonomy         register_taxonomy(             'products',             'products',             array(                 'label' => __( 'Product Categories' ),                 'sort' => true,                 'hierarchical' => true,                 'args' => array( 'orderby' => 'term_order' ),                 'rewrite' => array( 'slug' => 'products' )             )         );           }     add_action( 'init', 'news_init' );      For some reason I just can't display the posts for specific categories. Can someone point me in the right direction? I'm trying to goto the url /products/category/monitors for example but it displays a page not found. I've duplicated the archive.php template and renamed it category-monitors.php.


How to Make Archive ShortCode

I checked that there is an shortcode on wordpress.com but it seems there is no build in way of adding the shortcode of archive on wordpress.org site. I know there was one plugin in repo but it's 2 years old with no updates in code. So let's say if i want to return the archive. following shortcode doesn't work. Is there anything I am missing? Or is there any way to make this work?                function archive{                return '<?php wp_get_archives('type=monthly'); ?>';           }      add_action('archives', 'archive');


remove 2014 from wp_get_archives

we have `wp_get_archives('type=monthly');` function that have a output like this:               Archives by Month:     January 2014     December 2013     November 2013      but I want style like a table that sorted by years:               2014     January     -------------     2013     December    November


Children categories not shown in dashboard

First of all: it's a strange behavior, but it works. 1) I'm working on a script, so i require the wp-load.php and after that i operate; 2) The scripts creates some categories using wp_insert_term in a hierarchically (Abruzzo > Chieti > Atessa), respectively abruzzo, chieti- abruzzo, chieti-abruzzo-atessa; 3) Here's the strange: it creates the categories good, but as you can see in the screenshot they are not visible in the dashboard. BUT i can use them, they are available (hierarchically) in a post or even to create others category using them as parents. They just don't show (the children) in this single point of the dashboard. If i create another category and i refresh the page (or even if i delete some), they will be shown. So i think it's something like a database issue. I read that the wp_insert_term func should be used into/after the 'init' hook. But as i just said.. i'm in a script. Workarounds/Solutions? ![enter image description here](http://i.stack.imgur.com/St42h.png)