How to pass hook variable to function?

I have a function that has an add_action inside it that calls the user_register hook. I would like to be able to echo the variable $user_id from the user_register hook and the $_POST array as well. (Ok, my goal is to do more than that, but you get the idea). See below:               function my_function{          add_action( 'user_register' .....              .         .         .     echo $user_id;     var_dump ($_POST);         .         .         .     }      How might I accomplish this? I realize this is probably really simple but examples that I've seen haven't used an add_action inside another function. Thanks for any help.


Adding a captcha plugin for comments in the site

Hi, I am new to WordPress.I need to add captcha in my site just before the comments section. Wherever there is comments, I need to display the captcha. I do not have a form. How can I do it?


Exclude content from w3 total cache

I use w3 total cache on a site I run which also now has to display a small popup at the bottom of the page to mention that the site uses cookies (thanks EU). The idea is that this only appears the first time the user sees the page, a cookie is then set to make sure the site doesn't show this user the popup again. However W3 will often cache a version of the site with this popup visible meaning the popup is shown regardless of the cookie existing or not. The popup is drawn with a `<div>` at the bottom of each page and it is only drawn if the cookie is set. Essentially the question is, how can I exclude W3 cache from always showing this? Is this even possible, or is there an alternative to how this popup is shown that gets around this issue? Thanks.


Why is my select meta data not saving?

I am working on a site at the moment where I need to save several different types of meta data for a custom post type. At present I have a text input that is saving with no problem but am struggling to get a select field to do the same. This is the function that outputs the select field:               function kwi_department_input() {         // Define function to create meta box for team member department.              global $post;         echo '<input type="hidden" name="teammeta_noncename" id="teammeta_noncename" value="' . wp_create_nonce(plugin_basename(__FILE__)) . '" />';         $department = get_post_meta($post->ID, '_department', true); ?>              <select name="_department" id="_department">             <option value="Directors" <?php selected($department, 'Directors'); ?>>Directors</option>             <option value="Finance / Admin" <?php selected($department, 'Finance / Admin'); ?>>Finance / Admin</option>             <option value="Customer Service Team" <?php selected($department, 'Customer Service Team'); ?>>Customer Service Team</option>             <option value="Commercial Team" <?php selected($department, 'Commercial Team'); ?>>Commercial Team</option>         </select>     <?php }      And this is the function that saves all of the data:               function kwi_save_team_meta($post_id) {         if( !wp_verify_nonce( $_POST['teammeta_noncename'], plugin_basename(__FILE__) )) {             return $post_id;         }              if( !current_user_can( 'edit_post', $post_id ) ) {             return $post_id;         }              $team_meta = array(             '_department' => $_POST['_department'],              '_languages' => $_POST['_languages'] // Languages is the text input that is saving with no issue.         );              foreach($team_meta as $key => $value) {             if(get_post_meta($post_id, $key, FALSE)) {                 update_post_meta($post_id, $key, $value);             } else {                 add_post_meta($post_id, $key, $value);             }             if(!$value) {                 delete_post_meta($post_id, $key);             }         }     }      Any pointers as to what I'm doing wrong would be much appreciated.


Is there a way to fire other functions from wp_insert_post

I am creating a new post using the `wp_insert_post` function. Here's what that code looks like:               $new_post = array(                 'post_title' => $newtitle,                 'post_status' => 'publish',                 'post_content' => $repost[content],                 'post_excerpt' => $repost[excerpt],                 'post_author' => 1,                 'post_type' => 'post',                 'post_category' => explode(",",$catlist),              );                  wp_insert_post($new_post);      The post is created fine, but I'd like to fire some other functions, such as Jetpack's social posting tools (Publicize.) Is there code to do that or would I be better in changing the post_status to draft and setting a future publishing date?


How to show months in wordpress archive page?

I am a newbie to wordpress and have no knowledge of PHP. I want to show the months in my archive page, in this manner ![enter image description here](http://i.stack.imgur.com/xQcc4.png) where, it shows the starting month when i my first post was made and continues to shows all months and year, till the current month of the year. I want the months to be hyperlinks of this manner `http://bibhudutta.com/2014/3/` based on each month and year. Please help me out, how to do it in PHP and wordpress.


Currently using a query_posts() in my theme - want to use a request filter in stead

I am currently using this code in my theme right before showing the content of the custom post type my_post_type:               $title = $post->post_title;     query_posts( array (         'post_type' => 'page',          'posts_per_page' => -1,         'my_taxonomy' => $title         ));      This means that when I go to .../my_post_type/some_title, I see all pages that are assigned "some_title" as my_taxonomy. Now I want to do the same thing in a plugin in stead of a theme. This means is (I guess) that I have to use the "request" filter? I have tried to do this:               add_filter( 'request', 'alter_the_query' );     function alter_the_query( $request ) {         $request['post_type'] = 'page';         $request['my_taxonomy'] = 'some_title'; // just hardcoded so far while testing         $request['posts_per_page'] =  -1;         return $request;     }      But it doen't return any pages at all. Not even this works:               add_filter( 'request', 'alter_the_query' );     function alter_the_query( $request ) {         $request['post_type'] = 'page';         return $request;     }      What am I doing wrong, or how can I achieve the same thing as my with my call to query_posts()? Thanks a lot!


Moving wp-admin folder to a different host in a multisite environment

Current Multisite setup:   * First site: `www.site1.com`   * Second site: `subdomain.site1.com`   * Admin: `www.site1.com/wp-admin/` How to move wp-admin to a different host, which is accessed via a domain say `admin.site1.com`?


How to display all category images for single post in a page?

Here is my code

Microsoft
     <?php foreach (get_the_category() as $cat) : ?>

<img src="<?php echo z_taxonomy_image_url($cat->term_id); ?>" />
     <?php echo $cat->cat_name; ?>
     <?php endforeach; ?>


How to extend the page editor?

I'm really a newbie to WordPress. I can edit the page via admin Page menu. There is a form submitted on that page. How can I write my own functions to handle this form submission?   In other words, how could WordPress recognize the route in form ACTION, and forward to my functions? Use a plugin?


Store loop into array

I am using folowing code to store posts ids into array:               <?php         $args = array(             'post_type' => 'product',             'post_status' => 'publish',             'ignore_sticky_posts'   => 1,             'posts_per_page' => 5,             'orderby' => 'date',             'order' => 'desc');     $id = array();     $counter = 1;            $products = new WP_Query( $args );     if ( $products->have_posts() ) : while ( $products->have_posts() ) : $products->the_post();         $id[$counter] = get_the_id();         //custom_shop_array_create($product, $counter);         $counter++;     endwhile;     endif;     ?>      However it doesnt work because if I put `print_r($id)` after endif it only prints id of last post. Where am I making mistake? Thanks in forward


Weird issue where form field loses focus to previous form field even with JS disabled

I've never seen a problem like this in my 12 years of working on the web. Even with Javascript disabled (in all browsers, with all users on different computers), a field that gets focus then loses it to the previous form field. I thought I had some rogue jQuery somewhere but couldn't find any... then decided to disable Javascript and see what happens. The same problem exists. What the deuce kind of wizardry is this?!? Attached is a link to a screencast demonstrating the issue. Note that the first bit shows the problem with JS enabled (as demonstrated by the presence of TinyMCE toolbar) and the second is without (as demonstrated WITHOUT TinyMCE). Help?! http://screencast.com/t/y2NfpGa8z


Don't show certain div on front page?

I have CSS issues with a certain div only on the front page (front-page.php). As I can't fix it, I was thinking about removing the item, but only on the front-page. I'm not exactly sure how I have to code this in Wordpress. I want this div in the Header to show up everywhere but on the front-page.php:               <!-- BEGIN TOP SEARCH -->          <form id="searchform" action="<?php bloginfo('url'); ?>/" method="get">                         <input type="submit" value="" id="searchsubmit"/>     <input type="text" class="field" name="s" id="s" value="Search or be lost" onfocus="this.value=''" />                          </form>                 </div>                 <!-- END TOP SEARCH -->      Is this possible?


Wordpress 3.3 auto update not working

I am at my wit's end! Trying to auto upgrade to Wordpress 3.3 and its not working. I have tried every trick I found on the net   1. The entire wordpress directory and all its sub directories has been given 0777    2. Somewhere I saw a tip about deleting the upgrade directory and trying again, BUT no upgrade directory is ever created. When I try to upgrade wordpress, I get so far as to WP asking me for FTP info, which I do provide (and it is 100% correct) and then when I hit next nothing happens. I just see a semi blank page with the left hand menus and nothing on the right hand side, the page just keeps loading and loading and loading. No error log is created, no error mesages are displayed on screen. I am going to pull out my hair in frustration. Please help.


Add qtranslate language select box to menu

I can't find any info on how to operate qtranslate and add the select box to change language to the right of my header navigation. Any ideas?


Recovering a wordpress blog that got corrupted

recently i had my blog up and running, but i installed some new software by accident and messed it up.i have reinstalled my word press, and i was wondering is there a way i can recover my old post? I really would like to be able to add them to my new installed word press blog. I tried to use MyAdminPHP but didn't have any idea how to look for the post and fine them.


Use specific language for comment section

On some pages I have the possibility to write a comment (name, email, website, comment). The labels are now in my default language. Now I want to use the English labels for the whole comment section. How can I reach this? I searched a little bit and found out that I can set some labels with               <?php comment_form(array('label_submit' => 'Submit comment' )); ?>       But then I would have to set each label and I don't know if I can find and catch all these labels. Are there other ways doing this? PS: The comments.php is from Twenty Eleven Theme and I'm using WPML.


Infinite Scroll on Self-hosted Wordpress

Trying to move a Wordpress website from Wordpress.com to a self-hosted version. http://onvegetables.com/ The site automatically had infinite scroll on Wordpress.com and I'm trying to implement that on the self-hosted version. Is that feature part of the JetPack plugin? If not does WordPress offer a way to simulate that functionality on self-hosted?


I'm trying to build a complex search form with filters for several custom taxonomies, a search terms input and a select for the number of items displayed / page. The question has been posted before over at Advanced search form with filters for custom taxonomies and custom fields and the answer provided by Brady was an excellent starting point. I'm going to try my best to explain the functionality, here's the page template source https://gist.github.com/a82329d519c93d35f1f3 Basically, I have the 'interview' custom type and 2 taxonomies 'interview- type' and 'interview-cat' which will have filters inside the form. There are actually 2 different forms, both containing search filters: #search- filters, which is the main one, and #type-filters, which only has 3 buttons for the 'custom-type' taxonomy values. Both of these forms work the way I want them to, but there are a couple of problems still: The biggest one is pagination: The function mytheme_page_navi is the same as the WP-PageNavi plugin, and the problem here is that as soon as I go to the second page, I lose all the filter values, and it displays posts from the 'written' 'interview-type', 10 posts / page ( which are the default values, for when the user first arrives on the page and hasn't selected any options yet. ) Why does this happen? Also, another problem is that because I have 2 forms, if I enter some values in the main one, and then select the 'interview-type' from the #type-filters, all the previous filter values are removed. In the end, I would be grateful if someone could take a quick look over the code and point out what I'm doing wrong. I've been trying to wrap my head around this for days with no luck.


Filter by one custom field, order by another?

I have a custom post type "Listing" and I want to get all Listings that have a custom field `gateway_value != 'Yes'`, and order the results by another custom field, `location_level1_value`. I can get the queries to work separately, but I can't combine them: # Query 1 (sort by location):                               $wp_query = new WP_Query( array (                         'post_type' => 'listing',                         'post_status' => 'publish',                         'posts_per_page' => '9',                         'meta_key' => 'location_level1_value',                         'orderby' => 'location_level1_value',                         'order' => 'ASC',                         'paged' => $paged                         )                      );      # Query 2 (custom field value != Yes):                               $wp_query = new WP_Query( array (                         'post_type' => 'listing',                         'posts_per_page' => '9',                         'post_status' => 'publish',                         'meta_key' => 'gateway_value',                         'meta_value' => 'Yes',                         'meta_compare' => '!=',                         'paged' => $paged                         )                     );      # Combined query: I looked at the codex for help with this, but the following query does not work:                               $wp_query = new WP_Query( array (                         'post_type' => 'listing',                         'posts_per_page' => '9',                         'post_status' => 'publish',                         'meta_query' => array(                             array(                                 'key' => 'gateway_value',                                 'value' => 'Yes',                                 'compare' => '!='                             ),                             array(                                 'key' => 'location_level1_value'                             )                         ),                         'orderby' => "location_level1_value",                         'order' => 'ASC',                         'paged' => $paged                         )                     );      What am I doing wrong with the combined query? [UPDATE]: So now that 3.1 has been released, the combined query above still does not work. I do get results, just not sorted correctly. [UPDATE]: `var_dump($wp_query->request)` gives the following:   `string(527) " SELECT SQL_CALC_FOUND_ROWS wp_7v1oev_posts.* FROM wp_7v1oev_posts INNER JOIN wp_7v1oev_postmeta ON (wp_7v1oev_posts.ID = wp_7v1oev_postmeta.post_id) INNER JOIN wp_7v1oev_postmeta AS mt1 ON (wp_7v1oev_posts.ID = mt1.post_id) WHERE 1=1 AND wp_7v1oev_posts.post_type = 'listing' AND (wp_7v1oev_posts.post_status = 'publish') AND wp_7v1oev_postmeta.meta_key = 'gateway_value' AND CAST(wp_7v1oev_postmeta.meta_value AS CHAR) != 'Yes' AND mt1.meta_key = 'location_level1_value' ORDER BY wp_7v1oev_posts.post_date DESC LIMIT 0, 9"`


Save_post for custom post type?

Is there a save_post hook for custom post types? example: save_my_post_type I know there is publish_my_post_type but I'm looking for a save hook.


How to cleanly delete attachment but retain original file?

`wp_delete_attachment()` is very comprehensive and wipes every trace of attachment from database and disk. Is there easy way to keep original file? Forking under another name is not an option, because other functions like `wp_delete_post()` will still call original version.


Import CSV to MySQL, with custom registration field information

I have to update the information of 1500 members of my clients Wordpress site. I'm using a membership to manage paidd subscriptions and I have to update the custom fields generated by this Plugin. I have looked in the MySQL database and found the following meta keys in the wp_usermeta table: paypal_user, paypal_status, paypal_custom_fields Pyapal_user and paypal_custom_fields have a several bits of information in each one that need updating. I know how to import to MySQL using a CSV, but I'm not too sure how to set the data out in the CSV file as I'm not to familiar with MySQL. Would anyone know? Thanks in advance.


Optimize post insert and delete for bulk operations?

Not much noticeable when working with individual posts, but when you create or delete multiple thousands in bulk and by code - process is quite slow. Are there any good tweaks to apply and corners to cut? Context:   * `wp_insert_post()` with categories and tags passed;   * add several custom fields;   * create and associate attachments (from existing files).


Custom post type name and url parent/child structure 404 issue

I'm having a conflict between the name of my custom post type and my url structure. I've got a custom post type called 'timber-frames'. The 'timber-frames' landing page uses a page template that displays all posts for the 'timber- frames' CPT. Essentially a custom archive using a page template. Example url: mysite.com/timber-frames (this shows all the posts from the 'timber-frames' CPT) I also have a custom taxonomy for the CPT, within which I have terms such as 'engineering', 'design', etc. I've set up custom archive pages for each of these terms as well, creating sub-sections under the 'timber-frames' parent. These each use separate page templates to allow my client to edit content on each page. Example url: mysite.com/timber-frames/engineering (this shows all the posts categorized as 'engineering' within the 'timber-frames' CPT) This is all well and good, but I get a 404 on the front end when trying to access the term archive pages. Tried resetting/flushing the permalinks, but it didn't work. The conflict appears to be that the parent page slug is the same as the slug of the CPT. Specifically, 'timber-frames'. When I make the names different from each other everything works fine, but I need the url structure to consistently show 'timber-frames' as the parent. I've been scouring the web for a solution but haven't come across anything that seems to do the trick. Any help is appreciated! \-- **UPDATE Aug 31 2013:** I may have made my original question too complicated. Essentially I've got a custom post type called 'timber-frames', which, for single posts, gives me a url structure of mysite.com/timber-frames/single- custom-post But I also want to have child pages (not posts) with the same url structure, like this: mysite.com/timber-frames/child-page The parent page works just fine...mysite.com/timber-frames...but any child page under that throws a 404. Again, flushing permalinks doesn't work. Thanks in advance!


How to create a drop down list with pages to a themes options page?

I'm building a themes options page using settings API. Everything is ok, but i now i want to create a drop down list populated with pages and i don't know how to! For example, i have this piece of code that show the list of pages, but when i select a page and cick on save, the page selected doesn't get saved!                   function  combo_select_page_callback() {     $options = get_option('journal_theme_blog_2_col');         echo "<select name='select_page'>      <option value=''>";     echo esc_attr( __( 'Select page' ) ); ?></option>      <?php       $pages = get_pages();       foreach ( $pages as $page ) {         $selected = '<option value="' . get_page_link( $page->ID ) . '">';         $selected .= $page->post_title;         $selected .= '</option>';         echo $selected;       }     echo '</select>';     }// end combo_select_page_callback      Thank for the help, nelson


How to make different custom post layouts?

I am new to wordpress, and have encountered some difficulty in making my own custom layouts. I'm using _S framework (underscore.me) as well as Custom Post Templates plugin. I'm using custom fields to inject images above the title of posts currently, and that's worked so far but I encounter problems when trying to make index- only custom layouts for post's as well as applying CSS to the custom fields. The custom index only post appearances are about three in number, one of which is how I want posts to look like by default. What I'd like to know is which files should I be looking at, and some guidance on how I should go about modifying (as some elements seem not to change when I wrap/apply CSS to them) to change the index only appearance as I currently am able to modify the appearance of the post page itself. If more info is required I can post it


Dynamic sidebar no longer functioning

I have 3 related websites in english, dutch and italian : www.gynsurgery.org, www.gynsurgery.be and www.mondoginecologico.it about 4 months ago I found the theme of the italian site changed to twenty eleven, while the original theme had disappeared I restaured the theme of the italian site from the english functional site, but cannot find why the dynamic sidebar is no longer functional Anybody a hint were to look ?


I get the following message The uploaded file could not be moved to /home/reascom/public_html/wp-content/uploads/2012/07

The uploaded file could not be moved to /home/reascom/public_html/wp- content/uploads/2012/07. This is the message I get when I try to load anything to my existing web site. images and themes get this message. What should i do?


(Solved) category link not working

I created a theme using wamp. It works fine and all, but when I uploaded it to the server, I am having problems with categories. It always generate this url: http://deremoe.com/reviews/ this is what get_category_link() is giving me on my webserver. It should be: http://deremoe.com/category/reviews/ What I did:   1. Reset Permalink   2. /?index.php/%postname% custom category What should I do more on this? Thanks.


How Do I Protect My Premium WordPress App Theme from Copying?

They say WordPress is GPL, and therefore all plugins and themes made with it are supposed to be GPL. Fine, but if I spent three months coding an extremely complex app theme with the intent on selling it repeatedly for profit, such as a medical office scheduling system theme, then how can I protect my investment, if even a moderate amount?


filtering special chars from post slug

Is there a way to prevent WordPress from including special characters like – (long dash), ", ', etc.. from the post slugs? Basically, I'd like to run the post-slug through a filter when it is created, and strip any special chars. The reason is, that it's giving me problems as these show up as utf8-urlencoded in my rss feed, and those links don't work.


Why is taxonmy-[taxonomyname].php not working?

I've registered a couple of custom taxonomies to go with a couple of custom post types but I'm having some trouble getting a template file to work. I've tried taxonomy.php, taxonomy-[termname].php, taxonomy-[taxonomyname].php but none seem to register and the link reverts to index.php You can see an example of this here - http://wordman.deanelliott.me/portfolio/ just click on any of the links inside the yellow box and instead of going to a specific taxonomy template page it uses index.php I'm not sure if it makes a difference, but this is the code I'm using to register the taxonomy               register_taxonomy('cat', 'portfolio',  array('hierarchical' => false, 'label' => 'Category','query_var'  => true, 'rewrite' => true));


Hook midway through the_content();?

Basically, I want to add a function that executes half way through the_content(); I want to add a message/ad block whatever in the middle of all of my content without having to go in to each individual page and add the block. Is this even possible?


Easy way to import a post from Word?

I have a post written in Microsoft Word with images, text and some formating. Is there some easy way to import this document into WordPress? Either a plugin for Word og perhaps a plugin inside WordPress? I'm looking for something simple that also converts images.


template_redirect called twice

I am working of a simple redirect plugin that match the given slug and redirect to the assigned url, which i supposed to working fine. But recently i am adding the functionality to update the stat for the visited slug and i found that my update query called twice, i checked and found that `template_redirect` hook called twice. My stat update query is applied on single time only. Here is my code:               add_action("template_redirect", array($this, "redirection_section"), 11);          function redirection_section() {         if( is_404() )             $this->uni_page_redirect();     }          function uni_page_redirect() {                  include_once dirname(__FILE__) . '/uni_links.php';             $Links = new UNI_Links();                  $slug = ltrim(preg_replace('#/$#', '', urldecode($_SERVER['REQUEST_URI'])), '/');                       if( $Links->is_valid_slug($slug) ) {                 // Initiate with Slug                 do_action("ulr_init_slug", $slug);                 $Links->generate_links($slug);                 exit();             }                  return false;              }      Now this is how i am updating my query:               function slug_init_callback($slug_name) {             global $wpdb;                  $table_slugs = ULR_TABLE_SLUGS;                  // Debug to check invoks             file_put_contents(PLUGIN_BASE . '/debug.txt', "call \r\n", FILE_APPEND);             $sql = $wpdb->prepare("update {$table_slugs} set stat= stat+1 where slug_name=%s", $slug_name);             $wpdb->query($sql);         }      Your help is highly appreciated. Thanks


WP_Query get posts from custom posts by category

ive been playing around with this for ages and for some reason I cant get it to work. This is from within the single post page of a custom post type... Basically I am getting the category of the custom post type by using the get_the_term and then doing a foreach to nicely input into a string. I then use a WP_Query to retrieve, but I think I have the logic wrong. This is what I have               // post types query     if ( have_posts() ) : while ( have_posts() ) :the_post();          // getting the categories     $categorynames = '';     $getcategory = get_the_terms($post->ID, 'custompostnamehere-categories');          foreach($getcategory as $t){ $categorynames .= $t->term_id.' ,';}          if (substr($categorynames, -1) == ',') {     $categorynames = substr($categorynames, 0, -1);     }          // end of post type query     endwhile; endif; wp_reset_query();           //starting new query to get related posts within the same categories     $args = array(       'post_type' => 'custompostnamehere',       'cat' => $categorynames,       'posts_per_page' => 20     );     $q = new WP_Query($args);          // retrieving the data     while($q->have_posts()){          }      Could someone please enlighten me on my wrong doings. Thanks


Remove default WordPress widgets

Hey guys here is the problem I have added 2 sidebars to my blog, however when I change their visibility to only appear on front page and when I click on a specific post ALL of the default widgets available appear for some reason. How do I change that?


How to add class to an html output element in tinyMCE paragraph drop down menu

I tried to modify the TinyMCE behaviour in the functions.php. I try to accomplish that e.g. h4 gets a class of "headliner" per default. I am half way there. I found a setting to create a drop down menu and within it is populated with my custom styles/classes:               function tinymce_mod( $init ) {         $init['theme_advanced_buttons2_add'] = 'styleselect';         $init['theme_advanced_styles'] = "Header 4=mus-bi";         return $init;     }     add_filter('tiny_mce_before_init', 'tinymce_mod');      but that way it is rather confusing to have two style related drop down menus: ![paragraph and style drop downs](http://i.stack.imgur.com/iED93.png) So would it be possible to just alter the wp native styles in the paragraph dropdown and assign the class "headliner" to the Header 4 in the paragraph drop down there and drop the style drop down? Best regards Ralf


How to remove title from category page in header

I am trying to not show the page title on certain pages, including home, a custom post types page, and a category page (/category/blog). I came up with this, and it's working for everything but the blog page.               if ( !is_front_page()  && !is_post_type_archive('location') && !is_page_template('category-blog.php')) :

<?php the_title(); ?>

           endif;


Wordpress doesn't generate rel=prev & rel=next

I am developing a Wordpress theme from scratch and I've been using `previous_post_link()` & `next_post_link()` quite often and never had any trouble using them. Until now.. So what I'm trying to accomplish is the following: Person X is on a single blog post page and wants to navigate to the next or previous post without going back to the overview. Here's the thing: Wordpress generates the _rel=prev_ and _next_ tags in the `<head>` section for all pages except the ones that have something to do with the blog. So for example: single posts or the overview page. I haven't done any edits to the `wp_head()`; whatsoever so I am clueless on this one and I hope someone knows a non-plugin solution. **Edit:**   `previous_post_link()` & `next_post_link()` do work on custom post types, just not on the normal blog.


Change Query Arguments (filter) with jQuery/Ajax or PHP?

I have a pretty complex wordpress-site for travelling. There's an "archive- hotels.php", a template for the custom-post-type "Hotels". Inside the CPT is a taxonomy called "City", so we can do this: domain.com/hotels/city. Works perfectly. Now there's a filter on the site, which should filter the shown posts by stuff that the author has added over custom fields (Advanced Custom Fields Plugin) like "Features" or "Price Range". Now I'm not sure how to filter that query. With PHP? jQuery (there shouldnt be too much posts in hotels/city/)? or Ajax to work that dataload, which will be after years of publishing? Domain www.business-travelling.de/hotels/hamburg


Values inside a custom field to determine which category posts to display

I am facing a little problem whilst trying to display posts, from certain categories, on the front end. I've created a custom field whose key is 'related_categories' and I've different categories with slugs such as 'army', 'navy', 'airforce' etc. When creating a new custom post, I enter the slugs of different categories inside the 'related_categories' custom field, for e.g. 'navy', 'airforce', and this is the code which I've inside my template file to echo the custom field values inside the 'tax_query' array.               <?php global $post;          $related = array ( get_post_meta($post->ID, 'related_categories', true) );          $the_query = new WP_Query( array( 'post_type' => 'medals', 'posts_per_page' => 3, 'tax_query' => array( array( 'taxonomy' => 'medal-categories', 'field' => 'slug', 'terms' => $related, ), ), ) );           while ( $the_query->have_posts() ) : $the_query->the_post();           //loop starts after this      Now the problem which I am facing is that if I enter only one slug inside the 'related_categories' custom field, for e.g. 'navy', then the posts from the 'navy' category successfully show up but if I enter more than one slug inside the 'related_categories' custom field, for e.g. 'navy', 'army', then the posts do not show up. I tried searching for a solution on the internet but couldn't find any therefore any help would be appreciated. Thank you.


How to check a list or feed of all posts under a category and tag?

Consider this question from the point-of-view of a visitor to a WordPress blog, and not as a WordPress blog admin who can edit those numerous PHP files. How can I see a list of all the posts under a category and a tag? Not clear? Let me explain with an example: > I have two categories -- _Social Media (social)_ and _Web (web)_ , and I > have a tag _Tips and Tricks (tips-and-tricks)_. > > Consider that I use the tag frequently with posts under both categories. The > question is, how can a visitor to my blog, check posts tagged "tips-and- > tricks" and under "social" category? I am looking for a solution _similar to_ this: `http://example.com/feed/?cat=11,12` (which we use to combine rss feeds of multiple categories). Thanks.


Issues with page load after CSV export of database

I'm having an odd issue. I am using GEO my WP plugin (http://geomywp.com/) to create some custom post types and search forms on the front end. I am trying to import a database with about 600 posts (lots of information). Because I'm having some issues getting that information to import properly, I'm trying to export the existing database so I can compare it with the version I plan on importing. The odd issue: each time I export this using a plugin called WP CSV https://wordpress.org/plugins/wp-csv/ (which allows me to export all of the table information for just that post type)—I no longer can load any page of the site on any browser. This blank page (no html generated) lasts for an unspecific amount of time, I just have to refresh every few minutes (or hours) until the site is back. WP Supercache is deactivated—no other caching is on. I've tried resetting DNS Cache, and all browser cache, etc.. No cigar. Anyone experience something like this? The only assumption I can make is that the database is overloaded? Or that the server has some weird caching going on and I need to call my host. Any suggestions / shared experiences appreciated.


making changes within a wordpress theme

I am trying to find exactly where the changes can be made within a WordPress theme. I have looked into `index.php` and have the following, but have not found any files that match:               <?php     /**      * Front to the WordPress application. This file doesn't do anything, but loads      * wp-blog-header.php which does and tells WordPress to load the theme.      *      * @package WordPress      */          /**      * Tells WordPress to load the WordPress theme and output it.      *      * @var bool      */     define('WP_USE_THEMES', true);          /** Loads the WordPress Environment and Template */     require('./wp-blog-header.php');


wp_insert_post sometimes fails after API call

I have built a plugin that fires an Ajax call to connect to a third-party API. That API returns some Json, which I then save as a custom post with `wp_insert_post`. Now, usually, this works. But, now and again, the save fails, with a "MySQL server has gone away" error. I'm assuming this is because the API took too long to respond (maybe 30 secs), and so the connection closed. Does this sound like the correct conclusion? And if so, how can I handle this from within the plugin? EDIT: 20 secs doesn't seem long enough for a timeout, so I'm baffled by this one...


WP_Query of a custom post type isn't working

I am trying to `WP_Query` a custom post type. I would like to display the `post_title` s in a list. Here is my code, it doesn't seem to work:               <?php     add_action( 'init', 'custom_faq_type_mp' );     function custom_faq_type_mp() {         register_post_type( 'faq_type_mp', array(             'labels' => array(                 'name' => 'View current FAQs ',                 'singular_name' => 'FAQ',                 'add_new' => 'Add New FAQ',                 'add_new_item' => 'Add New FAQ',                 'edit' => 'Edit',                 'edit_item' => 'Edit FAQ',                 'new_item' => 'New FAQ',                 'view' => 'View',                 'view_item' => 'View FAQ',                 'search_items' => 'Search FAQs',                 'not_found' => 'No FAQs found', 'not_found_in_trash' => 'No Forms found in Trash',                 'parent' => 'Parent Form'             ),             'public' => true,             'menu_position' => 15,             'supports' => array( 'title', 'editor' ),             'taxonomies' => array( '' ),             'menu_icon' =>             plugins_url( 'images/image.png', FILE ),             'has_archive' => true         ) );     }           // change the new title line to     add_filter( 'enter_title_here', 'change_default_title' );     function change_default_title( $title ){         $screen = get_current_screen();         if ( $screen->post_type == 'faq_type_mp' ) {             return 'Enter New FAQ Here';         }     }           // Display the FAQs using a shortcode     add_action( 'init', ' mp_faq_register_shortcodes' );     function mp_faq_register_shortcodes() {         /* register the [display_faqs] shortcode */              add_shortcode( 'display_faqs', 'mp_faq_shortcode' );     }          function mp_faq_shortcode() {         /* Query albums from the database */         $loop = new WP_Query( array(             'post_type' => 'faq_type_mp',             'orderby' => 'title',             'order' => 'ASC',             'post_per_page' => -1,         ) );          /* check if any faqa were returned */         if ($loop->have_posts() ) {             /*open an unordered list */             $output = '';             / loop through the faqs (the loop) */             while ($loop->have_posts() ) {                 $loop->the_post();                 /*display the faq question */                 $output .= post_title() ,             } /*close the unordered list */             $output .= '';         } /*if no faqs were found */         else {             $output = 'No FAQa have been published.';         } /*return the faq list */         return $output;     }       My error is below the `// Display the FAQs using a shortcode` comment. Have you got any solutions? Thank-you.


Exclude page name from loop

I'm currently using this loop:               if (is_single() || is_page() ) :       if (have_posts() ) :         while (have_posts() ) :         the_post();      How can I exclude multiple pages within the loop?   For an example, I want to exclude pages `example.com/music` and `example.com/contact`. EDIT: I've done the way G.M provide, but my music and contact pages keeps loading after apply.               <?php if (is_single() || is_page() ) : if (have_posts() ) : $exclude_pages = array('music', 'contact'); while (have_posts() ) : if ( is_page() && ! empty($exclude_pages) && (           in_array($post->post_name, (array)$exclude_pages) ||           in_array($post->post_name, (array)$exclude_pages)       ) ) continue; the_post(); ?>     <meta name="description" content="<?php the_content_limit(150)?>" />     // loop continues     <?php endwhile; endif;      elseif (is_home() ): ?>     // loop continues          <?php endif; ?>          <?php if( is_page( 'music' )) { ?>     <meta property="og:image" content="" />     //loop continues     <?php } ?>      So to clarify: I'd like to exclude some meta tags that i'm generating via a loop in the header.php Now with my loop, all pages and post get affected by the loop. So I don't want the pages music and contact to have the same header tags from the loop in header.php.


Multisite blog converting categories to subdomains

Having `http://site.com/category/xyz` = `http://xyz.site.com/` I would like to move the content from each category to its equivalent subdomain blog, so that when I will access `http://site.com/new-post/`, where the post belongs to category `XYZ`, `site.com` will do a `301` redirect to `http://xyz.site.com/new-post/` So, is there any other way besides then the hardcore extracting data from database and move it to its new place?


get_comments() where parent is not 0

I need a way to get just the comments that aren't top level i.e. where parent is not 0. I've tried:               $args = array(        'parent' => -0     );     $comments = get_comments($args);      I know the parent comment id's (44 and 48) of all the comments I require, so I tried:               $args = array(        'parent' => array(44,48)     );          $comments = get_comments($args);      But this didn't work. It only returned one row. I need to stick with get_comments() if possible, as I've done a lot of work around it already so want to avoid losing what I've done.


Advanced Custom Fields select field : How to echo the label, not the value?

I am using the wordpress Advanced Custom Fields plugin. This question is about the select field, and in the documentation only tells me how to output the value, not the label/name. I can't see this functionally in the documentation and was wondering if anyone had any ideas? For example, to create Select field content, you simple do this...               gb : English     fr : Français     it : Italiano     de : Deutsch     pt : Português     es : Español     nl : Nederlands     be : Belgian     dk : Dansk     fi : Suomi     no : Norske     cz : Český     pl : Polski     hu : Magyar     ch : Schweiz     at : Österreich     eu : International         Then to output this, you write this...               <?php the_field('language'); ?>         For example if I select Polski in my post editor, the PHP will echo this value...               pl         I'm wondering if its possible to echo the label, I also want to be able to echo Polski, as well as the value pl. If anyone knows of any documentation on how to do this or if you could help with a solution that would be most awesome. Thanks in advance.


Wordpress database growing dramatically in size despite adding no new content

I have an old Wordpress site that I no longer maintain but keep online anyway. I have a cron job setup on the server that backs up the Wordpress database once a month. I am noticing a continuing growth in the size of the database backup. For example, if I go back a few years, the database size was under 3MB. It has kept gradually increasing over time - as of December last year it was 80MB and as of January this year it is now 116MB. I am curious to know whether this is a standard Wordpress problem/known plug- in problem and how one might go about identifying and addressing it. I'm not adding any new content of any sort and it's a low traffic site, so I don't suspect it's being overwhelmed with comments. Even the sum of all spam and legitimate comments is under 9100 (about 9000 are spam), and each comment would have to be consuming on the order of ~12KB in the database to explain the backup size, which seems rather large per comment.


How do I obtain the post content via a custom meta box inside the editor?

I have a custom meta box which I would like to use to report on the markup of the current post or page (number of words, number of heading tags, etc). How can I obtain the post content into memory in order to parse and report on its content inside the meta box?


A change in URL slug in database returns 404, how can I do auto-redirect?

I have a huge blog with over 10K posts and a lot of posts with some adult keywords in titles, urls, content and tags. I am trying to remove all adult ones with "search and replace" plugin. It works fine, but the problem is the url slugs also changes if there is a bad keyword in the url and the original url becomes 404. For example, http://www.domain.com/adult-keyword-url changes to http://www.renamed-keyword-url which is fine, but the adult keyword url is now 404 and does not redirect to renamed url. Is there a way that the original url automatically do 301 redirects to the changed url? I tried using the redirection plugin too which claims to auto-redirect such posts. It works fine only when you manually change the url slug of a post and update a post. But it does not work in this case when you are updating a lot of posts by directly changing the database with search and replace plugin.


Custom hierarchal taxonomy loses interface hierarchy when selecting parent & children

I have a custom hierarchical taxonomy that is called 'Categories', but serves a different area of the site than the default "Categories" taxonomy. The problem I'm having is with selecting children terms in the interface while posting content. If the user selects and children terms, they move to the top of the Categories box and lose association and visual hierarchy with its parent. Here's an image showing what happens: ![Checked categories are moved to the top of the list, breaking the hierarchy](http://cl.ly/30e9/content) I haven't set any unusual parameters that I know of, here's the register_taxonomy call:               register_taxonomy( "workshop_categories", 'workshop',         array(             "label" => "Categories",             "singular_label" => "Category",             "rewrite" => true,             "show_ui" => "true",             'hierarchical' => true,             'rewrite' => array('slug' => 'category')         )     );      Any input is appreciated!


Recommendationf for Quiz Plugin that saves results

I'm building a learning site, and need a quiz plugin that will help track student progress through the lessons; thus I want a log of each member that took the quiz, along with date time and score. Does anything like that exist?


how to display full post with pagination on home page

I am using the 'Hatch' theme. I'm familiar with HTML/CSS but not with WordPress, first time working with this.   I have my homepage showing recent posts and that's good. However, I want to make a new page called 'Blog' where I can show all my full posts, with pagination as well. I thought I might have to create a template? Or, I tried making a category 'blog', but I don’t know how to change the display of that particular category. I read similar questions, to my understanding I gotta get a loop happening, but I don’t know where. my site is LizettePhotography.com ### home.php code:               <?php     /**      * Home Template      *      * A custom home page template.      *      * @package Hatch      * @subpackage Template      */          get_header(); // Loads the header.php template. ?>              <?php do_atomic( 'before_masthead' ); // hatch_before_masthead ?>
                  <?php do_atomic( 'open_masthead' ); // hatch_open_masthead ?>                  <?php $hatch_author_bio = hybrid_get_setting( 'hatch_author_bio' ) ? hybrid_get_setting( 'hatch_author_bio' ) : '1'; ?>
<?php the_author_meta( 'description', $hatch_author_bio ); ?>

                      <?php // Check to see if the header image has been removed                 $header_image = get_header_image();                      if ( ! empty( $header_image ) ) : ?>                          <img src="<?php header_image(); ?>" alt="" />                      <?php endif; // end check for removed header image ?>
                  <?php do_atomic( 'close_masthead' ); // hatch_close_masthead ?>
              <?php do_atomic( 'before_content' ); // hatch_before_content ?>
                  <?php do_atomic( 'open_content' ); // hatch_open_content ?>
                      <?php if ( have_posts() ) : ?>                          <?php $counter = 1; ?>                          <?php while ( have_posts() ) : the_post(); ?>                                  <?php do_atomic( 'before_entry' ); // hatch_before_entry ?>                                  <?php if ( ( $counter % 4 ) == 0 ) { ?>                                      <div id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?> last">                                  <?php } else { ?>                                      <div id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>">                                  <?php } ?>                                                                                <?php do_atomic( 'open_entry' ); // hatch_open_entry ?>                                          <?php if ( current_theme_supports( 'get-the-image' ) ) {                                              get_the_image( array( 'meta_key' => 'Thumbnail', 'size' => 'archive-thumbnail', 'image_class' => 'featured', 'width' => 220, 'height' => 150, 'default_image' => get_template_directory_uri() . '/images/archive_image_placeholder.png' ) );                                          } ?>                                                              <?php echo apply_atomic_shortcode( 'entry_title', '[entry-title]' ); ?>                                                               <?php do_atomic( 'close_entry' ); // hatch_close_entry ?>
                                  <?php do_atomic( 'after_entry' ); // hatch_after_entry ?>                              <?php $counter++; ?>                          <?php endwhile; ?>                      <?php else : ?>                          <?php get_template_part( 'loop-error' ); // Loads the loop-error.php template. ?>                      <?php endif; ?>
                  <?php do_atomic( 'close_content' ); // hatch_close_content ?>                  <?php get_template_part( 'loop-nav' ); // Loads the loop-nav.php template. ?>
              <?php do_atomic( 'after_content' ); // hatch_after_content ?>          <?php get_footer(); // Loads the footer.php template. ?>


Tag system like Quora?

What would be the best way to go for creating a tag-system similar to the one on quora.com? If you don't know what quora looks like, here is what I'm thinking about: On the tag archive page the user can add or edit a description of the tag and tie a photo to the tag. The tag also have a manage page on the frontend were it's possible to delete the tag or merge it with another one if it's a duplicate. All of this is made from the frontend. How hard would it be to achieve this? How would one do?


problem with nextgen plugin

I have a problem with Nextgen gallery,after activating some plugins it doesn't show the submit buttons(insert, cancel). Then i have deactivated all plugins, but that doesn't help. I haven't any experience with wordpress, so any suggestions would be very useful. Thanks much


Wordpress Post Grid

I am trying to make a custom grid for my Wordpress posts. I have been searching the web however all the tutorials I have found utilize a column method where it just alternates between the columns. For what I am doing that would be impossible I need it to actually count off six thumbnails and then return a line and do it again. Does anyone know of a good tutorial/example of this(It can't be a plugin.)? All answers much appreciated. The code below is what I have so war without it wrapping the lines. ![enter image description here](http://i.stack.imgur.com/CgWv9.png)                $categories =  get_categories('child_of=2');       foreach  ($categories as $category) {                       //Display the sub category information using $category values like $category->cat_name             echo '
'.$category->name.'
';                  foreach (get_posts('cat='.$category->term_id) as $post) {                           echo '
';                      setup_postdata( $post );                 $custom = get_field('face');       echo wp_get_attachment_image($custom);            echo '
';      $custom = get_field('fullname');       echo $custom;       echo '
';       echo '
';      REVISED TO POST BELLOW: ![enter image description here](http://i.stack.imgur.com/cyByx.png)


Feature Differences between WordPress.com and Hosting on your Own Server?

I created a new blog using WordPress.com and obviously it got hosted on their server. But what I notice is that few features are not visible in this version as compared to the WordPress PHP script that I downloaded and hosted on my server. For example: the Plugins options is not visible anywhere from where I can upload any plugin. Is the online version a degraded editon of the original WordPress script?


Wordpress not opening posts with only numbers if permalink is post_name

Someone knows why this happens? For instance, I have a post called `1987`, but it does not open it when I click on the link. When I use a different permalink structure, it opens it. Why is this and how can I solve this? FYI: **I don't get a** `404 error`, I just get a Firefox error where it says: **this page is not redirecting it well**


Wordpress Sidebar menu for posts based on date - guidance needed

One of the issues I have with WordPress is knowing when (and when it is possible) to use the WordPress back end instead of coding my own solution from scratch. This question is based around this. I'm attempting to set up the blog page for the site I'm working on. Most of the site is static pages, with the posts ideally being collected on a news page. I have the news page displaying the posts through the traditional set up (selecting the static front page, and selecting a page to be the blog page through the WordPress dashboard). With that done, I want to create a sidebar for the blog post (and all posts) that displays a list of years and months. Example sidebar: August 2014 July 2014 June 2014 ... October 2013 This seems like something that would be built into WordPress, but I can't seem to find any information on it. So I ask you all, is this a built in function? If so, could you direct me towards a good starting point? If it is not, how would you suggest developing links to posts based off of a time stamp? Apologies again for the low level question. I know just enough to get my hands dirty here, but I have a ways to go on the learning curve.


Ways to handle SVG rendering in wordpress?

With the advancement of internet browsers, I find myself more and more comfortable using SVGS when coding websites... especially for icons, and simple graphics that can be replaced on the fly by pngs. It looks like wordpress almost supports SVGS. I say almost because:   1. It's not by default an allowed file type in wordpress. So you need to add that before uploading SVGs   2. You can't see a SVG thumbnail in the Media gallery. (see image below)   3. Sometimes when you add it to the editor (via add media button) the editor doesn't know the svg size, so although it adds the svg as an image it has a width and height of zero.   4. When you click in "edit image" from within the media upload popup you get a message saying "image does not exist". See image below. I am fine with item 1 in this list, but has anyone figure out how a fix item 2 3, and 4? ![enter image description here](http://i.stack.imgur.com/rKVAE.png) ![enter image description here](http://i.stack.imgur.com/V6Mvy.png) **Update about item 1:** To allow a new mime type (such as SVG) you can just add a hook in functions.php               function allow_new_mime_type($mimes) {              $mimes['svg'] = 'image/svg+xml';              return $mimes;     }     add_filter( 'mime_types', 'allow_new_mime_type' );      Now you should be able to upload SVGs. You can find further information in this tutorial. This only solves item 1, which as I mentioned before, it's not an issue for me (although I think it should be a allowed by default). **Update about item 2:** I did some digging and tracked down the function that decides whether an attachment is an image or not. It seems that it all comes down to this function in wp-includes/post.php               /**      * Check if the attachment is an image.      *      * @since 2.1.0      *      * @param int $post_id Attachment ID      * @return bool      */     function wp_attachment_is_image( $post_id = 0 ) {         $post_id = (int) $post_id;         if ( !$post = get_post( $post_id ) )             return false;              if ( !$file = get_attached_file( $post->ID ) )             return false;              $ext = preg_match('/\.([^.]+)$/', $file, $matches) ? strtolower($matches[1]) : false;              $image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' );              if ( 'image/' == substr($post->post_mime_type, 0, 6) || $ext && 'import' == $post->post_mime_type && in_array($ext, $image_exts) )             return true;         return false;     }      As you can see there's an array of valid image extensions defined in this function. I don't see any filters that could be used to modified that array. But that's a start... I am not sure why the last if statement returns false for svgs though. Even if I don't add the svg extension to the array $image_exts, the first condition should return true, shouldn't it?               if ( 'image/' == substr($post->post_mime_type, 0, 6)      That checks if 'image/' is enqual to the first six character in the mime type, which for svg is image/svg+xml (first six is "image/"). **UPDATE** Upon further investigation, it seems that the problem is not with wp_attachment_is_image at all, but because the image size (width and height) are not being added to the attachment metadata when the SVG is uploaded. That's because the function to calculate the image used is the php function getimagesize(), which does not return an image size for SVG. I found an answer on stackoverflow about the getimagesize function and about how svgs behave. See it here.


get_item_quantity() Error When Fetching Feed

I'm using this script in two places on the same page to output some RSS feeds:               <?php         include_once(ABSPATH . WPINC . '/feed.php');         $rss = fetch_feed('https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=BarackObama');         $maxitems = $rss->get_item_quantity(3);         $rss_items = $rss->get_items(0, $maxitems);     ?>     <?php if ($maxitems == 0) echo '
No activity to display.
'; ?>
     <?php         if (!$maxitems == 0)         foreach ( $rss_items as $item ) : ?>
                 <a href="<?php echo $item->get_permalink(); ?>">                     <?php echo $item->get_title(); ?>                     <time datetime="<?php echo $item->get_local_date('%Y-%m-%d %H:%M'); ?>" class="timestamp">                         <?php echo $item->get_local_date('%A %d %b %H:%M'); ?>                     </time>
         <?php endforeach; ?>
      I'm manually setting the cache lifetime in my `functions.php` to two hours:               function filter_handler( $seconds ) {         return 7200;     }     add_filter( 'wp_feed_cache_transient_lifetime', 'filter_handler' );      A few times a day, the feed breaks and displays this error instead: `Fatal error: Call to undefined method WP_Error::get_item_quantity() in /public_html/wp-content/themes/twentyeleven/home-page.php on line 100` It seems WordPress' fetch of this Twitter feed occasionally fails, then the error is output for 2 hours until the cache is flushed. How can I get around this?


Installing WordPress into a user directory without any admin privileges

I posted a question over at webmasters.stackexchange.com that was migrated over to this stack. It's here now: Canonicalization issue regarding academic URL vs. blog URL Before the migration, someone over at the webmasters' stack added a comment. I cannot reply to his comment over at that stack because the question is locked, and that user does not seem to be a member of the wordpress stack, so he will likely not see my response here. Since his comment might lead to a solution to my original problem, I'm going to open it up as an independent question, which I will state below. (Note that you do not have to read my original question to understand or contribute to the one I am about to ask. The original question simply provides some context.) **Question:** I have an account on a university department server. I am an academic within that department, which gives me limited privileges. I have a web-enabled directory in my account, and an index.html file in that account can be displayed in the typical way, by visiting **www.(universityname).edu/~(username)**. I pretty much have complete control over this directory, and I (believe) I can run PHP scripts from my directory. However, I don't have any kind of root / admin / superuser privileges. Is it possible to install the WordPress.org platform to my directory, without additional privileges? If so, should I install it into the directory or into a subdirectory of it? Thanks!


Define constant for one plugin in mu-plugin

I'm trying to define the constant `ACF_Lite` as `true` so that the interface of the Advanced Custom Fields plugin is hidden on all of my multisite subsites except the parent. For clarity and maintainability, I'm wanting to do this from an `mu-plugins` plugin that will also control the fields displayed by that plugin. I thought this would do it but it didn't:               if( get_current_blog_id() !== 1 )         define( 'ACF_Lite', true );      The plugin author says that this needs to be in `wp-config.php`, but I'm surprised that this doesn't work because, according to the codex, mu-plugins are: > Loaded by PHP, in alphabetical order, before normal plugins, I've confirmed that `get_current_blog_id()` returns the right ID, so that's not the problem. I've also tried explicitly hooking that to `muplugins_loaded` and `plugins_loaded` but that has failed. Can anyone explain why I can't define this from `mu-plugins`?


Output thumbnail for current DJ using Radio Station Plugin

So I've installed the "Radio Station" to my Wordpress installation. All seems fine with that. There's a widget included with this plugin that is meant to display "On Air" information about the current DJ in the sidebar and also some information, including their thumbnail image. The trouble I’m having is, I can't (properly i.e. dynamically) get this thumbnail to display. With the standard installation, the plugin is apparently meant to use Gravatar avatars, but that didn't work no matter what I tried. So I've been digging through the code most of the day, trying to figure it out and maybe find a function that would get me the right value and found the following which was relevant in the `dj-on-air.php` file:               if(count($djs['all']) > 0) {         foreach($djs['all'] as $dj) {             //print_r($dj);             $dj_str .= '
';             if($show_avatar) {                 $dj_str .= ''.get_the_post_thumbnail($dj->ID, 'thumbnail').'';             }      The `get_the_post_thumbnail()` function doesn't seem to be working as intended for whatever reason. When I assigned the following variable and displayed it to see what was happening               $tmp = $dj->ID;      the output was "293" (without quotes) which, looking through phpmyadmin seemed to be the "ID" value from the wp_posts table which kinda made sense but explained why get_the_post_thumbnail() wasn't outputting a valid image url for the thumbnail since there is no user ID with a value of "293" - so it just returned nothing and the output html was                     So what I need to do is somehow get the "user ID" value for the currently "on- air" DJ and feed that into the following:               echo ''.get_wp_user_avatar($dj->ID, 96).'';      The above doesn't work presumably because the $dj->ID is returning "293". get_wp_user_avatar() is a function I'm using from another plugin called WP User Avatar so I could set an avatar image manually for each User in the admin area. If I manually enter the user ID value of "3":               echo ''.get_wp_user_avatar(3, 96).'';      It displays the avatar in the widget perfectly as the user ID of the DJ in question is "3". However, I need a way to do this dynamically. I'm not too sure what $dj->ID is doing or how to maybe use that to get the "user ID" of the DJ and not the "wp_posts ID" as it seems to be giving? I hope I've made some sort of sense here. If anyone can help it'd be greatly appreciated and if you need to see more of the source files, please let me know. **UPDATE:** So I'm trying the following:                                   global $wp_query;                     //  $tmp=$dj->post_author;                              //$tmp = $wp_query->post->ID;                     $author_id = $dj->post_author;                     $tmp2 = the_author_meta( 'ID', $author_id );                              $getid = $posts[0]->post_author;                                       echo ''.get_wp_user_avatar($dj->ID, 96).$getid.'';                         }      This keeps giving me "1" as the $getid value which seems to be the ID of the admin user not the user of the current "post". How can I get the user ID of the "post" relating to the current widget. Do I need to make $dj include more values? The other code above was other attempts to get the user ID of the ON- AIR DJ. I think I'm missing something fairly obvious here.


Retreive tags from attached post for media on page

I am working on a custom template file that pulls all images in my Media Library with a specific tag. I was able to get this working with some help from the community, it also shows the title of the post that the image is associated with. I need to pull the tags for post the image is attached to as a class name on a container. This is my code:               <?php         $args = array(             'post_type' => 'attachment',             'posts_per_page' => -1,             'post_status' => 'any',             'post_parent' => null,             'tax_query' => array(                 array(                     'taxonomy' => 'post_tag',                     'field' => 'slug',                     'terms' => 'logo'                 )             )         );          $images = get_posts( $args );     if ( $images ) {         foreach ( $images as $image ) {             // Get the parent post ID             $parent_id = $image->post_parent;             // Get the parent post Title             $parent_title = get_the_title( $parent_id );             // Get the parent post permalink             $parent_permalink = get_permalink( $parent_id );             // Get image caption                  $logoimg = wp_get_attachment_image( $image->ID, 'Work Gallery' );                  $posttags = get_the_tags();                 if ($posttags) {                     foreach ($posttags as $tag) {                         str_replace('-','_',$tag->slug . ' ');                     }                 }                      echo '';                          echo '
';                              echo '
';                                  echo '
';                                      echo $logoimg;                                  echo '
';                                  echo '
';                                      echo '
';                                          echo ' ' . $parent_title . ' ';                                      echo '
';                                      echo '
';                                          echo ' ' . get_post( get_post_thumbnail_id($post->ID) )->post_excerpt . ' ';                                      echo '
';                                  echo '
';                                  echo '
';                                      echo '
';                                          $attachment_id = $post->ID; // dynamic attachment ID                                     $image_attributes = wp_get_attachment_image_src( $attachment_id, 'full' ); // returns an array                                          echo '';                                              echo 'Lightbox';                                          echo '';                                      echo '
';                                  echo '
';                              echo '
';                          echo '
';                      echo '';                  }             wp_reset_postdata();         }     ?>      This line: `echo '<aside class="work_item" data-id="id-' . get_the_ID() . '" data-type="' . $posttags . '">';` is where I am trying to get the posts tags (ie: hvac, contractor... for example). On another custom template file I use the following code:               data-type="<?php $posttags = get_the_tags(); if ($posttags) { foreach ($posttags as $tag) { echo str_replace('-','_',$tag->slug . ' '); } } ?> <?php $posttags = get_the_terms($post->ID, 'type'); if ($posttags) { foreach($posttags as $tag) { echo str_replace('-','_',$tag->slug . ''); } } ?>"      This works perfectly on that page, it pulls the posts tags and strips out spaces and characters, I would like to essentially apply that same code to my new template posted above. Of course all help is greatly appreciated!


WP_Query - Order results by meta value

I've checked around and haven't seen an answer which works as of yet. I have a WP_Query with the following arguements:               $args = array(         'post_status' => 'publish',         'post_type' => 'listing',         'meta_key' => 'client_feedback_score',         'orderby' => 'client_feedback_score',         'order' => 'DESC'             );          $query = new WP_Query($args);      I want to order the results by the custom post field 'client_feedback_score', lowest to highest. But this doesn't seem to work... can anyone point me in the right direction? **EDIT (SOLVED):** Thanks to Milo's response, here's the working code for ordering by a numerical meta value:               $args = array(                 'post_status' => 'publish',                 'post_type' => 'listing',                 'meta_key' => 'client_feedback_score',                 'orderby' => 'meta_value_num',                 'order' => 'DESC'             );


If you're calling a dynamic css inline style does that div have to be in the loop?

In the code below i reference "the_field( 'bg_img' )" within my first container div. The reason i do this is because i created a custom field (within a CPT) that allows the admin to change that containers bg color from the admin panel. However when i load the page it doesn't work so i was wondering if: a) it's because it's above the query b) or because it needs to be within the loop I have tried including this div within the loop but then it creates duplicate divs embedded within duplicate divs, etc, etc. So i'm wondering if you can call functions outside of loops, which i'm guessing no. The function btw is unique to the ACF(Advanced Custom Fields) plugin and it's calling a custom field within my 'neighborhoods' CPT. So if i can't call my function outside of a loop then how do i keep this div from not repeating so many times within the code, does it have to do with conditionals or limiting posts? Thanks.                <div class="bg-img-default <?php the_field( 'bg_img' ); ?>">

              <?php                       $args = array(                 'post_type' => 'neighborhoods',                 'posts_per_page' => 1,                 'meta_key' => ''                 );                  $news_query = new WP_Query( $args );              ?>              <?php if ( $news_query->have_posts() ) : while ( $news_query->have_posts() ) : $news_query->the_post(); ?>

latest news

local events
                  <?php the_field( 'single_neighborhood_local_events' ); ?>

listings
                  <?php the_field( 'listings' ); ?>                  <a href="<?php get_permalink(); ?>">Read more
              <?php endwhile; endif; ?>              <?php wp_reset_query(); ?>


Replace author with custom field in feed

I'm doing some customization on a theme that was previously written by someone else. Rather than use multiple user accounts to assign articles, they created a taxonomy for the custom author name(s) so that an archive of posts by an author can be generated. The code is below, and it's working well. However, I'd also like to replace the author name in the feed. I assume it's going to be an extra filter and/or function. Can someone help me out?               add_filter( 'the_author_posts_link', 'custom_author_name' );     add_filter( 'get_the_author_display_name', 'custom_author_name' );     function custom_author_name( $name ) {         global $post;         $author = get_the_terms(get_the_ID(),'article_author');         if ( $author )             $name = the_terms(get_the_ID(),'article_author','',' & ');         return $name;     }      Update. I tried adding this function, based on code found elsewhere on stack exchange, but it seems to be overwriting the author on the whole site, not just the feed:               add_filter( 'the_author', 'feed_author' );     function feed_author($name) {       if( is_feed() ) {         global $post;         $author = get_the_terms(get_the_ID(),'article_author');          if ( $author )              $name = the_terms(get_the_ID(),'article_author','',' & ');          return $name;         }     }      Figured it out! Ended up using this modified from the sample get_the_terms code in the WP Codex.               add_filter( 'the_author', 'feed_author' );     function feed_author($article_authors) {         if( is_feed() ) {            $author = get_the_terms( get_the_ID(), 'article_author' );            if ( $author && ! is_wp_error( $author ) ) {                  $byline = array();                foreach ( $author as $author ) {                $byline[] = $author->name;                }                   $article_authors = join( " & ", $byline );               }                return $article_authors;         }     }


Custom Post Types and Rewrites

I have a custom post type registered using Custom Post Types UI plug-in. It has a rewrite rule:               rewrite' => array('slug' => 'apps/iphone-ipad', 'with_front' => '1'),      I am using a custom WP_Query loop to output posts from a bunch of categories. The template that handles the output of pages belonging to this post type has a conditional:               if($post->post_name == 'reviews')     {     include('_reviews.php');     }     else{     //continue with regular logic     }      Basically, I want to use this template to handle 2 different types of content and it works. However, when I try to add post pagination capability to the login in my _reviews.php, I am not able to view next pages. So, given the rewrite rule for CTP above, I have a page with this URL:               example.com/apps/iphone-ipad/reviews      When I step into my reviews logic, I see a number of posts per page as I specified and the Next Page link specified that links to `example.com/apps/iphone-ipad/reviews/page/2` However, when I click that link I get redirected back to `example.com/apps/iphone-ipad/reviews` It seems to have to do with the rewrite rule for the CPT, as I was able to replicate the functionality using a regular standard page.php template and pagincation works. I'd appreciate any tips.


Custom taxonomy categories menu with link to subcategory

I'm currently developing a theme for a client that need a "catalog" in a page, I made that catalog with a custom taxonomy and some AJAX, until that everything is fine but the products of that catalog are ordered under categories and sub-categories so when a client click on the main category it must show the sub categories in another menu and list all the products on the first sub-category not all the products on each subcategory (like is currently done). I generated the menus with this code:               <?php     $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );     $parent = get_term($term->parent, get_query_var('taxonomy') );     $grandparent = get_term($parent->parent, get_query_var('taxonomy') );     $children = get_term_children($term->term_id, get_query_var('taxonomy'));     if (!is_single()) {          if (!$parent->term_id && sizeof($children) > 0) {         echo 'categoria';         $args = array(             'child_of' => $term->term_id,             'taxonomy' => $term->taxonomy,             'hide_empty' => 1,             'hierarchical' => true,             'depth'  => 1,             'title_li' => ''             );?>
 <?php  wp_list_categories( $args ); ?>
             <?php         } else {             if ($parent->term_id && sizeof($children) > 0)              {                            $args = array(                     'child_of' => $parent->term_id,                     'taxonomy' => $term->taxonomy,                     'hide_empty' => 1,                     'hierarchical' => true,                     'depth'  => 1,                     'title_li' => ''                     );?>
 <?php  wp_list_categories( $args ); ?>
                     <?php                      } else {                     $args = array(                         'child_of' => $grandparent->term_id,                         'taxonomy' => $term->taxonomy,                         'hide_empty' => 1,                         'hierarchical' => true,                         'depth'  => 1,                         'title_li' => ''                         );?>
 <?php  wp_list_categories( $args ); ?>
                         <?php                     }                 }             }      ?>      and it shows me the menu for the categories and another code similar for showing the sub-categories in other menu. The categories are in a hierarchy like this: Is there someone that can point me out how to do it? Sorry if my English isn't good enough to explain my problem, I'm not a native English speaker.


Adding an Unlinked Space in a Custom Function

This question has been a pain in my side for the last few days. I am using a function to display page numbers and next/previous links with WP_LINK_PAGES. The code I'm using (below) is a shortened version of the code found here \- to the best of my knowledge, it is correct. (Go easy on me, just diving into PHP.) Please view the working example here. The problem should be a simple fix, but I can't figure it out. **I would like to add a space in front of the "Next Page" link which is _not_ linked itself to the next page in order for the pagination to have equal spacing.**               function wp_link_pages_args_prevnext_add($args)     {         global $page, $numpages, $more, $pagenow;              if($page-1) # there is a previous page             $args['before'] .= _wp_link_page($page-1)                 . $args['link_before']. $args['previouspagelink'] . $args['link_after'] . ''             ;              if ($page<$numpages) # there is a next page             $args['after'] = _wp_link_page($page+1)                 . $args['link_before'] . $args['nextpagelink'] . $args['link_after'] . ''             ;              return $args;     }


Options for Wiki WordPress

I would like to know my options for how best to use WordPress as a wiki. I tried Media Wiki, but the sheer amount of changes I need to make to code to make even trivial changes turned me off. Way off. Googling doesn't reveal much. What are the best options for using WP as a wiki? (This can be a community question discussing various options.) In particular, I would like something that addresses:   * Links to non-existing pages actually link to a "create new page" page   * Editing pages without going through /wp-admin/ (i.e. the back-end)   * Searching/listing existing pages when linking (i.e. linking by title, not by URL) What are my options?


Should HTML output be passed through esc_html() AND wp_kses()?

I'm confused about the different uses of esc_html() and wp_kses(). I understand that esc_html() converts special characters to their HTML entity, and that wp_kses() removes unwanted tags (e.g., <script>), but I'm not sure in what contexts they should be used together or separately. If I run some untrusted HTML through esc_html(), then any JavaScript will be displayed in plain text rather than being rendered by the browser, so it is safe at that point, correct? The only reason to also run it through wp_kses() would be to avoid having the raw script displayed? Basically, esc_html() makes it safe, and wp_kses() makes it pretty. Is that correct?


Change role after the user has read all the posts in a category

I'm creating a platform with "X" categories and "X" roles with the same name to each category. I would like to know how to change the user's role after they have read all the posts in a category. When the role changes, the user will have access to the next category. To make the categories private and to create the related groups of users I'm using the Role Scoper plugin. This solution is very similar to what I mean: http://stackoverflow.com/questions/9181440/wordpress-change-user-role- conditionally Thanks


How to get an error message if a form is empty (plugin: Post for site)

I wonder if you intelligent friends can detect the problem in this code. I want the form to display an error message if it's empty. Now it just goes to my completed form page.               <?php      /* * *     * Processed form data into a proper post array, uses wp_insert_post() to add post.      *      * @param array $pfs_data POSTed array of data from the form     */     require('../../../wp-load.php');     error_reporting(E_ALL);     ini_set('display_errors',1);          /**     * Create post from form data, including uploading images     * @param array $post     * @param array $files     * @return string success or error message.     */     function pfs_submit($post,$files){     $pfs_options_arr = get_option('pfs_options');     $pfs_options = $pfs_options_arr[0];     $pfs_data = $post;     $pfs_files = $files;     //echo "
".print_r($pfs_data, true)."
\n";     //echo "
".print_r($pfs_files, true)."
\n";          $title = $pfs_data['title'];     $category = $pfs_data['cat'];     $postcontent = $pfs_data['postcontent'];          $name = (array_key_exists('name',$pfs_data)) ? esc_html($pfs_data['name'],array()) : '';     $email = (array_key_exists('email',$pfs_data)) ? sanitize_email($pfs_data['email']) : '';          $taxonomies = array();          $imgAllowed = 0;     $result = Array(         'image'=>"",         'error'=>"",         'success'=>"",         'post'=>""     );     $success = False;     $upload = False;          if ( !current_user_can('publish_posts') && $pfs_options['allow_anon'] && $pfs_options['enable_captcha'] ){         require_once('recaptchalib.php');         $privatekey = $pfs_options_arr['recaptcha_private_key'];         $resp = recaptcha_check_answer ($privatekey,                                     $_SERVER["REMOTE_ADDR"],                                     $_POST["recaptcha_challenge_field"],                                     $_POST["recaptcha_response_field"]);     }     if ( !current_user_can('publish_posts') && $pfs_options['allow_anon'] && $pfs_options['enable_captcha'] && !$resp->is_valid ) {         // What happens when the CAPTCHA was entered incorrectly         $result['error'] = printf(__("Incorrect reCAPTCHA: %s",'pfs_domain'), $resp->error);     } else {         //echo "
".print_r($pfs_files['image']['name'], true)."
\n";         if (array_key_exists('image',$pfs_files)) {              /* play with the image */             switch (True) {             case (1 < count($pfs_files['image']['name'])):                 // multiple file upload                 $result['image'] = "multiple";                 $file = $pfs_files['image'];                 for ( $i = 0; $i < count($file['tmp_name']); $i++ ){                     if( ''!=$file['tmp_name'][$i] ){                         $imgAllowed = (getimagesize($file['tmp_name'][$i])) ? True : (''==$file['name'][$i]);                         if ($imgAllowed){                             $upload[$i+1] = upload_image(array('name'=>$pfs_files["image"]["name"][$i], 'tmp_name'=>$pfs_files["image"]["tmp_name"][$i]));                             if (False === $upload[$i+1]){                                 $result['error'] = __("Något gick fel när bilden skulle laddas upp.",'pfs_domain');                             } else {                                 $success[$i+1] = True;                             }                         } else {                             $result['error'] = __("Fel filformat. Bara formaten (.gif, .png, .jpg, .jpeg) fungerar.",'pfs_domain');                         }                     }                 }                 break;             case ((1 == count($pfs_files['image']['name'])) && ('' != $pfs_files['image']['name'][0]) ):                 // single file upload                 $file = $pfs_files['image'];                 $result['image'] = 'single';                 $imgAllowed = (getimagesize($file['tmp_name'][0])) ? True : (''==$file['name'][0]);                 if ($imgAllowed){                     $upload[1] = upload_image( array( 'name'=>$file["name"][0], 'tmp_name'=>$file["tmp_name"][0] ) );                     //echo "
".print_r($upload, true)."
\n";                     if (False === $upload[1]){                         $result['error'] = __("Något gick fel när bilden skulle laddas upp.",'pfs_domain');                     } else {                         $success[1] = True;                     }                 } else {                     $result['error'] = __("Fel filformat. Bara formaten (.gif, .png, .jpg, .jpeg) fungerar.",'pfs_domain');                 }                 break;             default:                  $result['image'] = 'none';             }         }         if ( '' != $result['error'] ) return $result; // fail if the image upload failed.              //echo "
".print_r($upload, true)."
\n";         //echo "
".print_r($success, true)."
\n";              /* manipulate $pfs_data into proper post array */         $has_content_things = ($title != '') && ($postcontent != '');         if ( !current_user_can('publish_posts') && $pfs_options['allow_anon'] ) $has_content_things = $has_content_things && ($name != '') && is_email($email);         if ( $has_content_things ) {             $content = $postcontent;             if ( !current_user_can('publish_posts') && $pfs_options['allow_anon'] ) $content .= apply_filters('pfs_submittedby_text',"
Berättat av $name
");             if ( is_user_logged_in() ){                 global $user_ID;                 get_currentuserinfo();             }             if (is_array($success)){                 foreach(array_keys($success) as $i){                     $imgtag = "[!--image$i--]";                     if (False === strpos($content,$imgtag)) $content .= "\n\n$imgtag";                     $content = str_replace($imgtag, wp_get_attachment_link( $upload[$i], $pfs_options['wp_image_size']), $content);                 }             }              //if any [!--image#--] tags remain, they are invalid and should just be deleted.             $content = preg_replace('/\[\!--image\d*--\]/','',$content);                  // $terms[{tax name}] = array(term1, term2, etc)             if ( array_key_exists('terms',$pfs_data) ) {                 foreach ($pfs_data['terms'] as $taxon => $terms){                     if ( !is_taxonomy_hierarchical($taxon) ) {                         $pfs_data['terms'][$taxon] = implode(',',$terms);                     }                 }             }                  $postarr = array();             $postarr['post_title'] = $title;             $postarr['post_content'] = apply_filters('comment_text', $content);             $postarr['comment_status'] = $pfs_options['comment_status'];             $postarr['post_status'] = $pfs_options['post_status'];             $postarr['post_author'] = ( is_user_logged_in() ) ? $user_ID : $pfs_options['default_author'];             $postarr['tax_input'] = (array_key_exists('terms',$pfs_data)) ? $pfs_data['terms'] : array();             $postarr['post_type'] = $pfs_options['post_type'];             $postarr['post_category'] = array($category);             //echo "
".print_r($postarr, true)."
\n";             $post_id = wp_insert_post($postarr);                  if (0 == $post_id) {                 $result['error'] = __("Berättelsen kunde inte laddas upp - okänt fel.",'pfs_domain');             } else {                 $result['success'] = __("Berättelsen är tillagd, du kommer att komma vidare om en stund.",'pfs_domain');                 $result['post'] = $post_id;             }         } else {              $result['error'] = __("Du har lämnat en ruta tom. Alla rutor behöver fyllas i.",'pfs_domain');         }     }      return $result;     }          /**          * Upload images     */     function upload_image($image){     $file = wp_upload_bits( $image["name"], null, file_get_contents($image["tmp_name"]));     //echo "
";     //var_dump($file);     //echo "
\n";     if (false === $file['error']) {         $wp_filetype = wp_check_filetype(basename($file['file']), null );         $attachment = array(          'post_mime_type' => $wp_filetype['type'],          'post_title' => preg_replace('/\.[^.]+$/', '', basename($file['file'])),          'post_content' => '',          'post_status' => 'inherit'         );         $attach_id = wp_insert_attachment( $attachment, $file['file'] );         // you must first include the image.php file         // for the function wp_generate_attachment_metadata() to work         require_once(ABSPATH . "wp-admin" . '/includes/image.php');         $attach_data = wp_generate_attachment_metadata( $attach_id, $file['file'] );         wp_update_attachment_metadata( $attach_id,  $attach_data );         return $attach_id;     } else {         //TODO: er, error handling?         return false;     }     }          if (!empty($_POST)){     $pfs = pfs_submit($_POST,$_FILES);     echo json_encode($pfs);     //echo "
".print_r($pfs, true)."\n";     wp_redirect("http://domda.se/tack/");     exit;     } else {     /* TODO: translate following */     _e('Den här sidan hade du inte behövt se, något är fel.','pfs_domain');     echo "" . __('Go home?','pfs_domain') . "";     }          //get_footer();     ?>      The support for the plugin isn't active. Sorry to say. Hope someone can help.


Tricky WP Query

I am trying to use wp_query (or another native Wordpress query class) to do the following: get all posts WHERE ( post_type = 'post' AND category = 7 ) OR ( post_type = 'case-studies' AND meta_key = 'homeslide' AND meta_value = 1 ) I am not sure any of them can handle this yet. **Trying with WP Query:**               $args = array (         'relation' => 'OR',         array(             'meta_key' => '_homeslide',              'meta_value' => '1'         ),         array(             'category' => '7'         )     );      But I think "relation" is only for use with tax_query. I could probably use $wpdb to create an advanced query but wanted to see if it could be done with the others and see if I was missing something obvious.


Migrating Roles from one environment to another

I have 2 identical environments . Now, on one I have created many roles and have assigned users to them . How do I migrate this to the other server which has the same set of users already. Any suggestions to the problem would be great.


How to exclude categories from a sidebar with active widgets in it?

Is there a way to exclude certain categories from a widgetised sidebar? I've got categories that are associated with custom post types and ones associated with my blog - I don't want to display the CPT categories when viewing my blog. Any ideas? All I can think of is that I have to hard code the sidebar instead and ditch the widgetised version.


Bootstrap Nav menu won't toggle collapse when in mobile viewport size

I have copied the Bootstrap Default Navbar code to a T http://getbootstrap.com/components/#navbar-default However it's not working and i just need a simple dropdown nav for my mobile viewport size. Since chrome only allows down to 400px browser re-sizing I have set the media query to work on that min-width: 400px. Here is the site (i'll leave live for a few days in order to allow inspection of the code). But the reason i'm unsure about where to start is because i suspect a few culprits: 1) By default WordPress calls it's own copy of jquery if it's not included, but so does bootstrap.min.js so i'm not sure if there is a conflict there and if so how to resolve it 2) Don't know how to check if jquery is being called in Chrome DevTools on the Networks tab so i'm further unable to figure it out. On the server i see that bootstrap.min.js is indeed within the JS folder in the my custom theme but when i explore in DevTools the bootstrap.min.js file is NOT inside the themes JS directory (major head scratcher). 3) The way WP abstracts stylesheets and scripts could be a cause but here is how i have them right now               // Load the Theme JS          function theme_js() {            wp_enqueue_script( 'theme_js', get_template_directory_uri() . '/js/theme.js', array('jquery'), '', true );       wp_enqueue_script( 'theme_js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '', true );          }          add_action( 'wp_enqueue_scripts', 'theme_js' );          add_action( 'wp_enqueue_scripts', 'theme_styles' );      So i'm pretty sure that should be calling jquery through Bootstrap but i could be wrong. Also it is worth noting that in order for the mobile menu (burger menu/stack menu/ whatever you want to call that menu icon with three parallel horizontal lines) to work it needs to have the collapse.js script included which in BS's site it claims it is included in the boostrap.min.js file, really all you need is that one JS file. But as you can see here (please reduce your browser window to atleast 400px wide) http://dcinsideout.com/ when the menu is clicked nothing happens, it won't reveal the collapsed div and i'm kinda new at JS so i'm not very good at debugging it yet. I did open the console and tried applying a .toggle() method to the button class but that didn't work it returned a TypeError undefined is not a function. So i'm really confused at this point this should be a pretty simple cut and dry mobile nav menu but it's been pretty complicated. Here is the markup i have for the menu, NOTE: my menu is being called through the PHP script which shouldn't make a difference.

                            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#dcMobileNav">                         Toggle Navigation                                                                                </button>

                         <?php                                $args = array(                             'menu' => 'main-menu'                             );                                wp_nav_menu( $args );                              ?>

Explore a
Neighborhood

Hover over map to explore
                      <?php get_template_part( 'content', 'cirnav' ); ?>

                 I also commented out the BRAND link as i just decided to use my own div with a logo class, again not something that should hinder the menu from working. Any help, advice, comments, suggestions would be most helpful. Thank you.


qtranslate code doesn't work

function register_custom_artist() {               $labels = array(          'name' => _x( 'Artist', 'artist' ),         'singular_name' => _x( 'Artist', 'artist' ),         'add_new' => _x( 'Add New', 'artist' ),         'add_new_item' => _x( 'Add New Artist', 'artist' ),         'edit_item' => _x( 'Edit Artist', 'artist' ),         'new_item' => _x( 'New Artist', 'artist' ),         'view_item' => _x( 'View Artist', 'artist' ),         'search_items' => _x( 'Search Artists', 'artist' ),         'not_found' => _x( 'No artists found', 'artist' ),         'not_found_in_trash' => _x( 'No artists found in Trash', 'artist' ),         'parent_item_colon' => _x( 'Parent Artist:', 'artist' ),         'menu_name' => _x( '"[:en]English[:es]Português"', 'artist' ),     );      ''''''''''''''''''''' How to make 'menu_name' => _x( '"[:en]English[:es]Português"', 'artist' ) work??


Limit the number of posts from a specific category on index.php

I've had multiple requests from different clients to figure out a way to modify their blog (index.php) or Custom Post Type Archive page in order to show less posts from a certain category. A good example would be a client that has a system of automatic posting from social media (Facebook, Twitter, Instagram), which posts to their WordPress blog in the "Social Media" category. If this client posts a lot to social media, and writes actual posts on their blog sparingly, the social media posts will dominate their blog (at least on the first page). In this case, the client needs a way to limit the posts in the "Social Media" category per page, on the blog. I looked into using `pre_get_posts` to modify the query, but can't seem to find any examples of how to limit the number of posts per page of a specific category, on the index.php page. I was also considering making 2 separate queries (one for the "Social Media" category and another excluding this category) and combining them in a certain order. With this method, I was thinking that I could create a loop that combined the ID's of the 2 arrays (into 1), so that every fourth item would be from the "Social Media" category. This sounds like a bit of hacking to me though, and I would like to find out if there is a more elegant/less messy way to get this done.


Saving & reading analytics data in Wordpress

I am trying to create an analytics functionality where I would like to save my blog's daily facebook likes and use that data for date range based graphing purposes. What is the best way to save and read this data? Database, CSV , XML? Any good examples would help.