Multiple jQuery conflict unsure of why

I am trying to use the same image fader in two different spots on my testing site. ~~The one in the top banner works, and the one in the furthest right sidebar kind of works~~ They both now do not work. However I believe that the answer below is more or less on the right track and it is a Wordpress "quirk" that is at a fault and I just need a workaround. If I have a look at it in Chrome's developer tools, the css is transitioning properly. In the browser the first image fails to load, the second image does and then nothing. I have literally copied and pasted the code from the top of the page to the widget location in the side bar. I have tried copying and pasting both the jQuery and the CSS adding a 2 onto the end of all declarations to try and create a distinct function, but to no avail. Am I able to have two of the same jQuery function? **CSS**                     **PHP** _code is the same for both_

      **jQuery** _only called once_


Post and bbpress - link discuss on forum

i would like to have in every post a link to bbpress, for example: "Discuss it on Forum" But, how to link it up? Using tags, categories? I don't know how i can do it. Any idea?


How do I get standard posts to open up in their own template when using get_template_part()?

It seems to me that twentyelven opens standard single posts using the file `content-single.php` yet when I try the same code and files they open for me in `content.php` here's the code I have in index.php `<?php get_template_part( 'content', get_post_format() ); ?>` ... then I have two files `content.php` and `content-single.php` Standard posts are opening up in content.php not content-single.php How can I fix this?


Forcing SSL login, have to log in again from WP/BP-Admin Bar

I am forcing SSL login on a multisite install running BuddyPress, and after doing so I have to log in a second time when trying to access anywhere in the dashboard via the admin bar.


how to perform wordpress bulk actions using table inherited from wordpress list table

In my plugin which shows a table of business listings from database, I wanted to add the option for bulk actions. Besides the checkboxes I displayed the control for bulk actions, but when I click Apply, nothing happens. How do I perform a bulk edit, delete anyway, since I've no idea if I'm even on the right track. this is my Listing table class constructor               function __construct() {          parent::__construct( array(         'singular'=> 'wp_list_text_link', //Singular label         'plural' => 'wp_list_test_links', //plural label, also this well be one of the table css class         'ajax'  => false //We won't support Ajax for this table         ) );      }      and display row function function display_rows() {               //Get the records registered in the prepare_items method     $records = $this->items;           list( $columns, $hidden ) = $this->get_column_info();                //print_r($records);     //Loop for each record     if(!empty($records)){foreach($records as $rec){              //Open the line         echo '
sr_no.'">';         foreach ( $columns as $column_name => $column_display_name ) {                  //Style attributes for each col             $class = "class='$column_name column-$column_name'";             $style = "";             if ( in_array( $column_name, $hidden ) ) $style = ' style="display:none;"';             $attributes = $class . $style;                  //edit link                            //Display the cell             switch ( $column_name ) {                     case "name":                                      echo ''.stripslashes($rec->name);                                        $actions = $this->get_bulk_actions();                                     echo $this->row_actions( $actions );                      echo '	';             break;                           case "cb": echo '<input type="checkbox" name="wp_list_text_link[]" value="%s">	'; break;                 case "name": echo ''.stripslashes($rec->name).'	'; break;                 case "address": echo ''.$rec->address.'	'; break;                 case "phone": echo ''.$rec->phone.'	'; break;                                 case "datestarted": echo ''.$rec->start_date.'	'; break;                 case "url": echo ''.$rec->url.'	'; break;             }         }              //Close the line         echo'
';     }}     }      so how bulk actions will be implemented in this code. get_bulk_actions()?


Checking for existence of a page by title?

I'm currently working on a plugin, and I essentially want to check if a certain page has been created. Essentially, I want to do something like this:                   if (file_exists($file)) {         $exists = true;     } else {         $exists = false;     }      But I just want to do it so that it checks, instead, for a post_name value. (If I was further able to ensure that the post was a _page_ and not just a post with that title, that would be great too.) How do I do this? I had been getting the script to grab the headers from the url of the post and if it returned a 404, to return $exists = false, but I've pinpointed a memory leak problem with that and I don't think it's very efficient.


Show the author's count of total amount of posts assign to a custom taxonomy term

I have assigned a custom taxonomy named `Highlight` to posts and I have added a term to it named `Featured`. Whenever I want to feature a post, I simply assign it to featured. To each author, I want to display their count of total amount of featured posts. So the function `the_author_posts()` will display count of total posts. I want to display count of total posts that were featured to the author. How can I do this?


Youtube parameters within WordPress embed code?

Ok, so I want to embed youtube videos but also remove the annoying annotations. The following code works great from to embed the video               [embed width="599" height="360"]youtube.com/watch?v=mNf0v2WkV0U [/embed]      But whatever I seem to do, I cannot add the following parameter: > >     iv_load_policy=3 >   Im not sure if its even possible to to add this within the wordpress embed code? I then found something intresting:               $('object').each(function(){          var $param = $(this).children(':first-child');          var newUrl = $param.attr('value') + '&iv_load_policy=3';          $param.attr('value', newUrl);      });      The above code is meant to set all youtube videos globally (`iv_load_policy=3`) but i think Im doing it wrong. Thanks in advance.


My tab title, link address and content don't match!

I have some issued regarding the address bar and the titles on my browser's tab. For example, just now, I visited one of my posts. The, I accessed the dashboard. The link changed correctly, but the title in my tab remained the title of the post. On other occasions, for example, if I edit a page, after I am done and I click "view page", the address bar won't show the link of the page, so that I can copy mysite.org/wp-admin/post.php?post=1500&action=edit (which is not a shareable" link if i may). I deactivated my plug-ins, I cleared my cache and so on. Nothing seems to be working! Thank you!


Getting 404 error on my wp rewrite error

**The code I'm using to rewrite urls with query vars:**               function add_query_vars($aVars) {         $aVars[] = "city";         $aVars[] = "address";         $aVars[] = "pg";         return $aVars;     }     // hook add_query_vars function into query_vars     add_filter('query_vars', 'add_query_vars');          function add_rewrite_rules($aRules) {         $aNewRules = array( 'listing/([a-zA-Z\-0-9]+)/([a-zA-Z\-0-9]+)$' => 'index.phppagename=listing&city=$matches[1]&address=$matches[2]',         '([a-zA-Z\-_]+)/pg/([0-9]+)$' => 'index.php?pagename=matches[1]&pg=$matches[2]');               $aRules = $aNewRules + $aRules;              return $aRules;     }     // hook add_rewrite_rules function into rewrite_rules_array     add_filter('rewrite_rules_array', 'add_rewrite_rules');      > >     listing/Tokyo/89465-this-is-address >   seems to work fine, but I get a `404` error as soon as I put `wordpress-page/pg/3` in the url I'm using the standard "pretty permalinks" option in wp settings. Can the wp query var: "`pagename`" be variable? Or is there something else wrong with my code? Thanks in advance!


Show recent posts from one category on a non-WP site

I'm trying to move back to WP for our blog, after struggling with a clunky CMS for a few years, but we'll be sticking with that CMS for the rest of the site. Is there a plugin (or code) that I can use to pull the recent posts in a particular category from my WP blog to the sidebar of my non-WP site? Assume full permissions on both the WP blog and the external site.


define orderby URL with meta_key=post_views_count

I want to make an url with meta_key=post_views_count. E.g: http://www.mysampleweb.com/?meta_key=post_views_count&orderby=meta_value&order=DESC So the posts should be ordered by Views. Views are counting in the backend - but the url doesn't work. Just orders after newest/oldest posts. How can I setup this query? Like it is above, it's not working. Do I have to put something into functions.php - a rewerite Rule? Thank you! AD


Creating links to a page displaying posts from a particular category

Ok so at the moment I have a page which displays a list of categories within my Taxonomy (event-themes), here's the code:

By Theme

             <?php             //list custom portfolio categories             $taxonomy = 'event-themes';  // define portfolio categories from taxonomies in functions.php             $tax_terms = get_terms($taxonomy);                  foreach ($tax_terms as $tax_term) {             echo '

' . $tax_term->name.'
<a href="index.php?<?php get_the_category( $id ) ?>" rel="' . $tax_term->slug . '">Go';             }             ?>

      First of all, I am aware that the echo'd link does not work, and that is what I need help with. I'm trying to not only display all of the categories, but I also want each of them to **link to a page displaying the posts within that particular category**. I think I'm almost there with this code, as what I am trying to do is **insert the category ID within the href so that for each listed category it directs to the correct page**. Many thanks


Flushing rewrite rules

I'm using this function to add a custom end point to the WordPress urls               add_rewrite_endpoint('print', EP_ALL);      When the plug-in gets deactivated, I run this function               flush_rewrite_rules();      This flush the rewrite rules, and disable the 'print' end point. Fine. But I'm thinking of other plug-ins. What if other plug-ins have registered some rewrite rules. Will they be flushed too? If so, how can I preserve them as this will run their rewrite rules. And the same being for my plug-in. Do you have to re-register the rules everytime WordPress is called?


How do I create a section in the dashboard w/ an input field

I want to create an input field in the dashboard where I can put in links or text which will update a section I define on the actual website. I know I can just edit the template but I want to make things easier for the client. To be a bit more specific, I have a 'latest updates' section in the header and the client has requested that he'd like to update this manually. So I'd like to create an input box of some sort in the dashboard so he can easily enter text (or links), click save, and have it reflected on the website (in the header). Can someone give me a starting point?


Can I host wordpress separately on one hosting account?

I have a client who would like an auction site. I have decided to use Wordpress for this and found proper hosting and what not and thought I was set. Then the client asked if I could save time and money on their part by hosting this event site on their main site as well as their domain. IE: www.123.com/auction. The main site was not created by me and is not powered by WordPress. It is also hosted by some sort of "school community" website platform. Is it even possible, If I can access the file manager in the first place, to host a wordpress database and CMS separately on one hosting account for what is pretty much an entire different web page. Is this even practical?


E-commerce for wordpress

Is there an e-commerce solution for wordpress which will allow a shop with an onsite blog? If so, what are the options and is there generally one thats considered the 'best'?


Regex to Remove File Extension

I am using the Redirection plugin and I would like to use it to redirect my old static html pages to the new Wordpress pages. So basically anything that looks like http://www.example.com/page.html becomes http://www.example.com/page/ The only catch is that I want to exclude a folder so anything that is http://www.example.com/specialfolder/page.html shall remain untouched.


Using WP functions such as the_title() in an included php file

I'm including a php file in single.php, in the loop. Is it possible to use WP variables such as the_title(), the_date(), etc in the included php file?


How do post IDs work in WordPress?

So I have 2 blog posts so far and the first one has ID `8` and second one has ID `12`. How exactly does WordPress count those IDs? What if I want to change ID `8` and ID `12` to ID `1` and ID `2`? I have some knowledge about MySQL and I know that post IDs are related to the wp_posts table of the DataBase. How to edit the IDs? I have WordPress 3.9.2 and access to phpMyAdmin.


First Custom Post Custom Fields Empty After New Custom Post

I am working on a theme which contains a custom post type with custom fields. Everything is working perfectly except the when a new custom post is added, the custom fields for the first custom post and first one only are wiped.               function save_details(){           global $post;           update_post_meta($post->ID, "testimonyname", $_POST["testimonyname"]);     }       add_action('save_post', 'save_details');       This is what i am using to save the custom field data


Display last postings of 5 categories on homepage

i have a question. I want to display on my homepage (template) the last postings of 5 categories as excerpts. Means excerpts from last article of cat.1, last article of cat.2 and so on, so i got then 5 articles (excerpts), each one from a differend category i.e. cat. 1-5.; How can i make this "simply"? EDIT: I did it so:               <?php     $args = array( 'posts_per_page' => 1, 'order'=> 'DESC', 'orderby' => 'post_date', 'category' => '5', );     $postslist = get_posts( $args );     foreach ($postslist as $post) :  setup_postdata($post); ?>

<a href="<?php echo get_page_link(149); ?>">my 1. category

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

              <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(array( 120,120 ), array( 'class' => 'recent-thumbs' )); ?>
     <?php endforeach; ?>          <?php     $args = array( 'posts_per_page' => 1, 'order'=> 'DESC', 'orderby' => 'post_date', 'category' => '7', );     $postslist = get_posts( $args );     foreach ($postslist as $post) :  setup_postdata($post); ?>

<a href="<?php echo get_page_link(151); ?>">my 2. category

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

              <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(array( 120,120 ), array( 'class' => 'recent-thumbs' )); ?>
     <?php endforeach; ?>      Dis example shows 2 excerpts of 2 cats, and i have to repeat it until i get my 5 articles. I thougt, maybe is there a better way. Thanks, and sorry for my "great" englisch, -Orwell


How can I remove fields in the attachment editor?

Is it possible to remove a default attachment field from the attachment editor, for example the "Caption" field ? To give you some context, I'm trying to build a custom attachment editor page. I found how to add custom fields, now I'd like to remove some of the default ones I don't need.


Loading a remote WP website to Netbeans

I have a Worpdress blog on a hosting company (it's remote and existing). I would like to load it to Netbeans. How do I do that? Thanks,


WP Subtitle Plugin Problem

I'm having some problems getting the WP Subtitle plugin to work. After inserting the `<?thesubtitle()?>` or `<?getthe_subtitle($id)?>` into the index.php template I get a 'call to undefined function' error - inside or outside the loop doesn't seem to matter! Thanks in advance //Update In most pages the following now works thanks to toscho's updated syntax               <?php get_header(); ?>

<?php the_title(); ?>

<?php the_subtitle(); ?>

     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>      But no such joy in index.php where the following fails               <?php get_header(); ?>

<?php the_title(); ?>

<?php the_subtitle(); ?>

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


Post type hierarchy

I am looking to create two custom post types, one of which is a child of the other. Let's call them Authors and Books for simplicity. Authors should be a top level URL and the landing page for them should show a list of all their authored books. So you'd have something like: http://mysite.com/Shakespeare/ http://mysite.com/Shakespeare/Macbeth http://mysite.com/Shakespeare/Othello How do I create something like this in Wordpress? I am fine if it requires custom coding, just not sure how to express the relationship of post types to Wordpress.


Password protect a specific category page/post

I have searched high and low for this but nothing is sticking out at me. I am looking to password protect posts and/or pages based on a certain category. The reason for this is that I am creating a "members" side of things and want to keep things simple. If the post/page is in that category then users will enter a pre-defined password. I'd like to stay away from user/roles as i think it would be easier to change password every month and "members" being notified of such change rather than maintaining who's what. Hope someone can help me. If anything above doesn't make sense please comment :) Thanks in advance.


Efficient Tag Management?

I am the admin for a blog with around 20 authors contributing articles. Have just migrated from Wordpress.com. The problem that started to happen at WP.com, was different authors would use tags differently. i.e Some would pick just basic tags, others would list out every key word possible. It would appear that for WP roles, all the ones that allow people to submit posts, they can also tag their posts with as many tags as they want. So, my question is - **What is best practice for Tag Management for a blog that has multiple authors?**   \- I guess the answer to this could be subjective. But I really need experienced advice on this, and Wordpress-Answers is where I am going to find this.   \- Happy to convert to Community Wiki?


Is disabling test_form in wp_handle_upload a security concern?

I'm writing a plugin that modifies the default behavior when uploading a file for a post or to the media library. I'm setting $overrides in wp_handle_upload() with a custom $unique_filename_callback. Once I added that, it tripped the following check inside wp_handle_upload(), because $_POST['action'] wasn't set. (I'm not sure why it wasn't, but it wasn't).               if ( $test_form && (!isset( $_POST['action'] ) || ($_POST['action'] != $action ) ) )         return call_user_func($upload_error_handler, $file, __( 'Invalid form submission.' ));      So, I set $overrides['test_form'] = false, and now it's working. I'm wondering if that could be a potential security issue, though. Would that allow someone to post a form from a remote source or something? It seems like it's normal to disable it when you're creating your own upload fields, but I'm using the built-in post upload form, so I want to make sure.


Disallow Same Post Title

I am looking for some code where member can't use the same title as another post already having or used. e.g if there is a post with title "Amazing Australia Tour" than it should not allow to use the same title to same or other user.


Extending select_post type in Custom Meta Boxes for WordPress (HumanMade fork) to store both ID and Post Title

I'm trying to figure out how exactly to extend one of the existing fields in CMB (HumanMade fork). I'm not terribly familiar with this process, so I'm looking for a suggestion of where to begin. The type is `post_select`, which allows you to select from an existing post type to populate your options. It then stores the ID of that post in the named `meta_key` field. If it's repeatable, we just get multiple `meta_id`s associated with this post, each with the ID of the option selected. If the `multiple` argument is set to true, it instead serializes the selections for each field of this type. What I would like to do is extend this field type to store both the ID and the Post Title, most probably in a serialized array. This way Projects that people from the directory are assigned to will be returned in a search for their name on the front end (using Relevanssi to index my custom fields). Since it's just an ID that's stored right now, they aren't returned. Here's how I'm creating the metabox within a Projects CPT, with a Directory CPT as the select option:               function cmb_projects_metaboxes( array $meta_boxes ) {              $prefix = '_jra_project-';              $info_fields = array(             array(                 'id' => $prefix . 'principal-investigator',                 'name' => 'Principal Investigator(s)',                 'type' => 'post_select',                 'use_ajax' => true,                 'allow_none' => true,                 'query' => array(                     'post_type' => 'directory',                 ),                 'repeatable' => true,                 'cols' => 6,             ),         );              $meta_boxes[] = array(                 'title' => 'Basic Info',                 'pages' => 'projects',                 'fields' => $info_fields,         );              return $meta_boxes;     }     add_filter( 'cmb_meta_boxes', 'cmb_projects_metaboxes' );      I'm somewhat unfamiliar with OOP PHP, so I'm not precisely sure how to get where I want to be by writing an extension of the class. The current type is declared in classes.fields.php, starting at line 1062 My preference is to simply extend that field and change the data it returns/saves. Any thoughts or suggestions on how to do that?


Custom options - register, defaults and delete empty fields (Settings API)

I cant figure out how to register all of my setting fields into 1 database option. Code for my menu page:               add_menu_page('Custom options', 'Custom Options', 'manage_options', 'rm_options', 'display_options_page');      then my main function to add and register section, fields etc.               function rm_register_custom_settings_fields() {         add_settings_section('rm_contact_info', 'Contact Info', 'rm_contact_info_callback', 'rm_options');              add_settings_field('rm_number', 'Number:', 'rm_input_fields_callback', 'rm_options', 'rm_contact_info', array('rm_number', 'Description'));         add_settings_field('rm_adress', 'Adress:', 'rm_input_fields_callback', 'rm_options', 'rm_contact_info', array('rm_adress', 'Description'));         add_settings_field('rm_about_us', 'About us:', 'rm_textarea_fields_callback', 'rm_options', 'rm_contact_info', array('rm_about_us', 'Description'));              register_setting('rm_options_group', 'rm_number', 'esc_attr');         register_setting('rm_options_group', 'rm_adress', 'esc_attr');         register_setting('rm_options_group', 'rm_about_us', 'esc_attr');     }      then im displaying the options like this:               function rm_display_options_page() { ?>

<?php echo 'Custom options for:' . wp_get_theme(); ?>

Description
                  <?php settings_errors(); ?>                  <form method="post" action="options.php">                 <?php                     settings_fields('rm_options_group');                     do_settings_sections('rm_options');                          submit_button();                 ?>             </form>
     <?php      What I want to do, instead of having 3 different options in the database and registering them separately, as it is now, I want to have them saved as an array, I tried doing something like:               register_setting('rm_options', 'rm_options', 'esc_attr');      but nothing worked, how can I do this? Basically instead of:               echo get_option('rm_number');      It will be:               $options = get_option('rm_options');     echo $options['rm_number'];      And also, how can I set defaults for the get_option? If the value is empty, I want to echo some default message. It should work with `get_option('rm_options', 'default');` but I noticed that even when the fields are empty, they are saved in the database, so this default will never work. How to make this work? And last thing, to get the default thing to work and to clean database, how can I delete options when there is nothing entered in the field? How to control this, when wordpress is updating and doing all the work by itself? I will be really grateful when someone can help me with this, please. Thanks in advance :)


How to edit/delete single row items in a table on my own menu page

I have successfully created a wp-LINKS-list-table that displays the output of WP's core "Links" table in the WP Dashboard, and I have it displaying on a menu page I created. Step 1 accomplished! But now I would like to be able to have the single row edit/delete (database) functionality just like the Links page. Right now I can edit/delete the links, but it's just adding/removing items from the actual links database table. I'm assuming that I not only have to create a different database table for my own queries, but I need to process my pages outside of the WordPress core as well. Right? Or is there a core WP functionality that I can use to edit/delete my own table items?


jQuery forms & updating info

I'm attempting add some ajax to an existing script, all goes well for the first submit, but subsequent ones are not working as expected.                 add_action('wp_head', 'my_special_action_javascript');     add_action('wp_ajax_my_special_action', 'my_special_action_callback');     add_action('wp_ajax_nopriv_my_special_action', 'my_special_action_callback');     add_action('wp_ajax_my_cart', 'my_cart_callback');     add_action('wp_ajax_nopriv_my_cart', 'my_cart_callback'); and prior to those I also have a `wp_enqueue_script('jquery');`               function my_special_action_javascript() {     ?>     <script type="text/javascript">     //<![CDATA[     jQuery(document).ready(function() {      jQuery(".addtocart").submit(function() {       var data = {action: 'my_special_action',post:jQuery(this).serialize() };       jQuery.post("<?php echo admin_url('admin-ajax.php'); ?>", data,       function(response){        jQuery(".eshopajax").replaceWith(response);       });       function upCart(){        var tdata = {action: 'my_cart'};        jQuery.post("<?php echo admin_url('admin-ajax.php'); ?>", tdata,        function(response){         jQuery(".ajaxcart").replaceWith(response);        });       }       setTimeout (upCart,500);       return false;      });     });     //]]>          </script>     <?php     } Notes:   .addtocart is the class of the form (and there are going to be occasions when there are multiple forms on a page.)   .eshopax is a section within the form where I am displaying the response (though really I should add this via the script as well).   .ajaxcart is the cart in the widgets which I am trying to auto update.   setTimeout - added to slow things down for updating the cart, to allow the first process to finish. Now as explained the above works as intended, **once**. But when I submit the form again, even with different values the display is no longer changed, yet the cart is updated (upCart) and no response text is visibly added. Additionally it doesn't appear to recognise changed form details. So how do I reset things for it to recognise possible new form details? Additionally I don't think the _jQuery.post_ in the upCart function is correct either (but it does work...). any help appreciated. (originally asked over on the WordPress support forums).


How to configure DNS If I use the plugin yet-another-multi-site-manager?

I just configured yet-another-multi-site-manager and I can able to use internal sub-domains like **1.domain.com and 2.domain.com** as alternate domains .I can able to create sub-sites on those domains successfully like **try.1.domain.com** . But Unfortunately when I set external domain(Primary domain Registered some where else) the sub-site's URL showing error page.. Example: **3.domain.com** is addon domain pointing to my multi-site installation folder .A sub-site created under it is **try.3.domain.com** .This sub-site's URL showing error page. Actually I am pointing that external domain pointing to Numeric IP(My hosting is shared hosting) address of my multisite domain.Later adding that domain as an addon pointing to my Multisite installation folder . Does any one have Idea on this?I think that I have wrongly configured the DNS of Addon domain . **Update:** Now I am able to create sub-sites using the additional domains .But the problem is when logging into the sub-sites created on these domains .The login pages are again redirecting to login form and the loop continues .I am even unable to edit the sites using the option "Backend" on admin panel . **Update 2:** The code inside the yamm-signup.php page and yet-another-multi- site-manager.php are not updated as per the updated new version 3.1 .The plugin is prepared for wpmu not updated for a long while .


How can I show the contents of only a few users

I'm trying to show the contents only for certain registered users. All users have the role of "agent". To hide the contents of an unregistered user, I use this code:               <?php if  ( current_user_can( 'agent' )  ){ ?>         ///here the content     <?php } ?>      Now I want to show the contents only for users with id 8,9, with this code:               <?php if  ( current_user_can( 'agent=8,9' )  ){ ?>         ///here the content     <?php } ?>`,`<?php if  ( current_user_can( 'author_name=Jacks,David' )  ){ ?>         ///here the contents     <?php } ?>      But nothing happens!!! Please help.


wordpress custom_meta ordering of timestamps

So I have a wp meta query that is handling the searching of events which have a start timestamp, and an end timestamp, I want to return all results within the two dates a user picks in the search. This part is working fine as of now. However, I want to sort the results by the start timestamp, so the most recent events show up first.               $args = array(         's' => $_GET['k'],         'post_type' => 'event',         'posts_per_page' => '-1',         'post_status' => array( 'private','publish' ),              'meta_key' =>'_start_ts',         'orderby' => 'meta_value_num',         'order' => 'asc',              'meta_query' => array(             'relation' => 'OR',             array(                 'key' => '_end_ts',                 'value' => array(strtotime($_GET['d1']),strtotime($_GET['d2'])),                 'compare' => 'BETWEEN',                 'type' => 'NUMERIC'             ),             array(                 'key' => '_start_ts',                 'value' => array(strtotime($_GET['d1']),strtotime($_GET['d2'])),                 'compare' => 'BETWEEN',                 'type' => 'NUMERIC'             )         )     );      If I seach for all events in the month of april, we get the following timestamp ordering: 1397865600, 1398211200, 1398384000, 1397520000, 1398297600 how do I get wordpress to sort by _start_ts?


wp_nav_menu google analytics event tracking

I've got a WP3 custom menu, with a custom link in the menu, How can I add google analytics event tracking to that custom link. Thanks Alex


Load Balanced WP with single server admin access

I am trying to complete my load-balanced installation of WP and I have come into an issue. I would like to sync the uploads folder between the two installs but I do not know how to limit wp-admin access to a single server. Can someone please help me? Thanks!


Call to undefined add_action() in theme's functions.php

Once done validating a form with ajax, I use php within my functions.php to actually send the form.               <?php     $name = $_POST['fname'];     $lname = $_POST['lname'];     $subject_line = $_POST['subject'];     $email = $_POST['email'];     $phone = $_POST['phone'];     $message = $_POST['message'];     $captcha = $_POST['captcha'];               if (!empty($name) && !empty($lname) && !empty($email) && !empty($phone) && !empty($subject_line) && !empty($message) ) {              $to = 'email@domain.com';         $from = $subject_line;         $subject = $subject_line;         $body1 = "First Name: " . $name .             "\nLast name: " . $lname .             "\nEmail: " . $email .             "\nPhone Number: " . $phone .             "\nMessage: " . $message;         if (mail($to, $subject, $body1, 'From: ' . $email)) {             print "Thank you, we will get back to you shortly.";         }     }      When I add in the php to the functions.php, I get the fatal error Call to undefined add_action() in the theme's functions.php. Any suggestions on what I'm missing?


spacing disappears on posts when importing

This is a random question, so I'll be lucky if there's an answer out there. I imported this wp site from another location, and for some reason, none of the posts show spacing between paragraphs anymore. If you look at any post, you'll see there is no space between each paragraph. In the actual post, on the backend, the spaces are all there. Each paragraph has a nice space between it. On the actual site, the spacing disappears. What gives? This is the case with all of her posts, so I'd be just delighted if there is some solution to the issue. it's at: www.travelwithcastle.com and it's a twentytwelve child theme Kelly


Remove Slug From Custom Post Type URL?

On www.webhostingbreak.com I have custom post types for web hosting companies. Their url is /hosting-directory/ and unfortunately, since then (aug2010), we've still got all those pages at PR0 and rankings overall have been terrible. The only guess I have is that because visiting /hosting-directory/ causes a 404 error, Google might not see pagerank flowing from the root domain to a subpage of hosting-directory. We want to remove /hosting-directory/ altogether. We tried doing that but we couldn't get normal posts in a category to work. Is there any workaround for this? Custom post types destroyed our rankings and pagerank since august 2010. Be well and talk soon.


Problem code and show comments

**I use this code in shortcode for show posts :**               <?php     while ($wp_query->have_posts()) : $wp_query->the_post();           $imagen = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), "medium");     $ruta_imagen = $imagen[0];     if ($ruta_imagen!="")     {     $ruta_img="ID)."'>";     }     echo $ruta_img;          endwhile;     ?>      This code works perfect inside the code for create the shortcode , but the problem it´s if i use the shortcode and put active the comments for ones post or page , the form and comments no show I don´t understand what have bada this code for no let show the comments , if i don´t use this shortcode the comments show other time and the form Please if you can tell me which it´s the problem perfect for me Thank´s , regards !


Remove duplicated values from a loop

I have a loop that outputs `<option>` fields for a `<select>` group. It contains many cities' names for many travel packs that I am publishing. The trick is that I need avoid repeated values. For instance: I have 4 travel packs departing from Chicago, 5 from Orlando, 3 from Los Angeles e 2 from New York. So, it outputs:   **Select your city**   Chicago   Chicago   Chicago   Chicago   Orlando   Orlando   Orlando   Orlando   Orlando   Los Angeles   Los Angeles   Los Angeles   New York   New York   I would need to print only one of them!               <select name="nDep" id="iDep" onchange="this.form.submit();">     <option selected disabled>Outras saídas disponíveis</option>       <?php         $args = array(           'post_type'     => 'packs',           'order'         => 'ASC'         );         $the_query = new WP_Query( $args );         if(have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post();       ?>          <option value="<?php the_field('departures'); ?>"><?php the_field('departures'); ?></option>            <?php endwhile; endif; ?>     </select>


$wp_query when new WP_Query

I'm trying something but I have an issue with WP_Query. I've an Hook on the_post in order to add some variation on the query.               add_filter('the_posts', 'query_variation');          function query_variation($posts, $query = false) {         if (is_search())         {         // Do stuff         }     }      It's working well when I'm searching on the site. But, I know creating an ajax search like that :               function ajax_search_123( ){          $search_keyword = esc_attr($_REQUEST['query']);          $args = array(                 's'                     => $search_keyword),                 'post_type'             => 'product',                 'posts_per_page'        => 3,             );             $products_query = new WP_Query( $args );             // Do stuff with $product_query     }      But when I instanciate WP_Query with $args, is_search() doesn't return true so I'm entering on the if... What Can I do ? Thank you for your help


How to get first post in a category of a custom taxonomy

I'm attempting to make a list of categories bound to a custom taxonomy, but using the featured image of the first post in each category. Getting the categories was simple enough, but when I try to query for the post thumbnail I keep being presented with the details form the most recent post in the first category fetched. I am running this outside The Loop, if that makes any difference;
         <?php                 $categories = get_terms(                     array(                         'produkter'                     ),                     array(                         'hide_empty' => false,                     )                 );                      foreach( $categories AS $cat )                 {                     $taxonomy = new WP_Query( array( 'posts_per_page' => 1, 'tax_query' => array( 'taxonomy' => 'produkter', 'terms' => $cat->slug ) ) );                     while ( $taxonomy->have_posts() )                     {                         $taxonomy->the_post();                     ?>

                                 <a href="<?php bloginfo( 'wpurl' ); ?>/produkt/">                                     <?php the_post_thumbnail( "product-small" ); ?>
                                  <a class="product-title" href="<?php bloginfo( 'wpurl' ); ?>/produkt/"><?php echo $cat->name ?>
                          <?php                     }                 }         ?>


My Server Has Problem With Class-Editor.Php / $buttons

My server has problems displaying the Visual and Text buttons, the code for the buttons is simply missing and none of the obvious solutions works. // blank default Install, no plugins, default theme // problem on entire server // not a wp-config.php issue /concenate scripts etc For some strange reason my server will not process `$buttons` and therefore the buttons are not visible. Any ideas what could be the issue? Is this a PHP configuration issue? I dont get any JS errors at all, so pretty much have no idea how to fix it, because there's simply code missing in the source.               if ( self::$this_quicktags && self::$this_tinymce ) {         $switch_class = 'html-active';              // 'html' and 'switch-html' are used for the "Text" editor tab.         if ( 'html' == wp_default_editor() ) {             add_filter('the_editor_content', 'wp_htmledit_pre');         } else {             add_filter('the_editor_content', 'wp_richedit_pre');             $switch_class = 'tmce-active';         }              $buttons .= '' . _x( 'Text', 'Name for the Text editor tab (formerly HTML)' ) . "\n";         $buttons .= '' . __('Visual') . "\n";     }


Add php function into .js file (for tinyMCE button)

I am creating a tinyMCE button for the wp WYSIWYG editor. Basically what happens is when a use clicks on the button a modal form pops up and they have to enter a few fields. However One of the fields needs to be a list box that lists every post category and the user will select one. The basic syntax for that is as follows:               {     type: 'listbox',      name: 'sds-category',      label: 'Category',      'values': [         {text: 'Name Of Cat', value: 'Cat ID'},         {text: 'Name Of Cat', value: 'Cat ID'},         {text: 'Name Of Cat', value: 'Cat ID'}]}      So in order to get all the categories displaying like that I have used a PHPfunction which will spit out that `{text: '', value: ''}` syntax for every category and it goes as follows:               function write_cat_list($cat){         $cats = get_categories('hide_empty=false&orderby=name&order=ASC&parent=' . $cat);              if($cats) :             foreach ($cats as $cat) :                 $tinyMCE_list[] = "{text: '".$cat->name."', value: '".$cat->term_id."'}";                 write_cat_list($cat->term_id);             endforeach;             echo implode(',', $tinyMCE_list);         endif;     }      So now all that is left is placing the PHP function `write_cat_list(0)` into my .js file, and that is where I am completely stuck! I am not sure how to go about doing this, because I am very very inexperienced with AJAX, is there an easy way or a jquery function that will make it easy to include my php function to this js file?


term_link filter gives less atributes

I have made a filter for term_link but when I work with it, I get message about not getting the second and third attr. Its a pitty, i need them               add_filter('term_link','authorsongsurl',10);          function authorsongsurl($url,$term='',$taxonomy=''){          }      Whats up?


Only output function from functions.php if conditional tag is true

I am using Masonry (included in WP 3.9) in my childe theme. I followed this tutorial. In their code for functions.php they use conditional statement:               if ( ! is_admin() ) :     function slug_scripts_masonry() {         wp_enqueue_script('masonry');         wp_enqueue_style('masonry’, get_template_directory_uri().'/css/’);     }     add_action( 'wp_enqueue_scripts', 'slug_scripts_masonry' );     endif; //! is_admin()      The ! is_admin seems to work, because when I look up the source, I can't find anything. However, my goal is to only let this function run when we are an a taxonomy page. However, changing it to:               if ( is_tax() ) :         function slug_scripts_masonry() {             wp_enqueue_script('masonry');             wp_enqueue_style('masonry’, get_template_directory_uri().'/css/’);         }         add_action( 'wp_enqueue_scripts', 'slug_scripts_masonry' );         endif;       does not work! It's including nowhere anymore! What am I doing wrong?


Is it possible to track down Actions and Filters?

As far as I know using Actions and Filters hooks is the best approach for developing on WordPress. I have just to ask if there is any way to track down which Actions and Filters are applied on WordPress rendering. My question is based on the fact that hooks may be applied by on WordPress through various plugins or the active theme itself. Is there any way to track down which Actions and Filters hooks are fired and from which file are they called?


New register email notification sending some fields blank on site admin emai id

Working on real estate project.Here i am facing a problem with new email registration when user register with site admin getting some fields blank.i am using Group but plugin and also in back end under Group Buying Plugin > Account tab getting warning to city ,state colum like:               Warning: Illegal string offset 'city' in /home/reddvise/public_html/app/wp-content/plugins/group-buying/controllers/groupBuyingAccounts.class.php on line 299.       I am using word press version 3.4.1 with Group buying plugin Version 3.5.1 **Getting Email like below example:-** New user registration on your site Reddvise Real Estate: User Id: 243 Username: sanjay E-mail: sanjaynakate@gmail.com Mobile No. : Address : City : State : Pin Code : Country :               public static function column_display( $column_name, $id ) {             global $post;             $account = Group_Buying_Account::get_instance_by_id($id);                  if ( !$account )                  return; // return for that temp post                  $user = Group_Buying_Account::get_user_id_for_account($account->get_ID());             $user_data = get_userdata($user);             $address = $account->get_address();             switch ( $column_name ) {                 case 'id':                     echo $id;                     break;                      case 'username':                     echo get_avatar( $user_data->user_email, '35' );                     $get_name = $account->get_name();                     $name = ( strlen($get_name) <= 1  ) ? $post->post_title : $get_name;                     echo ''.$name.'
';                     break;                      case 'user':                     echo ''.$user_data->user_login.'';                     break;                      case 'state':                     echo $address['zone'];                          break;                      case 'city': //on this line getting a warning                      echo $address['city'];                     break;                      default:                     # code...                     break;             }         }


Enabling XSendFile causes 404 for images on Wordpress Multisite / Network

I've compiled and installed the `XSendFile` module and added the following lines to my `.htaccess`:               XSendFile On      It shows up as being activated in `<?php info() ?>` under loaded modules. The problem is, when I activate it in my site's top level wp-config.php using:               define('WPMU_SENDFILE', true);      All images on all the blogs in our network stop loading. When you try and click on them you get a 404 error for `wp-includes/ms-files.php` I figure this is something to do with my `.htaccess` not magicing the URLs correctly, but it looks correct to me:               RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # uploaded files     RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]          # add a trailing slash to /wp-admin     RewriteRule ^wp-admin$ wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule ^(wp-(content|admin|includes).*) $1 [L]     RewriteRule ^(.*\.php)$ $1 [L]     RewriteRule . index.php [L]          XSendFile On      How can I get XSendFile to correctly send files on our Wordpress Network?


How to add a second content section when using certain page template

Is it possible to enable a second content area in the edit screen if a certain template is chosen? I have seen plugins like the second section plugin but that enables it for all pages I would like to only have the second section if a certain page template is chosen for a page.


Taxonomy Pagination

I have a `custom post_type => 'products'` wich has a `taxonomy => 'product_type'` and I have a page that uses a template to display all posts by `post_type => 'products'`. Works just fine when I create a PAGE for each post_type/taxonomy template but... I have for example a term named `"furniture" (taxonomy => 'product_type')`, and I don't want to create a page+template for each term that I'll be adding, it's crazy but seems to be the only way the pagination works on a static page. So, I can get the first page with the posts of the current term but in the second page forwards to search page and gives me an output with the number os posts (with that term) that I have, that number is correct but it doesn't display my posts!!! So I'm going crazy to figure out a way to make it work, god!! I have custom permalinks (only the postname)... I've seen almost all topics os taxonomy pagination, nothings works for me... I'm really desperate, please help...


Which file of wordpress manage plugins functionalities?

Which file of wordpress manage the plugins functionalities. For example if a have to insert another rule in a plugin functionality where i go to modify?


Wordpress Author Page

Whenever I click on the Author link, I get redirected to the home page. I've set up the author.php page according to the instruction on codex, but still no luck. Does anyone have any other suggestions?


Best practice for implementing a blog page / section in wp_menu_nav()

I currently have a theme I am developing and had a thought on best practice. I am using `wp_menu_nav()` for my menus and they are linking to 4 or 5 pages respectively. I would like to add a page / to this menu but do not want to add a specific template to list the blog posts, in addition I do not want the user going to edit a page called blog with no content in it. What is the best way to implement a page with all blog posts to the current `wp_menu_nav()`. This seems simple to me in theory but I want to make sure I am using best practice for this. Open to hearing how you would go about this. Thanks in advance, JN


Stop Wordpress from "guessing" redirects for nonexistent URLs

Wordpress sometimes "guesses" a redirection for a nonexistent page slug if the slug is at the beginning of another URL. After some searching, my hypothesis is that this part of the canonical redirection functionality, which can be disabled using this code:               remove_filter('template_redirect', 'redirect_canonical');       However, I like the idea of canonical redirection, and would prefer not to turn it off entirely. Is there a way to only disable the slug "guessing"? I would prefer a 404 over an incorrect 301.


Duplicate and alter sidebar for Twenty Eleven

I'm trying to create own template including submenu instead of the regular sidebar in Twenty Eleven. Although I manage to create and select my new template the page ends up with bad CSS. Here is what i have done   * Copy sidebar-page.php and named it submenu-page.php   * Copy sidebar.php and named it sidebar-submenu.php In **submenu-page.php** Added new template name " **Sidebar left menu template** " and changed               <?php get_sidebar(); ?>      to               <?php get_sidebar('submenu'); ?>      In In **sidebar-submenu.php** Replaced all code with Hello World-link. Even tough Hello World appears correctly the link is uncklickable due the div #primary is all over the page. For unknown reason the HTML-body gets both singular and two-columns as value in the class attribute. If I edit sidebar-page with get_sidebar('submenu') everything looks and works great. _**How do I tell wordpress that my template (submenu-page.php) is two columns and not both single and two columns?_** Thanks for your time!


New Roles and Capabilities in WordPress

I am creating a new role in WordPress, and I would like it to be simlar to an 'author' role, except that this new role only allows 'working with' a specific category (in other words, it allows editing, posting, deleting posts of a specific category only). Can that be done?


Show number of views in the last 48 hours

I have now the most popular views on the posts I have. But I want to show the most viewed in the last 48 hours. How can I achieve that? Someone helped me and I placed this in single.php file. $post_id = get_the_ID(); $post_view_count = get_post_meta($post_id, 'view_count', true);                   if( $post_view_count=='' ) {                                 update_post_meta($post_id, 'view_count', 1);                         }         else{                 $post_view_count = intval($post_view_count);                 ++$post_view_count;                 update_post_meta($post_id, 'view_count', $post_view_count);         }       And I have this in tabs4.php to show the 4 tabs on my website:               $args_popular = array (                 'posts_per_page'         => '5',                 'order'                  => 'DESC',                 'orderby'                => 'meta_value_num',                 'meta_key'               => 'view_count',                 'day'                    => '2',                 'cache_results'          => true,      But current day => 2 is not working. Thanks a lot.


Processing empty search TwentyTen

On my website when you submit an empty search box it takes you to a page that says nothing found however the navigation menu isn't displayed but it does when you enter a search term (whether it finds anything or not). How do I change it so that if a person submits an empty search it either doesn't do anything or takes them to a nothing found page with the navigation menu displayed. If I am correct it is loop.php that needs editing but I have tried different things based around my searches on the internet with no result please could someone help me with this problem? Thanks


A /proc folder in wp-content?

I inherited a WordPress site that a series of consultants built and who are all long-gone. As I grep'd to find where they defined a strange shortcode they keep using, grep dumped a sequence of errors as it tried to read files from `ABSPATH/wp-content/proc`. Comparing the contents and dates of `ABSPATH/wp-content/proc` to the real `/proc` on my server, I suspect somebody copied over the contents of their `/proc` during development (but why?). Before I delete it:   1. I want to be sure this isn't needed by WordPress for some weird situation I haven't ever encountered. Grepping through the files in the custom theme, I don't see any references to the directory. A few web searches also turned up nothing, so I think I'm safe here...but...   2. I am functionally literate with Linux but far from expert, so I hoped somebody could tell me how to check this rogue /proc directory to be sure deletion won't damage my operating system because of a link or reference or...something I don't know about yet.


Script dependencies for post.js

I have already got the built in meta boxes displaying on the front, but some of them require the accompanying `wp-admin/js/post.js` to function correctly. I'd rather not rewrite anything here and just include what is already written. The problem is there are variables in the file which must be declared somewhere else, `postboxes` for example. Does anybody know where in the core files this file and/or it's dependencies are defined? If anybody is wondering, this is part of a front end administration plugin.


Why does Jetpack insert it's script outside the <html> tag?

I went to validate my HTML with the W3C validator and I got this error: Line 463, Column 77: Stray start tag script.   …t src="http://stats.wordpress.com/e-201338.js" type="text/javascript"> This script is insterted by the Jetpack plug-in for the statistics, but it is inserted outside of the html tags, which ruins my validation!! Any ideas how to fix that? Thanks.


Change the Author name to a custom field?

In my wordpress backend, is there a way to change the author metabox to display a custom field instead of the user's display_name or username? For example, all our users have a custom field 'Organization' which shows their company name. I want this to be displayed in the Author dropdown box on the post.php page instead of the normal id or username. This is to make it easier for our client's web admins to find users(aka companies) faster when creating new posts. Possible? We used CIMY Extra User Fields for the additional fields. Any help would be great.


feed appearing different in the three main browsers

My blog feed appears diffenently in the three main browsers:   * in IExplorer it is perfect;    * in Chrome it appears as a xml file in source view   * in Firefox it appears like the result list from a search in the blog (first lines of the posts without any html formatting) Why?


Permissions question

Is there a plug in that allows User A to only see and edit their own post and User B to see all posts from all users like User A. We have tried a few plug ins without success. Thoughts?


Add custom post type taxonomy tag to article class

Ok, so I have tried about 5 different WP functions now and no luck. Basically here is what I want to do. I have a custom post type called "work", I have a taxonomy within this custom post type called "type" with 2 types available.. "Case Study" & "Portfolio". Depending on which option is checked off I would like that to print in the class of my container for that item and also be converted to lower case with spaces replaced by underscores.               <aside class="work_item <?php has_term('Portfolio', 'type'); ?>" data-type="<?php $posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) { echo str_replace('-','_',$tag->slug . ' '); } } ?>">      That is what I have now but no luck.. I have tried: has_term get_the_terms get_term and no luck... been looking at this so long now feel like I am missing something dumb Desired output:               <aside class="work_item case_study" data-type="<?php $posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) { echo str_replace('-','_',$tag->slug . ' '); } } ?>">      &               <aside class="work_item portfolio" data-type="<?php $posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) { echo str_replace('-','_',$tag->slug . ' '); } } ?>">      Thanks!


A good hook to check authorization and redirect?

It seems strange to put a redirect in a template page, because so much of the page has already been built by the time you reach a custom page template. I'm wondering what is a good action hook to use where I can test whether the user's logged in, and whether they're on a particular page/category/etc and `wp_redirect` them if necessary?


Is it possible to restrict a specific user to edit a specific custom post.

I have a site setup with a custom post for team member profiles, blog posts etc ... I am currently setting up user roles so that users can edit certain areas of the site. I currently use Adminimize to restrict user permissions by role, and it works fine. What I would like to do is to be able to restrict the appropriate user to only being able to edit the team member profile that relates to them (one single post within the custom posts of 'team members) or that they have permission to do so. I don't believe that this is possible through Adminimize as its done on a per role basis. Is anybody aware of a possible solution to this that they could recommend, if it is at all possible? Thanks in advance for any help Cheers Noel


Add Tags to custom post type

I'm using the cherry framework on a WP site. It comes with a custom post type that can be used to add 'Team Members' and create staff pages etc. I need to expand this so that I can add tags to each 'team member' inorder that I can essentially tag them as working in a department a / b / c / etc. The custom post type is registered in the theme-init.php file using this code;               /* Our Team */     function my_post_type_team() {     register_post_type( 'team',         array(             'label'               => theme_locals("our_team"),             'singular_label'      => theme_locals("our_team"),             '_builtin'            => false,             // 'exclude_from_search' => true, // Exclude from Search Results             'capability_type'     => 'page',             'public'              => true,             'show_ui'             => true,             'show_in_nav_menus'   => false,             'menu_position'       => 5,             'menu_icon'           => ( version_compare( $GLOBALS['wp_version'], '3.8', '>=' ) ) ? 'dashicons-businessman' : '',             'rewrite'             => array(                                         'slug'       => 'team-view',                                         'with_front' => FALSE,                                     ),             'supports' => array(                             'title',                             'editor',                         'thumbnail',                         )         )     );     }     add_action('init', 'my_post_type_team');      I want to add tags to this, so that when I add a new team member, I can also assign them to a department by means of adding a given relevant tag. At present the tag editor box doesn't appear on the add new / edit page. So, I adapted the above code to include a register taxonomy like this;               /* Our Team */     function my_post_type_team() {     register_post_type( 'team',         array(             'label'               => theme_locals("our_team"),             'singular_label'      => theme_locals("our_team"),             '_builtin'            => false,             // 'exclude_from_search' => true, // Exclude from Search Results             'capability_type'     => 'page',             'public'              => true,             'show_ui'             => true,             'show_in_nav_menus'   => false,             'menu_position'       => 5,             'menu_icon'           => ( version_compare( $GLOBALS['wp_version'], '3.8', '>=' ) ) ? 'dashicons-businessman' : '',             'rewrite'             => array(                                         'slug'       => 'team-view',                                         'with_front' => FALSE,                                     ),             'supports' => array(                             'title',                             'editor',                         'thumbnail',                         )         )     );     register_taxonomy(         'team_tag',         'team',         array(             'hierarchical'  => false,             'label'         => theme_locals("tags"),             'singular_name' => theme_locals("tag"),             'rewrite'       => true,             'query_var'     => true         )     );     }     add_action('init', 'my_post_type_team');      However, I'm still not getting the tag box showing up on the edit page in admin. Any help with this will be greatly appreciated.


Wordpress email templates

I have a custom plugin which needs to send custom emails to users in specific cases. At the moment i have the email content embedded in within the plugin codebase which makes updating the text a little difficult since the plugin needs to be updated. I want to decouple the email content from the plugin but can't decide on the approach i should use. I could extend the existing plugin and allow the user to create a specific page for each email template. The user can update the content on the page as they like. The admin backend for the plugin would then map each email type to a the specific wordpress page. When i need to send a specific email, the plugin would get the specific page content and use that as the message parameter for wp_mail(). An alternative approach might be to use an existing off the shelf email editing plugin for this. What solutions have other developers used for this scenario?


Implications of changing wordpress.com associated with Jetpack

Our corporate blog has the Jetpack plugin and it is associated with my personal wordpress.com account. I'd like to change it to our corporate wordpress.com account. If I do that then will I lose the site statistics from before the switch?


Making WordPress available while logged into another website

A bit of a tricky one this and I'm not sure the best way to proceed or even if there is way to proceed. We have a self-hosted, secure, members-only website running off Oracle and IIS. Members sign up, get a username, password and PIN (via PIN mailer). They can then access this site and go about their business. Our model is to build simple stand alone brochure sites in WordPress hosted on a shared hosting plan that acts as a portal to this secure site. This model has worked fine for years as there has never been a need for overlap between the two. We have a customer asking that the WordPress site be locked down and accessible only via a username and password. We are trying to work out a way to allow access to the WP site if someone has logged into our secure site. Or to see if there is a way we can use the credentials from one on the other without need to recreate the user in WP. Heads are being banged off tables at this stage so I am throwing this one out to see if people better placed than us have a solution. I can provide any additional information that might be required. Thanks in advance. G


Popular posts by view with Jetpack

I'm using Jetpack to retrieve the number of views for each blog post. Is there a way to use this to generate a call to the most viewed posts and list them? I've been wanting to do that for a long time now and I've looked into various plugins, but I'd prefer to hardcode this. Is there a way to write a code so that I could utilize the view count provided by Jetpack? I looked at similar questions here, but none of them has been answered. A few commenters suggested plugins, but those have been abandoned by now. I couldn't find any up-to-date information. Right now I'm only calling the "view count" within my single.php like that:               <?php print_page_views(get_the_ID('')); ?>       For that I'm using a plugin called "Post 'n Page Views" that requires Jetpack. I tried looking for the plugin in the Wordpress Dabatase, but it doesn't seem to exist anymore. I really would appreciate any kind of advice or updated information on this. Thank you so much!


How to display popular posts in page?

I'm trying to create a "Start here" page on my blog. I use a template for that, but the content for it is created using the "add new page" wizzard in Wordpress. I know how I can display the most discussed posts (with most comments), but php doesn't work in pages. Of course I just can paste the code into the page template instead, but look at the following:               <?php     /*       Template Name: Test Layout     */     ?>          <?php get_header(); ?>

     <?php     $pc = new WP_Query('orderby=comment_count&ignore_sticky_posts=1&posts_per_page=6'); ?>     <?php while ($pc->have_posts()) : $pc->the_post(); ?>
     <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?>
     <?php endwhile; ?>
               <?php the_content(); ?>
          <?php get_footer(); ?>      This is my template. I use "the content" so that everything I write via the "page wizard" will be in there. I don't want to copy and paste everything into the template itself for various reasons, so I need to find a way to make this work with the code above. If I call the popular posts below "the content" it works without any problem. If I call it before it (like in the code above), the actual content of my page won't show up and instead the last blog post in the list of popular posts will be displayed. I hope you were able to understand the issue.


Trouble with pretty permailnks buddypress .htaccess custom posttypes

I have a buddypress/bbpress website that also has multiple additional custom post types. After adding each new custom post type I would update permalink settings to correct the 404 not found occuring with that post type. However this would not work unless I deactivated buddypress first then updated permalinks then reactivated buddypress. I am almost doen with the website and one page that displays the "classifieds custom post type creatded by WPMU Dev "classifieds" plugin is still 404ing. The "My Classified" page works along with individual classifieds. All other pages work. If I set wordpress permalinks to default then the page works. Has any one lese heard of .htaccess problems with only one page in wordpress?


unexpected '$mm' (T_VARIABLE) in wp-includes/functions.php

I have a few Wordpress sites and all are down: > An unexpected condition was encountered while the server was attempting to > fulfill the request. Error code: 500 When I look at the apache log, there are errors (for different sites):               [Mon Apr 15 04:00:28 2013] [error] [client ...] PHP Parse error:  syntax error, unexpected '$mm' (T_VARIABLE) in /var/www/SITEA/html/wp-includes/functions.php on line 192, referer: http:...     [Mon Apr 15 04:00:55 2013] [error] [client ...] PHP Parse error:  syntax error, unexpected '$mm' (T_VARIABLE) in /var/www/SITEB/html/blog/wp-includes/functions.php on line 183     [Mon Apr 15 04:01:42 2013] [error] [client ...] PHP Parse error:  syntax error, unexpected '$mm' (T_VARIABLE) in /var/www/SITEC/html/wp-includes/functions.php on line 203      How can I fix the error? Or is it related to the recent wordpress attack?


How To Add Memory?

I just installed wordpress on WAMP localhost win8. However at the very end of the wordpress installation a little box popped up saying something about there being no disk space, which I regret not screenshotting before hitting OK. I cannot upload media of any kind as there is no space, and the preview of wordpress available doesn't appear anything like the tutorial said it would. Tutorial said this: ![enter image description here](http://i.stack.imgur.com/HT8ec.jpg) Actually looks like this: ![enter image description here](http://i.stack.imgur.com/3YALg.png) I have tried messing with php.ini max file size to no avail. in case you are wondering I am following this tutorial: http://sixrevisions.com/tutorials/web-development-tutorials/using-xampp-for- local-wordpress-theme-development/


Comment notification not working

I use a different theme named Team Talk (Premium). Since I use this theme, I don't receive the new comment notification by email. I don't know where to look at but I found this in my new theme :               function get_content_html_for_comment($comment){         $comment_html  = "";         // Get the comment data         //switch on the output buffer         ob_start();         // Allow the email to the author to be sent         wp_notify_postauthor($comment_ID, $comment->comment_type);         $max_depth = get_option('thread_comments_depth');         $args = array ('max_depth' => $max_depth);         //render the content to the output buffer         //call _ht_comment          echo _ht_comment($comment, $args, $this->calculate_comment_depth($comment));         //the content will now be in the buffer, so get that         $comment_html = ob_get_contents();         //restore buffer         ob_end_clean();         return $comment_html;      So, it seems to allow to receive notification but it doesn't work.


get_template_part() to render single page Theme

I´m developing a single page theme and want to render all pages with their respective templates on a single page. I know I could make a query and write the markup for the respective page, but I prefer separate all templates in files. What I want is to make the loop and load the template-*.php file for each page. Is that possible? To clarify this a little bit, below follows an example of what I want:               $query = new WP_Query();      $wp_query->query('post_type=page');     while ($wp_query->have_posts()) : $wp_query->the_post();         get_template_part('templates', 'template_slug');     endwhile;      and in the while loop output not only the content, but the content in teh right markup. Any help is more than appreciated!


Wordpress MU sunrise dropin for remote domain

I've been digging around for days hoping to stumble onto an answer. Wordpress.org isn't getting any bites and I've seen several users post responses to other related sunrise dropin solutions so here goes. My research concludes that sunrise dropins are most likely the way to go about this. Details: One VPS running apache using cPanel accounts. domain1.com is on account1 and serves both Wordpress SA and WHMCS domain2.com is on account2 and serves WPMU with many websites I would like domain1.com to pull from the WPMU on domain2.com so I can utilize the networks plugins and hard work I've put into it without migrating the account. I don't know if this gets me any closer but I figured out how to get domain1.com to pull from domain2.com/wp-config I would like to keep domain1.com intact with account 1, however the primary website localized on account 2 and the MU network. I figured out I can change the values in domain1.co/ wp-config.php to use domain2.com/wp-config.php which is a huge step toward what I want.               domain1.com/wp-config.php     define( 'BLOCK_LOAD', true );     echo ( file_get_contents( 'http://domain2.com/wp-config.php' ));     echo ( file_get_contents( 'http://domain2.com/wp-includes/wp-db.php' ));     $wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);      This effectively loads the configuration from domain2.com for domain1.com. The next step is defining the site ID as mapping domain1.com within domain2.com network doesn't work. I'm not sure how to go about making this work but I understand the basic principle of what needs to happen. domain1.com queries the database and returns wp_ID for which I intend to use. Now I need to figure out how I can get domain1.com to reference it's site ID in the WPMU database. I've seen some pretty sweet tricks with sunrise dropins and dealing with domain related customizations so I hope I am one step closer to a solution!   * Here's my question as posted on Wordpress.org


Problem using wp_mail function

I have a form whose message is composed from multiple input fields when submitted. I got this form working as simple php document but when I'm trying to use the form within a wordpress page it doesn't work. And I've switched to wp_mail function. Anyone has any idea? Thank you               <?php     $errors = array();     $missing = array();          if (isset($_POST['send'])) {         $to = 'mail@yahoo.com';         $subject = 'Form';         $expected = array('name', 'email', 'pick_up_adress', 'drop_off_adress', 'phone', 'pick_date', 'pick_time', 'type');         $required = array('name', 'email', 'pick_up_adress', 'drop_off_adress', 'phone', 'pick_date', 'pick_time', 'type');         $headers = "From: Metro<email@example.com>\r\n";         $headers .= 'Content-Type: text/plain; charset=utf-8';              if ($mailSent) {             header('Location: after_form.php');             exit;         }     }          // Array proccesing     $mailSent = false;      if (!$suspect && !$missing && !$errors) {         $message = '';              foreach($expected as $item) {             if (isset(${$item}) && !empty(${$item})) {                 $val = ${$item};             } else {                 $val = 'Not selected';             }                  if (is_array($val)) {                 $val = implode(', ', $val);             }                  $item = str_replace(array('_', '-'), ' ', $item);             $message .= ucfirst($item).": $val\r\n\r\n";         }              $message = wordwrap($message, 70);              // simple php doc $mailSent = mail($to, $subject, $message, $headers);          $mailSent = wp_mail($to, $subject, $message, $headers);              if (!$mailSent) {             $errors['mailfail'] = true;         }     }     ?>


Creating custom Insert Media page

I'm writing a plugin, that has the basically the same functionality as Insert Media page in "Add media" popup. The only difference mine has to use web service for browsing media. I already read about `media_upload_tabs` and managed to create a tab. Now I'd like to have the **exact** same layout as Insert media tab, but unfortunately my media tab is an iframe (ugly) and doesn't have any CSS styles (or JS) attached. How can I print required CSS styles (I think I'll rewrite the JS part in Angular) in my tab? I've tried to enqueue some basic styles but couldn't find how to print them or how they are named. EDIT: As requested, some code, changed a bit to hide the name of the plugin First for adding custom tab:               function something_upload_tab( $tabs ) {         $tabs['something'] = 'something';         return $tabs;     }     add_filter( 'media_upload_tabs', 'something_upload_tab' );      Then for displaying the tab:               function something_upload_tab_content() {         require('views/something.php');     }     add_action('media_upload_something','something_upload_tab_content');       `views/something.php` is is a bunch of HTML copied from Insert Media tab. It isn't important except for one line (or a few more maybe) I am missing to put there proper styling for WordPress admin panel.


How to add nofollow to wp_nav_menu

I need to add an option in my theme options panel to set a specific custom menu's links all to nofollow. Does wp_nav_menu() allow this or does it require a custom walker to manually ad rel="nofollow"?


Thumbnails and Lightbox

As mentioned on wordpress.org, it is possible to link a thumbnail to its larger self.                <?php       if ( has_post_thumbnail()) {        $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large');        echo '';        the_post_thumbnail('thumbnail');        echo '';      }      ?>      But I can't find how to make this link modifiable by plugins. I'm using Simple Lightbox but I regularly had to change in the last years. Currently I get a link to the larger image, I would like to see it in lightbox like all the other images in articles. I don't feel satisfied with the other answers on stackexchange. They say that we should add manually "rel=lightbox" in the templates For the moment I added to function.php               function CJG_add_lightbox_to_achor(){         return 'rel="slb"';     }


Post classes in the loop are being changed in certain themes

Certain themes don't use the default post class structure in the loop ie
      Spacing.ca, for example, doesn't use this structure. The posts in their loop use the following tag structure:
      The result is that you cannot add classes to these sorts of posts in the main loop using:               add_filter('post_class', 'my_post_class')      I'd like to be able to add classes to specific posts in the loop given specific criteria (via a plugin im making) and can do it if themes use the standard structure first mentioned, but cannot do it if the theme uses the less typical structure in the 2nd code snippet. Any thoughts on how I could add classes to posts when the theme uses the 2nd code snippet? Thanks


Link Forms on Wordpress

On our Wordpress site, we have a form that consists of a series of (radio button style) questions. Depending on which answer the user provides to a particular question, we'd like to show the user a different form. That is, we would like to link multiple forms to our one main form. Is this possible? If so, can someone explain how to do this, or point me to any kind of resource that might help? I am very new to Wordpress.


menu items toggle and display on screen size reduction

I am working with a child of Twenty Twelve. I made my own images to act as menu li backgrounds. When I reduce the screen width by moving my browser window in, the menu items seem to toggle automatically. I have never fiddled with any of the CSS or JS for this behavior. The resulting dropped-down list overlays the other menu items and makes them unreadable. Not to mention, I don't want the behavior in the first place. Is there such thing as auto-toggling?


Generate HTTPS Urls in multisite

I have a plugin that allow my users in multisite to generate simple urls like http://example.com/user/?my_url=2DD0B8183 but i want to include the https instead http ...               echo '
';         echo '
<input type="text" class="url" value="' .get_option('home'). '/?my_url=' . $download["code"] . '" onclick="this.select();" />
';         exit();       }      I tried               echo '
<input type="text" class="url" value="https://' .get_blogaddress_by_id( $user_info->primary_blog ) . '?my_url=' . $download["code"] . '" onclick="this.select();" />
';      but i get `https://http://example.com/user/?my_url=C4785825B` I have already forced ssl/https for entire my network via .htaccess               RewriteEngine On     RewriteCond %{HTTPS} !=on     RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


Hide pages from google and visitors

I have wordpress site where i have few custom type pages. I load the content of those pages with jquery load. But I dont want that those pages are directly visible. So if user goes to http://www.domain.com/work/project-name it wouldnt be visible. Or atleast that search bots wouldnt index these pages that are under /work/ I use single.php for the html for the page. What could I do? Just deny search bots to go with robots.txt? Could I somehow deny users to go there too but still keep that jquery load works normally. Thanks!


Problem uploading images

Multisite 3.4.1 wordpress I redirected wp-admin with htaccess rules, and renamed wp-content and plugins with via wp-config http://codex.wordpress.org/Editing_wp-config.php#Moving_wp- content now I can no longer upload images. when I try to upload an image it starts crunching but then either has an http error or says are you sure that you want to do this but then does not let me upload the image. **this is in .htacess**                RewriteEngine On      RewriteBase /      RewriteRule ^login$ wp-login.php      RewriteRule ^index\.php$ - [L]           # uploaded files      RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]           # add a trailing slash to /wp-admin      RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]           RewriteRule ^([_0-9a-zA-Z-]+/)?private-admin/?$ $1private-admin/index.php?wdeb_on [R=301,L]      RewriteRule ^private-admin(.*)$ wp-admin$1           RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin/([_0-9a-zA-Z-]+).php\?(.*)$ $1private-admin/$2\.php\?$3 [R=301,L]                RewriteCond %{REQUEST_FILENAME} -f [OR]      RewriteCond %{REQUEST_FILENAME} -d      RewriteRule ^ - [L]      RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]      RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]      RewriteRule . index.php [L]      **This is in wp-config** /* Changes to redirect wp-admin to private-admin folder */                $redirect_url=$_SERVER['REQUEST_URI'];      if(preg_match('/wp-admin/i', $redirect_url)) header('Location:    '.str_replace('wp-admin', 'private-admin', $redirect_url));          /** Change name of wp-config and plugins */      define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/private-content' );      define( 'WP_CONTENT_URL', 'http://mysite.com/private-content');      define( 'WP_PLUGIN_DIR', $_SERVER['DOCUMENT_ROOT'] . '/private-content/resources' );      define( 'WP_PLUGIN_URL', 'http://mysite.com/private-content/resources');      define( 'PLUGINDIR', $_SERVER['DOCUMENT_ROOT'] . '/private-content/resources' );      This is the image url path in network> settings>Sites>/>image upload path: private-content/uploads Suggestions on how I can fix this? Thanks.


Modified loop-single-forum.php to work inside of a sidebar Widget, not working on some site pages

So I took `loop-single-forum.php`, copied it and renamed it, fixed it so the site is calling the copy and then removed what I did not need from it to place it in a sidebar widget. It works beautifully on every screen on the site. Except for two and I can't figure out why. IF you're on the Topic's List Page the widget shows Nothing at all in the Categories Tab and then IF you're in an actual Topic it shows the **"Oh bother! No forums found"**. Looking to figure out what I could have left out in the code as I'm honestly using the existing code minus a few bits that I didn't need. `loop-single-forum.php` \-                   <?php                  /**             * Forums Loop - Single Forum             *             * @package bbPress             * @subpackage Theme             */              ?>              <tr id="bbp-forum-<?php bbp_forum_id(); ?>" <?php bbp_forum_class(); ?>>                                        <?php do_action( 'bbp_theme_before_forum_title' ); ?>                      <a class="bbp-forum-title" href="<?php bbp_forum_permalink(); ?>" title="<?php bbp_forum_title(); ?>"><?php bbp_forum_title(); ?>                      <?php do_action( 'bbp_theme_after_forum_title' ); ?>


How do you change the visual editor's background color?

I have a Wordpress site in which the background color is black and the text is white. The site is fine, but it's a pain trying to edit content in the visual editor as the background is white (same color as the text). I end up having to tell users to use the HTML view or write up the content in black color text and then at the end just select all the text and flip it to white (in which case many of them freak out and think their text is now deleted!) **How do I change the background color of the editor to black (or any other color) so that the content can be readable if the text color is to be white?**


How to print the excuted sql right after its execution

I am searching for a way by which i can print the executed sql query just after the :               $wpdb->query(                     $wpdb->prepare("INSERT                                      INTO tbl_watchprosite SET                                      keywords=%s,url_to_post=%s,description=%s,                                     date_captured=%s,crawl_id=%d,                                     image_main=%s,images=%s,brand=%s,                                     series=%s,model=%s,condition=%s,box=%s,                                     papers=%s,year=%s,case_size=%s,status=%s,listed=%s,                                     asking_price=%s,retail_price=%s,payment_info=%s,forum_id=%d",                                     $this->getForumSettings()->search_meta,$element->href,$post_meta['description'],current_time('mysql'),$cid,$post_meta['image_main'],$images,$post_meta[0],$post_meta[1],$post_meta[2],$post_meta[3],$post_meta[4],$post_meta[5],$post_meta[6],$post_meta[7],$status,$post_meta[9],$post_meta[10],$post_meta[11],$this->getForumSettings()->ID)                 );      This would be great if i can see what values are going in the query. Thanks


Default Paypal Support in Custom Product of Easy Digital Download

I created the product as purchasing different discount code with different denominations as `$5 or $10 or $100 . . .` I did these with my own supporting gateway as paypal. But I want to use the default gateway of paypal which is already in easy digital download. I am not sure how to do this in easy digital download. Right now i am using the shortcode to display the product.Reason I am taught about is I am creating the paypal integration to the custom product but in easy digital download which is already there, so that's the reason i try to integrate into the custom product. Any suggestion would be great. Thanks, vicky


Limit amount of results returned

How can I limit the amount of results returned?               $images = $wpdb->get_col("         SELECT ID FROM $wpdb->posts         WHERE post_type = 'attachment'         AND ID in ($meta)         ORDER BY menu_order ASC     ");


Turn Off Auto Update for Single Plugin

I have a plugin that I know I never want to update. I am aware that this is NOT best practice, but in this case it must be done. Is there any way to stop WordPress from prompting me to auto-update a particular plugin (but still alert as normal for all other plugins).


Default category got deleted. How to get it back as ID=1?

I have a plugin that expects there to be a default "uncategorized" category with ID=1. I've inadvertantly deleted the uncategorized category. Is it possible to recreate the category as ID=1? When I look at a default WP install, I see that the table "wp_terms" has uncategorized as the first record with id 1. It also appears that the "wp_term_relationships" and "wp_term_taxonomy" tables are in play in this regard. How would one go about recreating this category?


Read more link isn't working with custom query

Trying to show the latest post with a `featured` tag. The query is working fine but it always shows all the content.. not the content before the more link which is all I want. Here is my code.               $query = new WP_Query('numberposts=1&orderby=date&tag=featured');          // The loop!     if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>

By <?php the_author(); ?> on <?php the_time('j F Y') ?>

<a href="<?php the_permalink() ?>#comments" rel="bookmark" title="Link to <?php the_title_attribute(); ?>"><?php comments_number( 'Remove' ); ?>

         <?php the_content('Read More'); ?>
               <?php endwhile; else: ?>
Sorry, no posts are featured.
          <?php endif; ?>      In the editor I definitely have the `<!--more-->` link but it always shows ALL the content. What am I doing wrong?


Is this a job for WP MultiSite with domain mapping plugin?

I'm helping some folks convert an apartment management company's website from a custom CMS to Wordpress. We're pretty far along in the process and I just need to figure out how to get this request to work. Let's say that the company's main url is www.apartments.com and each of the 15 properties has a detail page like:   * www.apartments.com/property/oak-court   * www.apartments.com/property/pine-grove and so on. These use a custom post type called Property They also own domains for each property like:   * www.oakcourtapartments.com   * www.pinegroveapartments.com They want these domains to go an "apartment microsite" which is just a single page that looks like the detail page on the main site but with some caveats:   * This is NOT just redirecting the user. The url is to remain oakcourtapartments.com etc.   * The body copy, title tag and meta tags should be different from the page on the main site so it isn't an SEO conflict.   * Editing both detail and micro should be done in the same place. If the editor updated the hero image for Oak Court the change is reflected on both the detail page and the microsite on the front end. I have custom fields on the Property post type like "microsite body", "microsite title" and also the various meta tabs so the editors can work as needed. Would MultiSite help me here? How about the domain mapping plugin. I'm just not really sure how to tie everything together to make it work... if it even can work.


Adding more onto an esc_url

I have an esc_url that creates a link to buddypress profiles depending on the author of the post which returns like this http://www.mywebsite.com/members/username/ I want to make it so it returns "posts" at the end of the url too like so, http://www.mywebsite.com/members/username/posts The code I have.               esc_url( bp_core_get_userlink( get_the_author_meta( 'ID' ), $no_anchor = false, $just_link = true )),      I tried placing the following               && 'posts'     || 'posts'      after the               bp_core_get_userlink( get_the_author_meta( 'ID' )      and other parts of the code line but my PHP isn't great so I'm not sure exactly how && and || works. Worth a try though. Thanks for the help in advance :)


How to hook watchdog script for existence of a WP page?

I would like to have a watchdog script which checks the (un)availability of a certain DB entry, namely a certain WP page. The script itself is absolutely independent from WP and not difficult, but I don't know how where I hook this script into WP. It should be called with every website visit.


Database solutions for a commenting plugin?

(I'm new to this and am aware that my questions are vague and kind of suck, please bear with me.) My plugin, a commenting platform, is in the directory. Currently, it doesn't have it's own database. Can anyone offer some insight into how they may implement their own, customized database? Any examples, articles, opinions welcome :)


Should I delete automatically-created files before installing WordPress?

I'm switching a site from OpenCart to WooCommerce. I'm trying to figure out what I should delete from `public_html` and what I shouldn't. Below are the files I'm unsure about. Some of them were there before I installed OpenCart (years ago), but I can't tell which ones. Is it ok to delete all of them or should I keep some?               400.shtml     401.shtml     403.shtml     404.shtml     500.shtml     500.php     cgi-bin (empty folder)     default.html (empty)     error-log     php.ini


Disable new WP3.5 Media Picker

I've got a compatibility issue with the new media picker in WP 3.5 and a plugin I have to use. Until the plugin is updated with a patch, I'd like to simply disable the new media picker, and fall back to the old-school one that was before WP 3.5. Is this possible setting a constant, or using a filter somehow?


How to display some selected user meta data on a specific page with a shortcode?

I need to display on some specific pages some selected user meta data (not all), for some users. On the Wordpress Codex page for the `get_user_meta()` function we have this example (user_id = 9):               <?php       $all_meta_for_user = get_user_meta( 9 );       print_r( $all_meta_for_user );     ?>      The results of this example:               Array ( [first_name] => Array ( [0] => Tom ) [last_name] => Array ( [0] => Auger) [nickname] => Array ( [0] => tomauger ) [description] => etc.... )      And a **Note** (shortened): > ... you may want to run a simple array_map() on the results of > get_user_meta() in order to take only the first index of each result (this > emulating what the $single argument does when $key is provided:               if( $all_meta_for_user = get_user_meta( $user_id ) )          $all_meta_for_user = array_map( function( $a ){ return $a[0]; }, get_user_meta( $user_id ) );            print_r( $all_meta_for_user );      The result:               Array ( [first_name] => Tom [last_name] => Auger [nickname] => tomauger [description] => etc.... )      **My question is:** How to put this in a function that will display, for example, the user last and first names with a shortcode (but really I need more user meta data)? What I mean? On a specific page we put a shortcode with the user ID and the related function must return the meta data for each selected key of this user. Is this possible? Can anyone help me?


Check if user is in a group of another site within multisite network

I'm using Woocommerce + the groups plugin on my main site to promote users to a 'Premium' group upon purchasing items which works great. If a user on the main site then browses to the second site within my network, I can no longer check to see if they're within the 'Premium' group. On my main site, I can use this code:               <?php          $user_id = get_current_user_id();         $group = Groups_Group::read_by_name( 'Premium' );         if ( Groups_User_Group::read( $user_id, $group->group_id ) ) {      ?>              Premium content here!          <?php } ?>      But this does not work on the subsite. Is there anyway I can check to see if the user is in a group on my main site FROM a subsite?


Problem with wp_update_post

I'm trying to write a plugin that creates a page if a box is checked (value 1) and if the post id doesn't already exist. If the post id does already exist, then I want to update the post with whatever changes have been made. I have the creating post (as page) part working just fine. However, when I try to do run the wp_update_post I get this error: **array_merge() [function.array-merge]: Argument #1 is not an array in /home/wpovernight/wpovernight.com/wp-includes/post.php on line 2996** Since the error is concerning post.php, I'm guessing this issue is with array on wp_update_post, but I'm not sure what I'm doing wrong. It all looks fine to me. Here's my code:               //Check if page exists     $page_check_404 = get_page_by_title($page_title_404);     // Checks if box is checked     if ($activate_404_page == 1) {                 $ss_404_page = array(                 'post_title'    => $page_title_404,                 'post_content'  => $ss_404_page_content,                 'post_status'   => 'publish',                 'post_author'   => 1,                 'post_type'     => 'page'                 );                 // If page doesn't exist, create it                 if(!isset($page_check_404->ID)){                 $ss_404_post_id = wp_insert_post( $ss_404_page );                 }                 //if page does exist, edit it                 if(isset($page_check_404->ID)){                     $ss_404_page_update = array(                     'post_title'    => $page_title_404,                     'ID'            => $ss_404_post_id,                     'post_content'  => $ss_404_page_content,                     'post_status'   => 'publish',                     'post_author'   => 1,                     'post_type'     => 'page'                     );                 wp_update_post( $ss_404_page_update );                 }        }


How to Run Code Before a New Site is Created on MultiSite for Validation

I'd like to run some custom validation code on attempts to create new sites on my MultiSite environment, particularly the /wp-admin/network/site-new.php page. I've explored site-new.php, and have found zero instances of do_action() and the only filter is for subdirectory_reserved_names. I imagine I could write some overly general code that runs on something like every admin_init, check to see if this is the site-new page, see if the $_POST['action'] is set and equals 'site-new', verify the nonce, etc... but that really doesn't seem like it could be the best / proper way. Any suggestions on how to add my own custom validation code before a new site is actually created? Note that the hook wpmu_validate_blog_signup is available for when users are using the public-facing signup form, so validation against THAT form is pretty straightforward. It appears, though, that there is no easy way to do similar validation for sites created from the Network dashboard.


Audio tags around Mp3 URL in content

I have an audio player than uses the following syntax to display its player: `[audio src="http://somedomain.com/wp-content/uploads/2013/01/songtitle.mp3"]` The thing is, I'm pretty sure I can show the user how to copy the url and paste it in the post, but how can I search the content for a `.mp3` link and then put `[audio src="` in front of it and `"]` at the end of it?