Get value of a key from a Plugin Serialized array

I want to get details about a plugin hosted on WordPress.org Repository by making a call to API at http://api.wordpress.org/plugins/info/1.0/ I have pasted below the code I used and the output. I am not good with PHP and just wanted to know the way to retrieve and output just one piece of information from the array such as Download count.               $payload = array(       'action' => 'plugin_information',       'request' => serialize(         (object)array(             'slug' => 'i-recommend-this',             'fields' => array(                 'downloaded' => true,                 'description' => false                      )          )        )     );     $body = wp_remote_post( 'http://api.wordpress.org/plugins/info/1.0/', array( 'body' => $payload) );          var_dump( unserialize($body['body']) );      This outputs data in below way:               object(stdClass)[320]       public 'name' => string 'I Recommend This' (length=16)       public 'slug' => string 'i-recommend-this' (length=16)       public 'version' => string '2.4.2' (length=5)       public 'author' => string 'Harish Chouhan' (length=57)       public 'author_profile' => string 'http://profiles.wordpress.org/hchouhan' (length=38)       public 'contributors' =>          array           'hchouhan' => string 'http://profiles.wordpress.org/hchouhan' (length=38)           'dreamsonline' => string 'http://profiles.wordpress.org/dreamsonline' (length=42)           'dreamsmedia' => string 'http://profiles.wordpress.org/dreamsmedia' (length=41)           'Benoit "LeBen" Burgener' => string '' (length=0)       public 'requires' => string '3.3' (length=3)       public 'tested' => string '3.5.2' (length=5)       public 'compatibility' =>          array           '3.6' =>              array               '2.4.0' =>                  array                   ...               '2.4.2' =>                  array                   ...       public 'rating' => float 92.4       public 'num_ratings' => int 13       public 'downloaded' => int 7673       public 'last_updated' => string '2013-08-25' (length=10)       public 'added' => string '2012-04-25' (length=10)       public 'homepage' => string 'http://www.harishchouhan.com/personal-projects/i-recommend-this/' (length=64)       public 'sections' =>          array       'description' => string '
This plugin allows your visitors to simply like/recommend your posts instead of comment on it.

This plugin includes

A counter to display the number of "like" and to vote.

A widget and a function to display the X most liked posts.

A preference pane with some options.

Saves Cookie as well as users IP address to disable voting on the same post again

Advanced Options

Hide count if count is zero

Set a default messages w'... (length=1694)           'installation' => string '

Upload the directory /i-recommend-this/ to the /wp-content/plugins/ directory

Activate the plugin through the 'Plugins' menu in WordPress

Click on the Settings link below the plugin name on the plugins page

To display the recomment/like link other than at the bottom of individual post, you would have to add below code in your template

<?php if( function_exists('dot_irecommendthis') ) dot_irecommendthis(); ?&#62'... (length=586)           'changelog' => string '
= 2.4.2     * Bug fix. Thanks to @mmaxim

= 2.4.1     * Fixed undefined index error.

= 2.4.0     * Added filter dot_irt_before_count to be able to allow custom content or icons before the count.

= 2.3.0     * Added option to hide count if count is zero     * Added option to disable saving of IP address in the database

= 2.2.0     * Added option to customize the link title. You can now remove the word recomment and add anything you like. Ideas suggested by Krystina Montemurro.

= 2.1.5     * Sup'... (length=2216)           'faq' => string '
Take a look at the official "I Recommend This" FAQ.

You can also visit the support center and start a discussion if needed.
' (length=294)       public 'download_link' => string 'http://downloads.wordpress.org/plugin/i-recommend-this.2.4.2.zip' (length=64)       public 'tags' =>          array           'dribbble-like' => string 'dribbble like' (length=13)           'heart' => string 'heart' (length=5)           'like' => string 'Like' (length=4)           'love' => string 'love' (length=4)           'post' => string 'Post' (length=4)           'rate' => string 'rate' (length=4)           'rating' => string 'rating' (length=6)           'recommend' => string 'recommend' (length=9)


Listing registered scripts

Back story : We have a number of wordpress web sites experiencing issues when viewed on _some_ IE8 browsers. The errors include the page loading but not being displayed (either a blank screen is displayed or the previous page isn't cleared), we think it's down to IE8 and Javascript but want to test that by deregistering each script until 1) it works or 2) we run out of scripts to deregister. So to the questron : is their an API call that will list the handle of every front end registered script? I have a back-up of the site's including themes and plugings so I could grep them but I may well miss something and, being lazy, I was hoping I could get wordpress to generate the list for me.


How do I set a custom WordPress update repository?

I'm co-authoring a white paper on utilising WordPress as a foundation for a web-app, I would like to change the repository that the core WordPress updates from, the latest additions of automatic updates in 3.7 are very nice, but how would I go about pointing some installations at a custom server repository of mine? I understand the principals behind custom plugin and theme repositories, but updating the core is a necessity. I think that it queries api.wordpress.org, but what about the server-side code? Is this available anywhere? If this isn't possible, how would I go about having my WordPress core fetch updates through another manner? Using git/SVN on these other installs won't be an option unfortunately and neither will deploying to them directly, it needs to be via the internal WordPress protocols as this whole paper is about showing that WordPress is a very solid foundation to build upon. I guess you could consider this a custom fork of WordPress aimed at office usage. Thanks in advance, Hamual


Gravity Forms Salesforce field mapping for custom objects

I'm using the Gravity Forms plugin on my site, along with the Gravity Forms Salesforce plugin, which connects the forms to Salesforce. I can set a dropdown box to populate with choices from Salesforce, but I don't see how to let it use custom objects. Does anyone know how to do that?


Active menu also for single array

For our (new) website I figured out how to make menu's active. The only problem is that I want multiple pages, singles and categories under one active menu (just to remind people in what section they are). How do I get this working? Example: Below the menu gets the status 'active' when viewing the category- app-functies.php.
                        <li<?php if ( is_category('app-functies')) { echo ' class="current"'; } elseif ( is_singular( 'augmented-reality' )) { echo ' class="current"'; } ?>><a href="<?php echo site_url(); ?>/app-functies/">App Functies

      Also when viewing url.com/app-functies/X/ I like to make the menu active aswell. Is this possible?


using wp_update_post for updating custom post type

I'm trying to update post_parent of wp_posts in WordPress database. I've created a custom post type with capability_type = post , but I want it to behave like a page: hierarchical, allowing parent to be specified. Since I'll have a lot of entries, I couldn't set my custom post type as **hierarchical**. So I decided to update manually my custom post type **post_parent** entry. **From the codex :** > Note for hierarchical: this parameter was planned for Pages. Be careful, > when choosing it for your custom post type - if you are planning to have > many entries (say - over 100), you will run into memory issue. With this > parameter set to true WordPress will fetch all entries of that particular > post type, together with all meta data, on each administration page load for > your post type. Here is my code: I tried `$wpdb->update`, but no success               if( get_field('_page_parent') )     {         $infos_page = get_field('_page_parent');              $parent_id = $infos_page[0];              // $wpdb->update( $table, $data, $where, $format = null, $where_format = null );               //$wpdb->prepare("UPDATE $wpdb->posts SET post_parent = %d WHERE ID = %d", $parent_id, $child_id);               $my_post_infos = array(               'ID'          => $child_id,               'post_parent' => $parent_id           );                // unhook this function so it doesn't loop infinitely             remove_action('save_post', 'set_dossier_parent');                  // update the post, which calls save_post again             wp_update_post( $my_post_infos );                  // re-hook this function             add_action('save_post', 'set_dossier_parent');          }      Any help would be greatly appreciated.


Wp Nav Menu div containers

Hi I'm wanting to create a custom navigation menu that will require creating div containers to hold the SUB-MENU set. In other words I want to do this:

             Kurumsal

Hakkımızda

Misyon Vizyon

Satın Alma

Kariye

Bayilik Başvurusu

             Ürünlerimiz

İnce Taneli Kumlar

İri Taneli Kumlar

Yalıtım Malzemeleri

Yapı Kimyasalları

      How would I go about adding this into the wp_nav_menu function? Do I add a filter in functions.php, or do I create a separate PHP file to do this? Any helpful suggestions would be greatly appreciated.


Show Custom Post Type Results

Hopefully someone can help me here. I have a custom post type and with this post type I am able to show the title in a select option. Now what I want to happen is when that title is selected it will show the rest of the content in a results div. I am actually able to achieve this but it does not show one result at a time, it will instead show multiple instances of the same post type. Below is what I have so far:                //Create and Register Post type     function dh_productcomparison_post_type() {     $labels = array(          'name'               => _( 'Product Comparison' ),         'singular_name'      => _( 'Product Comparison' ),         'all_items'          => __( 'Product Comparison' ),         'view_item'          => __( 'View Products' ),         'parent_item_colon'  => 'Product Comparison:',         'menu_name'          => 'Product Comparison'     );     $args = array(          'labels'        => $labels,         'taxonomies' => array('category'),         'public'        => true,         'show_in_menu'  => 'edit.php?post_type=dh_products',         'supports'      => array( 'title', 'editor', 'thumbnail' ),         'has_archive'   => true,     );     register_post_type(__( 'dh_productcomparison' ), $args);      }     add_action( 'init', 'dh_productcomparison_post_type' );               // Post type shortcode to use on wp page.     function dh_productcomparison_shortcode( $atts ) {          // define attributes and their defaults     extract( shortcode_atts( array (         'type' => 'post',         'order' => 'date',         'orderby' => 'title',         'posts' => -1,         'category' => '',     ), $atts ) );          $args = array(         'post_type' => 'dh_productcomparison',         'orderby' => 'title',         'order' => 'ASC',         'posts_per_page'=> -1,         'category_name' => $category,     );     $productcomparison = new WP_Query( $args );     if( $productcomparison->have_posts() ):         $output .='<form action="" method="post" id="product-cmp">';         $output .='<select name="category" id="category">';         while ( $productcomparison->have_posts() ) : $productcomparison->the_post();                 $output .= '<option value="'.get_the_title().'">' . get_the_title() .'</option>';         endwhile;         $output .='</select>';         $output .='<input type="submit" name="submit" id="submit" class="submit" value="Search"/>';         $output .='</form>';         $output .= '
';         foreach ( $productcomparison as $result ) : setup_postdata( $result );                 $output .= get_the_title();         $output .= get_the_post_thumbnail( $productdisplay->post->ID, 'medium');         endforeach;          $output .= '
';          endif;     wp_reset_postdata();     return $output;     }     add_shortcode( 'productcomparison', 'dh_productcomparison_shortcode' );      UPDATE: I think I might have figured this out, but if someone sees a better way of doing this, please let me know. Basically I am just running the "while" loop again and in the "while" loop if the posted "posted" category is equal to the wp title, come back true.               while ( $productcomparison->have_posts() ) : $productcomparison->the_post();             if($_POST['category'] == get_the_title()){                     $output .= '
';                          $output .= get_the_title();             $output .= get_the_post_thumbnail( $productdisplay->post->ID, 'medium');                     $output .= '
';             }                     endwhile;


Theme Options: If There is No Input, Don't Display?

I have built a custom options panel which allows site owners to enter their social profiles. I then use the second code to make the links appear in the theme. **When no link is entered in the options panel, I would like there to be no link called on the page where the code is being called. Currently, it provides me with a link to the homepage of my site.** Take a look: http://themeforward.com/demo2/ \- the green box is the facebook link, the purple is the google link I know what you're thinking - why not just leave it the way it is? Because, I'm styling each link with a background image rather than using normal text links... so if I just leave it this way we will still have an image showing up advertising a social site presence, but it won't be linked. The styling can be found here: http://pastebin.com/m3PrBDae I think that may be affecting this. In my functions               array( "name" => "Facebook Page",         "desc" => "Enter your Facebook address. (Must include http://)",         "id" => $shortname."_facebook",         "type" => "text",         "std" => ""),          array( "name" => "Google Plus",         "desc" => "Enter your Google Plus address. (Must include http://)",         "id" => $shortname."_google_plus",         "type" => "text",         "std" => ""),      How I call them               <a href="<?php echo get_option('to_facebook'); ?>">     <a href="<?php echo get_option('to_google_plus'); ?>">


Help with enqueing scripts in footer after init action

In my functions.php, I have set a register_scripts() and load_scripts(), and hooked them to the 'init' action. I have registered all the scripts to be loaded in the footer, in order to optimize page load. Some of the scripts I've registered in register_scripts() are not enqueued in load_scripts() because I only want to load them when / if they are needed. So for example, if the page being rendered includes the template part 'gallery.php', which needs 'jquery-gallery', I would like to enqueue it from that file, but only after the rest of the footer scripts have been loaded. I also need to do this with inline scripts. Hope I explained myself well... If not please ask.


Styling last item in ul

I'm looking to format the bullets for the last item of the list. I'm using Firebug to pinpoint where the menu item is and I have two options in front of me: Screenshot 1 Screenshot 2 - Includes bullet Now I'm looking at either using CSS or jQuery to select the last item. I tried using this CSS and it applies to the last TWO items.               ul.children li:last-child{      color: red;      list-style-type: circle;     }      Screenshot 3 - Output I'm thinking maybe I need to use jQuery but I haven't had luck with that either. * * * Here is my custom walker that displays $output:               $output .= $indent .      '

ID) . '" title="' .      esc_attr( wp_strip_all_tags( apply_filters( 'the_title', $page->post_title,      $page->ID ) ) ) . '">' .      $link_before . apply_filters( 'the_title', $page->post_title, $page->ID ) .      $link_after . '' . $MetaOutput . '
';      I'm going to make a conditional that asks if $MetaOutput's children = 0 , apply this style. I am going to try and make a class for the * at the beginning. Ideally, I'd like to replace the list-style-image for each li class. I'll edit this again and let you know how it goes.


Need help changing back the correct wordpress url

Hello I've just recently installed wordpress today on a development linux server. Everything seemed ok until when I stupidly changed the wordpress url. Initailly it was just http://localhost/ but I changed that to http://localhost/wordpress in the settings area. Now I cannot seem to login again, because everytime I login, it takes me to a page 404 error. So is there another way to change the wordpress url?


Vimeo Froogaloop API, working in Fiddle but not WP

I'm trying to harness Vimeo's Froogaloop API to pause video embeds whenever a user clicks a certain element. I have it working perfectly in my Fiddle but it wont work in my Wordpress environment. I took some code from this thread to create a simplified version of the site I'm working on; **HTML**

          Pause      **jQuery**               function pauseAll() {     $('iframe[src*="vimeo.com"]').each(function () {         $f(this).api('pause');     });     }      As I say, it works perfectly in my Fiddle but not in my WP based site It also seems to just be Google Chrome where it doesn't work in WP which is making me scratch my head even more. If anyone has any ideas it would be a great help.


Redirect old permalinks to new permalinks

I changed the permalink structure from `/%category%/%postname%/` to `/%year%/%monthnum%/%postname%//` How can I redirect all old posts to the new ones (eg: via htaccess)?


How to display the names of users from a specific group with a shortcode?

I have in the database a table with the `user_id` and corresponding `group_id` values, so each row contain the ID of the user that is a member of a group and the related group ID. **The question is** : How to display the names of users from a specific group, plus some metadata, with a shortcode, for example `[group_members group_id=1]`? With the bellow function, that I try to adapt for this without success, I can to display only the user ID or the group ID.               add_shortcode( 'group_members',  'group_members_shortcode_handler' );          function group_members_shortcode_handler ( $atts, $content = null ) {                global $wpdb;       $querystr = "SELECT * FROM wp_groups_user_group";       $users = $wpdb->get_results($querystr, OBJECT);            foreach ($users as $user) {         $output .= $user->group_id;       }           return $output;     }


Search Page Returns Nothing

I'm currently working on this website and a test shows that the search page isn't working properly. Every time someone searches for something, it comes up blank. The code for the search page is as shown below. **Search Form:**               <form role="search" method="get" id="searchform" action="/search/" >
Search for:         <input type="text" value="" name="s" id="s" />         <input type="image" src="<?php bloginfo('stylesheet_directory'); ?>/images/searcher1.png"id="searchsubmit" value="Search" />
         </form>       **Search Page:**               <?php         if ( isset( $_REQUEST[ 'search' ] ) ) {             // run search query             query_posts( array(                 's' => $_REQUEST[ 'search' ],                 'post_type' => $_REQUEST[ 'post_type' ],                  ) );                  // loop             if ( have_posts() ) : while ( have_posts() ) :                 // loop through results here             endwhile; endif;                  // return to original query             wp_reset_query();         }


delete post meta from db, even if does not exist?

it is not the first i see that we "delete" a post meta even if it does not exist : example :                   $count = get_post_meta($postID, $count_key, true);         if($count==''){             $count = 0;             delete_post_meta($postID, $count_key);             add_post_meta($postID, $count_key, '0');      So if $count is empty, so if it does not exist in the database, we first delete the post meta? Why ? Thanks for your answer


If searched in a category show different 404 page

Is this possible? I have a `searchform` that searches for certain categories. If there is no post, it will show me a `404 page`... Can I change this page to something else? If so, how do I do that?


Change Wordpress comments url / word

Is this possible? For example, I want to change               http://mysitesitesite.com/post-name/comment-page-1/#comment-452      to               http://mysitesitesite.com/post-name/custonname-1/#customname-452      What should I do to get it working? Is there any chance to fix this?


wp_enqueue doesn't load dependencies

I'm trying to load style.css but rest.css should be included first. I don't understand why reset.css is not included               function addMyScript() {         wp_register_style('style', get_template_directory_uri().'/style.css');         wp_register_style('reset', get_template_directory_uri().'/reset.css');         wp_enqueue_style('style', get_template_directory_uri().'/style.css', array( 'reset' ),  );     }     add_action('wp_head', 'addMyScript');      Also I've seen on some blogs that people often don't register the stylesheet or javascript before to enqueue... is that ok?


What table is the media's sort order stored?

I see that your can sort media by a numbered order in the media gallery for a post. But what table is this order stored in? I want to use this order to also order the images the same way in my posts.


jQuery is not defined

jQuery is not defined      When I try to edit a post, rearange categories the "jQuery is not defined" keeps poping up in firebug. But If I change my theme to another it allows me to change the categories and stuff like that. I checked my functions.php there is no line about jquery...


Preset Widgets ONLY after site is initially created

I want to preset some widgets using functions included in my theme ONLY after a site is initially created (my theme is the default for all new sites in my instance of WordPress). I DO NOT want my preset widgets to replace existing widgets when a user activates my theme UNLESS their existing widget areas are different from those in my theme. I've modelled my widgets_init function on the one found in the Thematic theme framework. Thematic adds preset widgets using the following conditional:               if ( isset( $_GET['activated'] ) )      Thus when Thematic is activated, it wipes out existing widgets and adds its own preset widgets... I want my theme to use existing widgets if they are in widget areas my theme supports (i.e. a user switches from one child theme to another, both of which use my theme as their parent) I know there is register_activation_hook but that seems to be designed for plugin functions and not functions included in themes... Here are questions:   1. Is there an action that is run ONLY after a site has been initially created?    2. Alternatively are their conditions I can check to determine whether a site has just been created?


How to import database table as custom post type and custom fields?

I have a sql table that contains vehicle information. When I import the database table to my WordPress website, I need the information to be imported as custom fields for a custom post type. For example, I created the vehicle custom post type and the custom fields:               add_action( 'init', 'create_post_type' );     function create_post_type() {         register_post_type( 'vehicle',             array(                 'labels' => array(                     'name' => __( 'Vehicles' ),                     'singular_name' => __( 'Vehicle' )                     ),                 'public' => true,                 'has_archive' => true,                 )             );      }          add_action("admin_init", "admin_init");          function admin_init() {         add_meta_box("vehicle_info-meta", "vehicle Information", "vehicle_info", "vehicle", "normal", "low");     }          function vehicle_info() {         global $post;         $custom = get_post_custom($post->ID);         $stockNumber = $custom["stockNumber"][0];         $vin = $custom["vin"][0];         $make = $custom["make"][0];         ?>
Stock Number:         <input name="stockNumber" value="<?php echo $stockNumber; ?>" />

Vin Number:         <input name="vin" value="<?php echo $vin; ?>" />

Make         <input name="make" value="<?php echo $make; ?>" />
         <?php     }          add_action('save_post', 'save_details');          function save_details() {         global $post;              update_post_meta($post->ID, "stockNumber", $_POST["stockNumber"]);         update_post_meta($post->ID, "vin", $_POST["vin"]);         update_post_meta($post->ID, "make", $_POST["make"]);     }      Now that the custom post type is created, when I import my database table, I need a new vehicle post to be created for each vehicle in the database table. I also need the custom fields for each vehicle to be populated.


How would I use this filter to change the output of the date format to "Twitter time"?

I'm using a plugin called Latest Tweet Widget to display the latest tweet. The tweet date gets displayed by the month and day (Mar 22). However, I want it to be in "Twitter time" meaning words like "3 days ago, 1 hour ago, etc.". I asked the developer of the plugin at the WordPress forums and he said that I need to "use the `latest_tweets_render_date` filter to perform my own relative date representation." The filter in question is here under the "Custom HTML" section (also quoted below): https://wordpress.org/plugins/latest-tweets- widget/other_notes/#Theming               add_filter('latest_tweets_render_date', function( $created_at ){         $date = DateTime::createFromFormat('D M d H:i:s O Y', $created_at );         return $date->format('d M h:ia'); }, 10 , 1 );      However, I am new to PHP and unable to understand what exactly needs to be written in order for "Twitter time" to work. Can somebody please show me the way?


Can't order the query result as given posts id's array

I want to order a query result by the same order as the post id's array given. E.g. I have:               $arrayPostsIds = array(30,5,17,10);      and I want to get the posts in that order. So after trying this:               add_filter('posts_orderby', 'edit_posts_orderby');          function edit_posts_join_paged($join_paged_statement) {         global $arrayPostsIds_id;         $join_paged_statement = 'FIELD(ID,'.implode(',',$arrayPostsIds).')';         return $join_paged_statement;        }      and then I get the new result, which should match the above order:               $temp = $wp_query; // assign ordinal query to temp variable for later use       $wp_query = null;     $wp_query = new WP_Query( array( 'post__in' => $arrayPostsIds, 'ignore_sticky_posts' => true, 'date_query' => $date_query ) );       but I'm getting the result **ordered by ID** , so it's not keeping the desired order. Am I forgetting anything?


Excluding posts from a category but only if they're not in multiple categories

I am looking to exclude a category in Wordpress. I am referring to the Wordpress Codex page on `wp_query` but I am having the following problem:   1. I want to exclude posts from category 1,   2. but if a post is in category 1 and category 2 (or any other category other than 1), then I still want it to show. So, I only want posts to be excluded if they're exclusively in category 1.


Hierarchy in multisite

I'm looking into building a multi site (sort of like blog portal) but with a hierarchy. So there's a mother organization (with own content) with different "chapters" (say 10, each with own content) and then each chapter have "bloggers". So on a blog it should read "Part of chapter X" and a list of other bloggers in the same chapter. So I need a way to group the bloggers and put them in a hierarchy. I'm not sure about the URL structure but some bloggers will have own top domains but most will have subdomains (WordPress MU Domain Mapping will help with this). I'm looking for some thoughts about how this could be solved, as well as tips on plugins. I found Network Sites Hierarchy: http://wordpress.org/extend/plugins/wpmswpmu- network-sites-hierarchy/ which looks promising but has very little activity. Also WP Multi Network http://wordpress.org/extend/plugins/wp-multi-network/ seems to be of help. Any help before I jump into the "install and test a bunch of plugins"-phase is highly appreciated. Thanks! Dennis


Speed optimization of $wpdb->get_results

I'm using this code to generate all my custom field values from all posts for custom field named "autor".               <?php $autor = $wpdb->get_results("SELECT meta_value AS autor FROM wp_posts, wp_postmeta WHERE post_status = 'publish' AND meta_key = 'autor' GROUP BY meta_value ORDER BY meta_value") ?>
     <?php foreach( $autor as $autori ) : ?>

<a href="http://simplynote.me/?s=<?php echo $autori->autor ?>"><?php echo $autori->autor ?>

     <?php endforeach ?>
      It works okey, but the problem is that it takes a couple of seconds more (like, the page is loading for 5-10 seconds) for server to load that particular page. Is there any way to optimize this request?


How to stop fatal error when loading theme template file directly

If one tries to load a theme template file directly, the following error message is displayed:               Fatal error: Call to undefined function get_header() in ...      and it goes on to list the full directory path to the wordpress install. This seems undesirable. How can I prevent it? Upon googling I found a suggestion to insert the following into wp-config.php:               error_reporting(0);     @ini_set(‘display_errors’, 0);      Oddly, it did not work when I tested it. Thank you!


Permalink changes gives me 404

Up til now, I've used `/%postname%/`. Now I have changed this to `/%category%/%postname%/`. I know WP does not recommended to use category / psotname, but it makes a lot more sense for users. Opening pages and posts work fine. What crashes are all my jQuery calls to jQuery.php file. The data is actually returned, but when trying to output the data, I get a 404 error. Data process:               **Fetch data**       Ajax request -> jQuery.php -> some.class.php -> database          **Return data**       database -> some.class.php -> json_encode($result) -> 404 error      Does anyone know how I can fix this problem? Do I have to change my `.htaccess` file? **Update** This is the .htaccess file               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      Error message: > "NetworkError: 404 Not Found - http://mysite.com/wp- > content/themes/mysite/include/jquery.php?instance=search&limit=25&term=ac" Respons tab in Firebug shows this:               [{"id":"221","value":"Acne","url_name":"Acne"},{"id":"7176","value":"Acne Jeans","url_name":"Acne+Jeans"}]      In this case I'm expecting a autosuggest answer. If I paste this URL directly in browser, I get the result on the screen, but i **also** get a 404 error message. This is a typical jQuery request:                     jQuery.ajax({             url: siteURL +"/wp-content/themes/mysite/include/jquery.php",             data: {               instance: 'addPerson',               name: 'Jon Doe',               age: '26'             },             dataType: 'json',             success: (function(data) {               showFeedback(data);             })           });


Wordpress stripping out BR tags, need assistance

Im having a problem where WP for some odd reason is stripping out my BR tags. Ive looked online and have read a few solutions that people offered including the installation of TinyMCE advanced plugin and still....the same thing. The problem is that not matter what i do, even if i go to the html tab and manually insert a br tag, it isn't creating **any** space between content. The code im testing now is this below: The code that has this looks like this               this is sentence one
     this is sentence two

     this is sentence three       this is sentence four         which should appear like so               this is sentence one          this is sentence two               this is sentence three                this is sentence four       but when seen on WP front end, it shows like a long sentence. here is the link: http://tightlineinternetmarketing.com/mike- dev/thp2/?page_id=1930 Also on that page, whilst testing, you will see that the same code i put on that post, i hard coded it onto the page.php just to test. and the hard coded part appears as it should whilst the same code but generated from WP does not appear as it should. its driving me nuts. I even installed another version of WP on my local wamp environment and still the same problem. I've also tested code on W3C validator(s) (html/css) and no real errors (except 3 from the nav menu which are minor). Any help is GREATLY appreciated. EDIT* _*_ this is the post loop im using               <?php     if (have_posts()) : while (have_posts()) : the_post(); ?>

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

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

     <?php endwhile; endif; wp_reset_postdata(); rewind_posts(); wp_reset_query();   ?>


Receive error exception using xampp with wordpress

I have this php function in xampp server using php 5.5, using a live server with php 5.3 I get no error. The error says > Fatal error: Uncaught exception 'Exception' with message 'String could not > be parsed as XML' in C:\xampp\htdocs\wordpresstest\wp- > content\plugins\Monetizer_Pro_Monetizer\Monetizer.php:910   >  Stack trace:   >  #0 C:\xampp\htdocs\wordpresstest\wp- > content\plugins\Monetizer_Pro_Monetizer\Monetizer.php(910): > SimpleXMLElement->__construct('')   >  #1 [internal function]: Monetizer->Commission_Junction(Array, '', > 'Commission Junc...')   >  #2 C:\xampp\htdocs\wordpresstest\wp-includes\shortcodes.php(273): > call_user_func(Array, Array, '', 'Commission Junc...')   >  #3 [internal function]: do_shortcode_tag(Array)   >  #4 C:\xampp\htdocs\wordpresstest\wp-includes\shortcodes.php(188): > preg_replace_callback('/[([?)(embed|...', 'do_shortcode_ta...', '[Amazon > keyword...')   >  #5 [internal function]: do_shortcode('[Amazon keyword...')   >  #6 C:\xampp\htdocs\wordpresstest\wp-includes\plugin.php(199): > call_user_func_array('do_shortcode', Array)   >  #7 C:\xampp\htdocs\wordpresstest\wp-includes\post-template.php(166): > apply_filters('the_content', '[Amazon keyword...')   >  #8 C:\xampp in C:\xampp\htdocs\wordpresstest\wp- > content\plugins\Monetizer_Pro_Monetizer\Monetizer.php on line 910 The function is               public function Commission_Junction($atts) {                 extract( shortcode_atts( array(                     'keyword' => '',                     'results' => '',                     'context' => '',                 ), $atts ) );                      $params = shortcode_atts(array(                     'keyword' => '',                     'results' => '',                     'context' => '',                 ), $atts);                 if ($params['context'] !== 'yes') {                     $linkcloakeroptions = get_option('LinkCloaker_Settings');                     $linkcloakerpath = $linkcloakeroptions['Main_Path'];                     if (file_exists($_SERVER['DOCUMENT_ROOT'].$linkcloakerpath.'/Monetizer_Pro_LinkCloaker/LinkCloaker.php')) {                         $LinkCloaker = new LinkCloaker();                         $LinkCloakerexist = true;                         $arv = $LinkCloaker->getFirstAvailablePage();                         $linkpage = $arv[0];                         $folder = $arv[1];                          $linkpage = $LinkCloaker->createPage($linkpage, $folder);                     }                 }                 $contextuallinkoptions = get_option('ContextualLink_Settings');                 $contextuallinkpath = $contextuallinkoptions['Main_Path'];                 if (file_exists($_SERVER['DOCUMENT_ROOT'].$contextuallinkpath.'/Monetizer_Pro_ContextualLink/ContextualLink.php')) {                     $ContextualLink = new ContextualLink();                 }                 if ($params['context'] == "yes") {                     return $ContextualLink->start("Commission_Junction", $params['results']);                 }                 else {                     $options = get_option('Monetizer_Settings');                     $monetizerpath = $options['Main_Path'];                     $cloak = $options['Commission_Junction_Link_Check'];                     $cDevKey = $options['Commission_Junction_API_Key'];                     $nWebSiteID = $options['Commission_Junction_Site_ID'];                     $cURL = 'https://product-search.api.cj.com/v2/product-search?';                     $cURL .= 'website-id=' . $nWebSiteID;                     $cURL .= '&keywords=' . $params['keyword'];                     $cURL .= '&records-per-page=' . $params['results'];                     $cURL .= '&page-number=' . '1';                     $cURL .= '&advertiser-ids=' . $options['Commission_Junction_Advertiser_Relationship'] . '&';                     $cURL .= '&serviceable-area=' . $options['Commission_Junction_Country'];                     if ($options['Commission_Junction_Low_Price'] != '') {                         $cURL .= '&low-price=' . $options['Commission_Junction_Low_Price'];                     }                     if ($options['Commission_junction_High_price'] != '') {                        $cURL .= '&high-price=' . $options['Commission_junction_High_price'];                      }                          $ch = curl_init();                     curl_setopt($ch, CURLOPT_URL, $cURL);                     curl_setopt($ch, CURLOPT_HTTPHEADER, array(                                   'Authorization: ' . $cDevKey,                                   'User-Agent: "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.15) Gecko/2009101601 Firefox/3.0.15 GTB6 (.NET CLR 3.5.30729)"'                                 ));                          curl_setopt($ch, CURLOPT_HEADER, false);                     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                          curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);                     curl_setopt($ch, CURLOPT_TIMEOUT, 10);                          $response = curl_exec($ch);                     curl_close($ch);                           //$xml = simplexml_load_string($response);                     $xml = new SimpleXMLElement($response);                     if ($LinkCloakerexist) {                         $linknumber = 0;                     }                     foreach ($xml->products->product as $item) {                         echo $item;                     }                     if ($xml) {                         if (isset($options['Commission_Junction_Products_Display_Heading'])) {                             $product .= "
".$options['Commission_Junction_Products_Display_Heading']."

";                         }                         $template = $options['Commission_Junction_Post_Template'];                        foreach ($xml->products->product as $item) {                             if ($options['User_Level'] == 'basic') {                                 $this_row = '

%title%
%price% from %merchantname%
%description%

';                             }                             else if ($options['User_Level'] == 'advanced') {                                 $this_row = $template;                             }                                  $link  = $item->xpath('buy-url');                             $link  = (string)$link[0];                             if ($LinkCloakerexist && $cloak == true) {                                 $LinkCloaker = new LinkCloaker();                                 $arv = $LinkCloaker->createCloakedLink($link, $linknumber, $linkpage, $folder, false, $options['Commission_Junction_Auto_Generated']);  // link complete with your aff ID                                      $link = $arv[0];                                 $linknumber = $arv[1];                                 $linknumber++;                             }                             else {                                 $link = $link;                             }                                  $title = $item->xpath('name');                             $title = (string)$title[0];                                  $imgURL = $item->xpath('image-url');                             $imgURL = (string)$imgURL[0];                                  if ($imgURL == '') {                                 $imgURL = $_SERVER['DOCUMENT_ROOT'].$monetizerpath.'/Monetizer_Pro_Monetizer/images/noimage.png';                             }                             else {                                 $imgURL = $imgURL;                             }                                  $price = $item->xpath('price');                             $price = '$'.number_format((float)$price[0],2,'.',',');                                  $merchantname = $item->xpath('advertiser-name');                             $merchantname = (string)$merchantname[0];                                  $description = $item->xpath('description');                             $description = (string)$description[0];                                  $adid = $item->xpath('ad-id');                             $adid = (string)$adid[0];                                  $advertiserid = $item->xpath('advertiser-id');                             $advertiserid = (string)$advertiserid[0];                                  $advertisername = $item->xpath('advertiser-name');                             $advertisername = (string)$advertisername[0];                                  $advertisercategory = $item->xpath('advertiser-category');                             $advertisercategory = (string)$advertisercategory[0];                                  $catalogid = $item->xpath('catalog-id');                             $catalogid = (string)$catalogid[0];                                  $currency = $item->xpath('currency');                             $currency = (string)$currency[0];                                  $instock = $item->xpath('in-stock');                             $instock = (string)$instock[0];                                  $isbn = $item->xpath('isbn');                             $isbn = (string)$isbn[0];                                  $manufacturername = $item->xpath('manufacturer-name');                             $manufacturername = (string)$manufacturername[0];                                  $manufacturersku = $item->xpath('manufacturer-sku');                             $manufacturersku = (string)$manufacturersku[0];                                  $retailprice = $item->xpath('retail-price');                             $retailprice = (string)$retailprice[0];                                  $saleprice = $item->xpath('sale-price');                             $saleprice = (string)$saleprice[0];                                  $sku = $item->xpath('sku');                             $sku = (string)$sku[0];                                  $upc = $item->xpath('upc');                             $upc = (string)$upc[0];                             $replace_array = array(                                     '%link%' => $link,                                     '%title%' => $title,                                     '%imgURL%' => $imgURL,                                     '%price%' => $price,                                     '%merchantname%' => $merchantname,                                     '%description%' => $this->DescriptionLength($description),                                     '%adid%' => $adid,                                     '%advertiserid%' => $advertiserid,                                     '%advertisername%' => $advertisername,                                     '%advertisercategory%' => $advertisercategory,                                     '%catalogid%' => $catalogid,                                     '%currency%' => $currency,                                     '%instock%' => $instock,                                     '%isbn%' => $isbn,                                     '%manufacturername%' => $manufacturername,                                     '%manufacturersku%' => $manufacturersku,                                     '%retailprice%' => $retailprice,                                     '%saleprice%' => $saleprice,                                     '%sku%' => $sku,                                     '%upc%' => $upc,                                 );                                 foreach($replace_array as $search => $replace) {                                     $this_row = str_replace($search, $replace, $this_row);                                 }                                  if($link != "") {                                 $product .= $this_row;                             }                        }                              if ($product == '') {                          }                         if ($cloak == true) {                             $LinkCloaker->createCloakedLink($link, $linknumber, $linkpage, $folder, true, $options['Commission_Junction_Auto_Generated']);                         }                         return $product;                     }                 }             }      Why do I receive this error? And what do I do to fix it. Thanks.


contact form 7 :create shortcode usable in email message

i have this (test ) function that adds a redirection bouton                 function bouton($atts, $content = null) {          extract(shortcode_atts(array(                  'lien' => '#',                  'couleur' =>'bleu'                  ), $atts));          return '' . do_shortcode($content) . '';         }      this lines below allows the shortcode                     [bouton couleur="orange" lien="http://codex.wordpress.org/Shortcode_API"]L'API Shortcode WordPress[/bouton]      to work in contact form7 editor :                       function shortcodes_in_cf7( $form ) {             $form = do_shortcode( $form );             //place my short code below to work within contact form 7             add_shortcode('bouton', 'bouton');             return $form;         }         //line below to place ds form :         add_filter( 'wpcf7_form_elements', 'shortcodes_in_cf7' );      i have replaced this filters by                           //add_filter( ' wpcf7_mail_components', 'shortcodes_in_cf7' );         //add_filter( ' wpcf7_mail_tag_replaced', 'shortcodes_in_cf7' );         //add_filter( ' wpcf7_display_message', 'shortcodes_in_cf7' );      to try and make it working in the email message with no succes . What would be the filter to use?


Issues creating a tinyMCE plugin that creates a custom link

I'm working on a plugin that works similar to the "link" button on tinyMCE: The user highlights text -> presses a button -> enters text into a box in a thickbox popup -> submits the form -> the user is then returned to the editor with the highlighted text altered. The highlighted text has a generated url as a link and an added class. I've got the button in tinyMCE and when clicked the thickbox popup shows with my form. However, when submitted, nothing happens. The form submits but the window doesn't close and highlighted text isn't made into the link. I'm looking at wplink.js located in the folder "/wp-includes/js/wplink.js" as a rough basis but it doesn't seem to work. Any help is appreciated. Here is what I have thus far. Note: google.com is used as the test url for this example.               jQuery(document).ready(function($){              (function() {             tinymce.create('tinymce.plugins.addTC', {                      init : function(ed, url){                     ed.addButton('addTC', {                     title : 'Insert Product Link',                     cmd: 'addTC_Link',                     image: "/wp-content/plugins/addtc/img/shopping_basket.png",                     onclick: function() {                             tb_show( 'Insert Product Link', '/wp-content/plugins/addtc/addTC_link.php?&height=300&width=600&TB_iframe=true' );                         }                     });                     $('#addTC_link-submit').click(function(e){                         e.preventDefault();                         var selected_text = ed.selection.getContent();                         alert(selected_text);                         var return_text = '';                         var targetURL = "http://www.google.com";                         return_text = '' + selected_text + '';                         ed.execCommand('mceInsertContent', 0, return_text);                         tb_remove();                     });                 }             });                  tinymce.PluginManager.add('addTC', tinymce.plugins.addTC);              });          });


Get categories of queried posts

I queried posts from an array of IDs:               $args = array(         'post_type' => 'post',         'post__in' => $ids,         'orderby' => 'id',         'order' => 'DESC'     );      Now I want to display a form with checkboxes for the categories of these queried posts. For example if there are two posts from the category "Drama" I dont want the "Comedy"-Category-Checkbox to be displayed. The problem: As there is no post__in parameter for get_categories, I have no idea, how I can do this.               $catargs = array(         'post__in' => $ids,     );          $categories = get_categories(  $catargs  ); ?>


comment_date() & comment_time() not working from functions.php

I use the following function to get the latest comment for each one of my posts and display it on archive and index pages under the post content:               function kv_latest_comment($post){              $args = array(                 'status' => 'approve',                 'number' => '1',                 'post_id' => $post->ID, // use post_id, not post_ID                   );                 $comments = get_comments( $args );             if($comments){             foreach($comments as $comment) :             if($comment->comment_type != 'pingback' and $comment->comment_type != 'trackback') : ?>

<?php echo get_avatar($comment,$size='64'); ?>

                   <a href="<?php echo site_url().'/author/'.get_the_author_meta( 'user_login'); ?>" title=""><?php printf(__('%s'), get_the_author_meta( 'user_login')) ?> on <?php printf(__('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?><?php edit_comment_link(__('(Edit)'),'  ','') ?>

                   <?php echo($comment->comment_content); ?>

     <?php             endif;             endforeach; }     }      I call the function like so in my post template:               <?php kv_latest_comment($post); ?>      When calling the function from functions.php comment_date() and comment_time() return nothing. But if I paste the code from the function into the template it works as expected... Why don't the functions return any values when called from the functions.php?


Meta Box by Rilwis, Load metabox on all page templates EXCEPT the homepage

Using Rilwis' Meta Box plugin for custom metaboxes, is there a way that I can load a metabox on all page templates _except_ `template-home.php`?               'only_on' => array(         'template' => array( 'template-home.php' ),     ),      I tried adding `!` before it but it didn't work.


Adding content to a taxonomy metabox

I want to add some custom content to the default metabox for a custom taxonomy. Ideally I'd be able to insert this content above the tag cloud where it says **_Choose from the most used [tag]s_**. Is there a "best practice"-compliant way to do this in Wordpress? For example, is there a way to do this _without_ removing and re-adding a clone of the taxonomy metabox, which is the method I've seen recommended for similar situations on WPSE and elsewhere? That seems like a bit of a blunt approach in this case. I know I can insert the content with javascript, or use a separate metabox, but I'm wondering if there's a hook for this sort of task.


Plugin for wikipedia style references in WP?

I find inline links offputting to read so want to use wikipedia style foot-of- article references with incremental numeric linking to the external link reference. I can just stick the HTML in but on the off chance is there any plugins on WP for semi-automating the process?


Superfish and WordPress: Active Color Problem

Take a look at: http://www.themeforward.com/demo2. When I hover over a menu item with a sub-menu, like 'Templates', and mouse over sub-menu items the background color stays the same as it should... but the hover color of the text does not. How do I make the font color remain the same while scrolling through the sub- menu? I've Googled all over for this and can't find a solution. The Superfish site does not provide sample CSS for this issue and provides no answer on the matter. **I usually wouldn't post this as a question here since it is a CSS question, but I believe it may also be related to a WordPress' current category feature.** The background color is achieved with this CSS, but the font color is not behaving in the same manner:               .sf-menu > li:hover, .sf-menu > li.sfHover,     .sf-menu > li a:focus, .sf-menu > li a:hover, .sf-menu > li a:active {         background:     #CFDEFF;         color:          #222;         outline:        0;     }      Below you will find the entire CSS:               .sf-menu {         z-index: 900;         font-size:13px     }     .sf-menu a, .sf-menu a:visited  { /* visited pseudo selector so IE6 applies text colour*/         padding: 5px 10px;         color:          #FFF;         text-decoration:none     }     .sf-menu li {         margin:20px 0 0 20px;         z-index: 900     }     .sf-menu li li {         z-index: 900;         margin:0;         padding:0;         background:#DDD;     }     .sf-menu li li li {         background:     #DDD;         margin:0;         z-index: 900     }     .sf-menu > li:hover, .sf-menu > li.sfHover,     .sf-menu > li a:focus, .sf-menu > li a:hover, .sf-menu > li a:active {         background:     #CFDEFF;         color:          #222;         outline:        0;     }          .sf-menu .current-post-ancestor a, .sf-menu .current-menu parent a, .sf-menu .current-page-ancestor a, .sf-menf .current-category-ancestor a, .sf-menu .active_category a, .sf-menu .current-menu-item a { color:#000 }          ul .sub-menu { border:1px solid #DCDCDC }     ul li .sub-menu a { color:#666!important; font-weight:normal; font-size:11px; padding:5px!important }     .sf-menu > li li:hover, .sf-menu > li li.sfHover,     .sf-menu > li li a:focus, .sf-menu > li li a:hover, .sf-menu > li li a:active {         background: #EEE     }


Creating a website with EVENT post type and PAGES as subpages of those EVENTs

Basically what I want is to create an EVENT post type. So people can put in a date and time of the event. (I've got this far... this is fine). The bit that I can't seem to figure is now I want to be able to make pages as SUB PAGES of that meeting. I'm not really bothered how I do this to be honest, although I figured the easiest way would be to somehow extend the functionality of the standard wordpress pages to allow for EVENT posts to be their parents. Each event will have the same sub pages, so each one will have "Venue, Travel, Agenda" etc. Is there any way to do what I suggested, or perhaps a better way to get this functionality that I'm missing? Thank you.


Post author is changed to admin after his post is modified by admin

I am writing a plugin which will enable to write posts from front-end. Those posts have to be checked by admin before published. Now if admin edits the post or publishes the post, the post author is changed from the original author to admin. How can I prevent that?


How do I format the date in Event Organizer?

I would like to format the dates to be June 17, 2012 11:00am as opposed to the 17 June 2012 11:00am that Event Organizer outputs.


get post count for related author

I'm trying to use the code below to obtain the number of custom posts the author of a post has published.               function count_user_posts_by_type( $userid, $post_type = 'artistblog' ) {     global $wpdb;          $where = get_posts_by_author_sql( $post_type, true, $userid );          $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" );          return apply_filters( 'get_usernumposts', $count, $userid );      For example I'm outputting a loop of custom post types. Next to each post title I'm displaying the author of the post using a similar get_related_author function. I also want to display the number of posts this author has published. I assume I just need to replace $userid with the_author_meta() somehow but haven't managed to get it working. Am I even approaching this in the right way? Thanks D


Outputting Canonical Resource URLs Across a Multisite Network?

Say a theme _"foo"_ is used on across a network of sites. In each site, all the theme resources (`.css`, `.js`, etc.) will have distinct URLs:   * http://network/siteA/wp-content/themes/foo/style.css   * http://network/siteB/wp-content/themes/foo/style.css   * http://network/siteC/wp-content/themes/foo/style.css I want these to all be:   * http://network/wp-content/themes/foo/style.css What's the best way to do this? I can fix URLs directly output in the theme, but how do I normalize the URLs in enqueued scripts/stylesheets? > _Aside_ : What's the benefit of having expressions like > `get_bloginfo('template_url')` create URLs that differ across sites?


How to show taxonomy image instead of taxonomy name on a list

I would like to show in a custom taxomony list icons instead of taxonomy name , but just for the ones with image asociated, where there is no image let show the taxonomy name . i have installed taxonomy-images plugin also , but it only adds the images , does not replace the taxonomy name. tnx this is the code i have in the archive{custom type}.php file               <?php query_posts( array( 'post_type' => 'custom_type','posts_per_page' => 20 ) ); ?>                                  <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<article id="post-<?php the_ID(); ?>" <?php post_class( 'clearfix' ); ?> role="article">                                       <?php // end article header ?>     <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">

<?php if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.       the_post_thumbnail(thumbnail);     }      ?><a href="<?php the_permalink() ?>" class="title2" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>

 <?php // end article section ?>                                           <?php                                         printf( __( ' %4$s', 'bonestheme' ), get_the_time( 'Y-m-j' ), get_the_time( __( 'F jS, Y', 'bonestheme' )), bones_get_the_author_posts_link(), get_the_term_list( get_the_ID(), 'custom_cat', ' ', ' | ', '' ) );                                     ?>                                  <?php // end article footer ?>

 <?php // end article ?>                                  <?php endwhile; ?>


How to remove featured images from posts

Somehow my theme doesn't recomend featured images. That being said, how can i remove featured images from posts?


Edit Comments Form in TwentyEleven

Is there a way I can edit / change the layout of the comments form (leave a reply form) in the TwentyEleven theme? I want to put the textarea on top and I can change the styles via css but physically moving the forms is where I'm having trouble. I'm not sure where to find the code for it. tl;dr Where's the comments form code?


how to use $wpdb->prepare to update a custom table

As a noob I dont understand a lot of SQL injections but I need to be save so I have read that I have to use wpdb->prepare to make sure the data is stored correct. At this moment I use the $wpdb->update() query so I need some help to transform this into an save query with $wpdb->prepare().               $wpdb->update('custom_table',         array(         'option_1' => 'hello',          'option_2' => 2,         'option_3' => 'world'         ),         array('option_name' => 'some name'),         array('%s','d%','%s')     );


Memory issues - Fatal error: out of memory - plugins?

My problems with my site continue. I got timeout errors initially. The server ground to a halt, very high memory use by Apache. Site came back with no pages. I found that deleting the most recent post in wp_posts brought the site back up. Sysadmin pointed out high cpu use by apache but this may be a red herring, the memory not cpu is an issue. It seems that when user uploads a file, the memory used by Apache goes through the roof eventually bringing the site down. The files aren't that large so it's not php upload_max_filesize causing it. I suspect the problem is being caused by a plug-in. the plug-ins I have are:   * contact form 7   * contact form to db extension   * enable media replace   * health check   * Relevannsi   * Simple expires   * User access manager   * Category posts   * breadcrumb trail   * configure SMTP Does anyone know of any issues with any of these, or does an issue with plug- ins sound like a likely cause? I get Fatal error: out of memory error now. User told me it went when he tried to upload file.


Google Maps with categories

i'm looking for plugin that could help me make multiple markers on google maps and multiple categories. This plugin would be great but i need better Categories manager. For example   1. |Restaurant   2. |--Vegetarian   3. |--Vegan   4. |Hotels   5. |--5-star   6. |--4-star Also i need ability to chose which categories map will show. Thanks for all answers.


Get title of custom fields created by "Types" plugin

Dealing with a large website I have more than 10 custom post types, around 400 custom fields for totally dynamic site grouped in 200 categories created with "Types WordPress plugin" But when I am displaying data, i am using,               $custom_fields = get_post_custom();      and by using this i am getting the sulg of custom field and the value. That means if my custom field name is "`Bearing Code`", i am getting '`wpcf- bearing-code`' and the value for it. Is there any function to get the title of custom field created by types plugin, i.e.               function_name(wpcf-bearing-code)      would return me the value "Bearing Code".


Showing option when page is frontpage

Currently I'm having some difficulties with below snippet. As it currently works it shows `the_excerpt_rss` on a single post and single page. AND it shows the option on `is_home()`. But what if a page (instead of the 'blog') is the frontpage? If possible I'd like to include the option as well. I've tried several versions of including `is_front_page()` but without any luck thus far. The snippet I'm currently using:               <?php if (is_single() OR is_page()): if (have_posts()): while (have_posts()): the_post(); ?>         <meta name="description" content="<?php the_excerpt_rss(); ?>">     <?php endwhile; endif; elseif (is_home()): ?>         <meta name="description" content="<?php $options = get_option('schema_theme_options'); echo $options['metadescription']; ?>">     <?php endif; ?>


WP_MAX_MEMORY_LIMIT in wp-config.php seems to be ignored

I am using **WordPress v.3.8.1** with WMPL (WordPress Multilingual Plugin) v.3.1.4 and WPML Media Pugin v.2.1.3. In php.ini file I have...               memory_limit = 512M      I already have a info.php file with `<?php phpinfo(); ?>` where I can see that `memory_limit = 512M`. In wp-config.php file I have before wp-settings.php inclusion...               define( 'WP_MAX_MEMORY_LIMIT', '384M' );      When I am trying to use "Media Translation" I get this error after 50/400 media have been processed...               Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 523800 bytes) in /wp-includes/plugin.php on line 1939      Any suggestions?


Populating a form with SQL queries

Being a 'learning by example' kind of guy, I've populated a form using this code;                   <?php         $meta_key1 = 'area';         $postids = $wpdb->get_col( $wpdb->prepare(       "      SELECT      key1.post_id      FROM        $wpdb->postmeta key1      WHERE       key1.meta_key = %s      ORDER BY    key1.meta_value+(0) ASC      ",          $meta_key1         ) );          ?>              <form action="" method="post" name="advanced-search-form">         Area: (select)         <select name="area">         <option> Select area...</option>         <?          if ( $postids )          {             foreach ( $postids as $id )              {                 $post = get_post( intval( $id ) );                 setup_postdata( $post );                 ?>                 <option><? the_field($meta_key1) ?>                 </option>                 <?php             }         }         ?>         </select>         </form>      to populate one dropdown from a direct SQL query of custom fields. I have several custom fields. I want the dropdowns to only list values that exist. questions;   1. I could repeat this in a brute force kind of way but I am guessing there is a more compact method of extracting the different meta_key arrays   2. The method above is finding posts rather meta_values so I can't get populate than one dropdown using this method. What should I use to get the lists of used values.    3. My ignorance but I don't understand the use of key1 in the code above - as I say I am learning by example


Difference between is_user_logged_in and $_session['uname']

I am writing a condition to check if a user is logged in, not sure which of the below condition to use :                if(!is_user_logged_in()){         And                if(!isset($_SESSION['uname'])){      Basically need to check if any user is logged in.


Custom Post Type Implementation

I have been working hard to implement few custom post types for making a job board in hybrid news. So far, I have created custom post type- Jobs, created a page template http://pharmastudent.net/jobs for displaying jobs which is place in the parent theme. If I understand the custom post types correctly, I have to create a single- job.php correct? Rightnow, the singular.php is modified how an individual job should be displayed http://pharmastudent.net/Jobs/manager I was made aware that modifying singular.php is not the correct way, instead a single-job.php should be created.. Could anyone help me create the same and let me know where it has to be filed? Thanks much in anticipation. Naveen


How can I add authors in WordPress and assign them a picture?

I know that Wordpress allows us to create a new user and the user's avatar is got from Gravatar service base on their email. How can I add authors in WordPress and assign them a picture (without using Gravatar service ) ? Thank you ! P/S: I am sorry for my bad English. :)


Need help with adding jQuery script to WP and calling script to page

I've written a pretty simple jQuery script, and I don't know how to call it. It's in its own directory. First, how do I register it, and then how do I enqueue it? I assume that's the order it's done in, and that registering it basically means that it's available for use, and that enqueuing it applies it. I know that I have to add code to `functions.php`, but not sure exactly what. I've read a few things that haven't made it any clearer. For instance, WP.org says if I want to use Google's jQuery library, then I should deregister WP's install. Someone on this forum says don't deregister it. Using WP's version is fine, so this is what I have in `functions.php`:               <?php     function my_scripts_method() {         wp_register_script( 'jquery' );         wp_enqueue_script( 'jquery' );     }              add_action('wp_enqueue_scripts', 'my_scripts_method');     ?>      I also don't know how to call it on a page. What code, specifically, would I add to the page's WYSIWYG to get the script to work? Here's what I have on the page now:               <?php wp_register_script( $resize_fade.js, $http://www.mysite.com/subdirectory/wp-content/js/, ); ?>


Wordpress database nonsense error

I'm very confused. What i did was change my hostfiles so i can access my website on an alternative website and checked it in case i had hardcoded values (i did and they were corrected). I had to use the defines below to get the check to work               define('WP_HOME','http://example.com');     define('WP_SITEURL','http://example.com');      Anyways, after i checked everything i did some select queries in my db (confirmed by looking at history). When i undid the define and change my host files back so my original url isnt poiting to home i tried visiting my wp site and i got "Error establishing a database connection". copied pasted the login data into mysql -u name -p (pass) and i was able to log in... i dont know why wp cant login. I tried reseting my server, mysql server and php-fastcgi. All didnt fix it :(. How do i fix this?


nav-menu-template and columns in sub menu

I am trying to use the wordpress menu setup and have a working horizontal menu with a drop down submenu. Unfortunately the sub enu is quite long so I wanted to split it into columns I can do it if I hardcode the menu into header.php but that means I have to add new items rather than letting the client do it. This is a parred down version of what I am trying to achieve

home

About Us

Services

Products

Terms

Privacy Policy

Staff

Vacancies

clients

media centre

contact us

site map

      So what I need to do is to be able to loop through the child items and add in the etc as necessary. Any tips, advice or anyone done this before?? TIA


Unable to load stylesheet via wp_enqueue_style

I am using this               <?php// Load the theme stylesheets     function theme_styles() {               // Load all of the styles that need to appear on all pages         wp_enqueue_style( 'main_css', get_template_directory_uri() . '/style.css' );          }     add_action('wp_enqueue_scripts', 'theme_styles');     ?>      to add a stylesheet in my theme, but it's not loading the stylesheet


Get post id on click of thumbnail

I am a little lost so I apologize if this question is vague and not organized well. I currently have a grid of thumbnails populated via Wordpress. I retrieve them by getting all the posts in a category and getting their thumbnails. I now want it so when you click on the thumbnails it pulls up the body of the post in a text box I have on the same page as the grid. I am looking for someone to point me in a direction as to how I get the post id when I click the post and then how I load the text box with the body text from that id. GRID OF THUMBNAILS:               foreach  ( $categories as $category ) {       $i = -1;       echo '

' . $category->name . '

';       $args = array( 'posts_per_page' => -1, 'cat' => $category->term_id );       $cat_posts = new WP_Query($args);       if ( $cat_posts->have_posts() ) : while ( $cat_posts->have_posts() ) :         $i++;         $cat_posts->the_post();         $face = get_field( 'face' );         $name = get_field( 'fullname' );         if ( $i % 6 == 0 ) echo '
';         echo '
';         echo '
';         echo wp_get_attachment_image($face);         echo '

' . $name . '

';         if ( ($i % 6 == 5) || $i == ($cat_posts->post_count - 1) ) echo '
';       endwhile; endif;     }     wp_reset_postdata();     ?>      _**UPDATED FOR POST BELOW_** //index
this is my bio

                                           <?php the_title(); ?>

                    <?php     $categories = get_categories( 'child_of=2' );           foreach  ( $categories as $category ) {       $i = -1;       echo '

' . $category->name . '

';       $args = array( 'posts_per_page' => -1, 'cat' => $category->term_id );       $cat_posts = new WP_Query($args);       if ( $cat_posts->have_posts() ) : while ( $cat_posts->have_posts() ) :         $i++;         $cat_posts->the_post();         $face = get_field( 'face' );         $name = get_field( 'fullname' );         if ( $i % 6 == 0 ) echo '
';         echo '<div class="obj" data-id="<?php the_ID(); ?>">';         echo '
';         echo wp_get_attachment_image($face);         echo '

' . $name . '

';         if ( ($i % 6 == 5) || $i == ($cat_posts->post_count - 1) ) echo '
';       endwhile; endif;     }     wp_reset_postdata();     ?>

      //functions               add_action('wp_ajax_select_face_post', 'select_face_post');     add_action('wp_ajax_nopriv_select_face_post', 'select_face_post');     add_action('wp_enqueue_scripts', 'faces_posts_scripts');          function select_face_post () {       error_reporting(0);       if ( ! isset($_POST['postid']) || ! intval($_POST['postid']) ) die();       if ( ! isset($_POST['nonce']) || ! wp_verify_nonce($_POST['nonce'],'postface') ) die();       $post = get_post($_POST['postid']);       if ( empty($post) || ! is_object($post) ) die();          header('Cache-Control: no-cache, must-revalidate');       header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');       header('Content-type: application/json');       echo json_encode( $post );       die();     }          function faces_posts_scripts() {       // replace 'all_faces' with the slug of page in which resides the code you posted       if ( is_page('team') ) {          wp_register_script( 'postface', get_template_directory_uri . 'Team/postface.js', array('jquery'), NULL, true );              $url = admin_url('admin-ajax.php');         $nonce = wp_create_nonce('postface');         wp_localize_script( 'postface', 'postface_vars', array('ajaxurl' => $url, 'nonce' => $nonce) );         wp_enqueue_script( 'postface' );       }     }      //js               // postface.js     jQuery(document).ready(function($) {       $(document).on('click', 'div.obj', function() {         var selectedpost = $(this).data('id');         if ( selectedpost > 0) {            $.ajax({             type: "POST",             url: postface_vars.ajaxurl,             dataType: 'json',             data: { action: 'select_face_post', nonce: postface_vars.nonce, postid: selectedpost }            }).done( function(data) {             if (data.post_content) {               // var id =  data.ID;               // var title = data.post_title;               $('#PersonBio').html(data.post_content);             }           });         }       });     });      ![enter image description here](http://i.stack.imgur.com/L3a1E.png)


Extending WP_List_Table seems getting wrong with $this->get_columns() - what's wrong?

I'm trying to implement an Admin Table for a view page of a plugin of mine by following the following tutorial:   * **Create Native Admin Tables In WordPress The Right Way**      by _Jeremy Desvaux de Marigny_      SmashingMagazine.com Here's how I extended the `WP_List_Table` class for my plugin. (Code at Pastebin) The problem is: it's not showing any Column or Row, only the Table Top and Bottom. I did `var_dump()` steps, and found that in **Line 149** the `var_dump($columns);` is showing empty.      ![Extended List Table](http://i.stack.imgur.com/O3TCv.png) WHAT AM I DOING WRONG ABOUT THIS PORTION?               /* -- Register the Columns -- */     $columns = $this->get_columns();     $_wp_column_headers[$screen->id]=$columns;


Child Category Image

I have some code that display's the titles of my child category posts on one of my pages:               <?php         $parent = get_cat_ID("photos");         $cats = get_categories('child_of='.$parent);         foreach ($cats as $cat) {             echo "
";             echo sprintf("
%s
", get_category_link($cat->term_id), apply_filters("get_term", $cat->name));             echo "
";     } ?>      Is there a way to also post a random featured image from the child category posts? I'm pretty sure I can use this existing code, just not sure what to change to make it work. Thanks,   Josh


Plugin capabilities

I created an interface that allows users to do a certain number of actions, each of them having a capability associated (including accessing the interface). I would like to have a base capability (primitive here?) that is required to have if a user wants to preform all of the other actions: if the user can delete an item, the user must also be able to access the interface. Several plugins allow to add/remove capabilities: I would like to prevent the case when a user can delete but cannot access the interface from happening. I understand that with post types and meta capabilities and map_meta_cap filter - I am having a hard time to apply that to my plugin, though. I could check both all the time, but the permission hierarchy will eventually be more complex (say, 3 levels - user must have the capabilities access_interface, create_item and create_typeX_item to be able to create an item of type X) so it sounds silly to duplicate code all over the place instead of just checking one capability (in my example: create_typeX_item). I am NOT dealing with a custom post type, and it isn't an option, so I don't know if the use map_meta_cap filter is relevant in this case, and if so I don't know how to use it. Any suggestions?


wordpress paginate, link to the right page

I have posts that I paginate, instead of showing them on their single post page I would like to show them on the archive page. I've built my own archive- page with custom functions. I just added **news-archive.php**               $news_args = array(       'post_type' => 'post',       'post_status' => 'publish',       'posts_per_page' => 5,       'paged' => $paged     );     $news = new WP_Query($news_args);     ...      So I have another page where I show the latest news on, and a snippet of that news. When clicked on the news link I would like it to go to the correct page number on the archive. How can I accomplish this? thanks in advance


Posts page template: How can I edit the markup for this?

I have in settings->reading changed the front page to display a static page. One for home, one for news with a custom template for each. Home works fine, however News will not change no matter what I change. Can anyone give me clear instructions on how to control/change the 'latest posts page' so I can change the markup. Thanks


URL rewrite results in a 404, but everything should work!

So I modified this code that I found elsewhere and stuck it in a plugin. The plugin works; I can see the .htaccess file updated when I hit save on the permalinks page.               add_action( 'init', 'wpse26388_rewrites_init' );          function wpse26388_rewrites_init(){         add_rewrite_rule(             'microsoft/mcsa/',             'wp-content/microsoft.php?cert=mcsa',             'top' );     }          add_filter( 'query_vars', 'wpse26388_query_vars' );          function wpse26388_query_vars( $query_vars ){         $query_vars[] = 'cert';         return $query_vars;     }      .htaccess               RewriteEngine On     RewriteBase /training/     RewriteRule ^index\.php$ - [L]     RewriteRule ^microsoft/mcsa/ /training/wp-content/microsoft.php?cert=mcsa [QSA,L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /training/index.php [L]      I can go to /training/wp-content/microsoft.php?cert=mcsa and the page loads. But when I try to access it via /microsoft/mcsa, it does not and gives me a 404. What gives? And is there any way to enable error logging to see where it's trying to go? Enabling debug mode in wp_config didn't seem to do anything.


Multisite Widget/Content

I'm using WordPress multisite and need to display content across all subsites in the sidebar. This is a network of 50+ sites so updating all 50+ sidebars with this content every few days is not practical. One solution I've found is to simply insert the content I want into sidebar.php in the theme editor, though I don't want my client editing this file, and want them to use TinyMCE editor instead of HTML. Another idea was to embed an iframe into each subsite and have my client update the page that the iframe was referencing. And the final idea I had was to create a plugin with the TinyMCE editor that would inject code into the sidebar.php file when saved, though I don't know if access to editing theme files is available to plugins. Is there a better solution that I'm not thinking of? I tried a few plugins with no success, did I miss one?


wordpress php show comments only from user AND replies

I'm trying to add a comment section to a user profile, it'll act as a way of communicating between the user and the admin. In the user section I only want to show comments from the logged in user, and replies from the admin. Here is my code that handles the comments loop:               <?php     if ( is_user_logged_in() ) {     $user_id = get_current_user_id();     $args = array(         'status' => 'approve',         'order' =>  'DESC',         'user_id' => $user_id     );     $comments = get_comments($args);     foreach($comments as $comment) :         echo '
';          echo($comment->comment_author . '
' . $comment->comment_date . '
' . $comment->comment_content);         echo '
';     endforeach;     }     ?>      This currently shows only the logged in users comments - now I need a way to show replies too - any thoughts on how I can do this?


Display Image Upload from Contact Form 7 on Redirect Page

How would I show an image upload, a photo of someone, in the Thank You page. It's for a competition. NB: The user uploads an image and then that image is shown on the thank you page.   * I need to access the form data array   * find the file uploaded already   * and display this in an img tag on the thank you page   * I already have the redirect in place I'm not very good at all with PHP, but I feel like I've been skirting the solution I just can't see it. This question shows the possibility of using the data from the form but how would I extract the file variable and then use that to show it on the next page. It would need to be a method that can handle numerous people using the form possibly at the same time. There are likely to be hundreds of entries. Thanks in advance!


Is it possible to have more than 1 sql databases in my wordpress blog?

I m watching video on installing wordpress manually. on first launch wordpress prompts you to input your sql database name, sql password etc. then i can start working from dashboard. is it possible for wordpress blog to have more than one db? if yes, what is the possible example for having 2-3 databases? when would you need more than one db? **or the working rule is: one blog - one db? if you have 2-3 blogs, you can manage them from SAME dashboard!? and each must of course have 1 db?**


WP_Customize_Image_Control and selecting from library?

I am adding some theme options, one of which is an image option.                $wp_customize->add_control(                 new WP_Customize_Image_Control(                     $wp_customize,                     'theme_ppr_options[portfolio_photo]',                     array(                         'label'      => __( 'Upload a portfolio', 'ppr' ),                         'section'    => 'mytheme_options',                         'settings'   => 'theme_ppr_options[portfolio_photo]',                         'context'    => 'your_setting_context'                      )                 )             );      But i notice i am not able to select an image from the library, how can this be enabled?? regards


Pagination Broken on Loop using ACF

http://dthudson.com/ccr/archive-issues/ The paginated pages are being populated by the content as you can see at the bottom (beneath the posts) but when you click on '2' for instance it loads page 2 but it shows the exact same posts. I want to point out that I am using Advanced Custom Fields to retrieve content from the post-type 'issues', I wonder if this is contributing to the problem. Also - I copied the pagination code from my index page and search page and each of those works fine. Any ideas?                                  <?php           $args = array(             'post_type' => 'issues',             'posts_per_page' => '9',             'order' => 'ASC',             'orderby' => 'meta_value_num'     );          $my_query = new WP_Query( $args );               if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post();?>

                         <a class="hover-color" href="<?php echo get_permalink(); ?>">
<?php the_field('release_season'); ?> <?php the_field('release_year'); ?>

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

                         <a href="<?php echo get_permalink(); ?>"><img class="column-nest image-width" src="<?php the_field('issue_image_cropped'); ?>" alt="photo of issue <?php the_field('issue_number'); ?>" />

                <?php the_content(); ?>     <?php endwhile; endif; ?>
                                                                 <?php                                  $total_pages = $my_query->max_num_pages;                                    if ($total_pages > 1){                                      $current_page = max(1, get_query_var('paged'));                                      echo paginate_links(array(                                     'base' => get_pagenum_link(1) . '%_%',                                     'format' => 'page/%#%',                                     'current' => $current_page,                                     'total' => $total_pages,                                    'prev_next'    => False,                                   'type' => 'list',                                  ));                               }                               ?>


Changing bloginfo description from a plugin

How can I change the site's bloginfo description in runtime from a plugin? I tried these, but none of them work:               add_filter('description', 'ab_arq_generate');     add_filter('blogdescription', 'ab_arq_generate');      My point would be to make a random quote in the place of the description regardless of the actual template.


auth_redirect header already sent error

I'm a novice to php so please bare with me. I've been pulling my hair out trying to figure out this one. I have a simple if statement in a page template to require viewers to be logged in.               <?php     if (is_user_logged_in()) { ?>              /* Page template code goes here */          <?php } else {         auth_redirect();     } ?>      The problem i run into is that when the viewer is not logged in, it kicks it back with a header error: > Warning: Cannot modify header information - headers already sent by (output > started at /home/xxxxxxxxxxxxx/xxxxxxxx/wp- > content/themes/xxxxxxxxxxx/template-client.php:3) in > /home/xxxxxxxxxxxxx/xxxxxxxx/wp-includes/pluggable.php on line 896 I'm building this theme off of todd motto's html5blank 1.4.2. Could that be whats causing it? http://html5blank.com/ https://github.com/toddmotto/html5blank How can I trigger auth_redirect to run before the headers are sent? Any code example would be very helpful.


What method should I use to store my plugin data (multi level menus with options on each item)

So the background on my plugin - it generates taxonomy/term filters to give you a filtering system similar to what you'd see on NewEgg where you filter your results by category/manufacturer/other criteria. In the admin area, users will create a filter-set. The filter-set will have various options (display name, type, etc). Within the filter set are the individual taxonomies that the filter-set will be made up of. These can be re- ordered using drag and drop (their order needs to be stored since they will need to be displayed in that order). Each of the taxonomies also has various options like display name, menu type (drop down, radio button, multi select, etc) and various other options. Ultimately it will look something like this (the ordering of the 'taxonomy' nodes must be retained);               <Filterset-01 option1="" option2="">       <taxonomy tax="c"  option1="" option2="" option3="" />       <taxonomy tax="b"  option1="" option2="" option3="" />       <taxonomy tax="a"  option1="" option2="" option3="" />     </filterset-01>          <Filterset-02 option1="" option2="">       <taxonomy tax="d"  option1="" option2="" option3="" />       <taxonomy tax="a" option1="" option2="" option3="" />       <taxonomy tax="e" option1="" option2="" option3="" />     </filterset-02>      So far I set up my own db table but I feel like this might not be the best method. I can probably store the whole thing in a big, complicated array and just save it a single option in wp_options but I don't know if that's a good idea. I was also considering XML since I already visualize the plugin structure in pseudo XML but I don't know if there is any preferred method for storing options in XML or what drawbacks it may have. Basically I just want to know what the ideal method for storing the above data would be.


Redirect entire website to a single page

I need to redirect a whole WordPress site to a single WordPress page. A sort of maintenance mode, but the redirect has to go to a published WordPress page. Unfortunately, the maintenance page I need to show has to use other WordPress plugins. I am not aware of any Maintenance Mode plugin which lets you do this. At most, they let you write custom HTML/CSS code. I was thinking about a .htaccess mod_rewrite rule. However, I am very weak with mod_rewrite. First, I disabled canonical redirects. Then, I tried to use:               RewriteEngine On     RewriteBase /     RewriteCond %{REQUEST_URI} !^/index.php?page_id=813$     RewriteRule ^(.*)$ /index.php?page_id=813 [R=307,L]      However, these rules generate redirect loops. `page_id=813` is the ID of my maintenance page, of course. Is anybody aware of a maintenance mode plugin, which redirects to a published page? Alternatively, can somebody help me to fix the mod_rewrite rules? Extra cheers if we can leave `/wp-admin` out of the redirect rules.


Cache all products Woocommerce

I have installed a cache program to cache my pages. Ofcource the pages has to visited before it can be cached. Is it possible to run all the product pages at night and how? I hope someone has a idea! Solution: foreach loop = > system("wget -N -O - 'http://domain.com/etc/etc/")


Why is this function crashing my wordpress installation?

I'm new to wordpress and programming in general. For my first site there is a custom template in which I want to load a javascript library. After registering and enqueueing it in functions.php my site no longer loads properly. I'm sure what it is simple mistake and would really appreciate a little help. For the record, I'm using a child theme of twentytwelve. Here is the code:               <?php      function load_wforms() {           if (is_page(45)) {               wp_register_script('wforms', get_stylesheet_directory_uri().'/js/wforms.js'), false, '2.0');               wp_enqueue_script('wforms');           }       }       add_action('init', 'wforms');       ?>      Thanks!


links to posts not working on homepage

I have created a nice homepage where the posts are organized into two columns. Only somehow, in creating this, I must have erased the actual code that tells the posts to link to the corresponding post. So right now, the posts are all showing up on the homepage, but there is no way to go to the post - the post previews are unlinked to the actual posts. I looked around some first, thinking this might be a common issue, but I haven't found the answer yet. If anyone can assist, i would greatly appreciate it! The site is at internalcompass.us/castle. It's a twentytwelve child theme. here is the code i have in content.php                   <?php         /**          * The default template for displaying content. Used for both single and     index/archive/search.      *      * @package WordPress      * @subpackage Twenty_Twelve      * @since Twenty Twelve 1.0      */     ?>                  <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>                     <?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
                             <?php _e( 'Featured post', 'twentytwelve' ); ?>
                     <?php endif; ?>                                                  <?php the_post_thumbnail(); ?>                             <?php if ( is_single() ) : ?>
<?php the_title(); ?>
                             <?php else : ?>

<?php the_title(); ?>
<?php the_date('F j, Y'); ?>

                             <?php endif; // is_single() ?>                                                       <?php edit_post_link( __( 'Edit', 'twentytwelve' ), '', '' ); ?>                             <?php if ( is_singular() && get_the_author_meta( 'description' ) && is_multi_author() ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries. ?>

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

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

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

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

                             <?php endif; ?>


Pass a comma separated shortcode attribute to a function

I've been trying to create a shortcode for the Category Ajax Chain Selects plugin so that I can display the chain selects within a chosen post/page easily, but for now I've only been able to hardcode the attributes into the shortcode:               function cross_ref_lookup_shortcode() {         echo chainselect_getcategories( 'kla-competitor', 2, array('Select Manufacturer', 'Select Product'), array('Manufacturer', 'Product'), 'Find comparable product', '', 0 );     }          add_shortcode( 'cross_ref_lookup', 'cross_ref_lookup_shortcode' );      This works fine and I can display the chain selects where I want, but I want to create a shortcode where I can add the variables as shortcode attributes. The usage of the chainselect_getcategories function looks like this:               <?php chainselect_getcategories( $tax, $level, $titles, $labels, $btn_text, $exclude, $count ) ?>      I got far enough that everything worked except for the labels and titles, because they require an array. I can't figure out how to pass a shortcode attribute as an array to the function so that this will work as intended. In my hardcoded example above, the arrays work, and this is what I need to recreate from the shortcode attribute. Here's as far as I got:               function chain_select_shortcode( $atts ) {         extract( shortcode_atts( array( 'tax' => 'category', 'level' => 1, 'titles' => array( 'Please select…' ), 'labels' => '', 'btn_text' => 'Submit', 'exclude' => '', 'count' => 1 ), $atts ) );              return chainselect_getcategories( $tax, $level, explode( ',', $titles ), explode( ',', $labels ), $btn_text, $exclude, $count );     }          add_shortcode( 'ajax_chain_select', 'chain_select_shortcode' );      Any ideas on how to complete this?


How to set individual capabilities on a taxonomy? Or how to re-register an existing taxonomy?

The default taxonomy, category. By default, only those with the `edit_posts` capability can assign categories during post creation/editing. I have a role with very limited capabilities. I want to let users in this role be able to assign categories during custom-post-type creation/editing, but I cannot give them the `edit_posts` capability and they should not be able to edit the taxonomy, only assign it. How can I do this? Setting `'assign_terms' => 'read'` is one option, but how can I set that value without having to re-register the taxonomy? Or alternatively, how can I give my low-level role permission to assign the taxonomy?


Custom Permalink Structure for Pages & Posts

I'd like to create a permalink structure that works in the following way: Pages - http://myurl.com/ _pagename_   Posts - http://myurl.com/news/ _postname_ / How would I do so? Thank you


can register_post_type() be safely called before init

If I call `register_post_type()` before the `init` action, will my plugin explode in a ball of fire under some circumstances? Codex says: > register_post_type should only be invoked through the 'init' action. It will > not work if called before 'init', and aspects of the newly created or > modified post type will work incorrectly if called later. Codex also says: > Note that you must call register_post_type() before the admin_menu and after > the after_setup_theme action hooks. A good hook to use is the init hook. Given this advice, I've always registered my CPT on the `init` action. That's always worked well for me, until today, when I found a problem. I have a plugin (not yet released anywhere) that logs emails. I use it extensively when testing. It registers a CPT, which it uses to store the email logs. All good so far. Today, testing an Easy Digital Downloads shop, I noticed that I was getting errors logged in debug.log, each time I inserted a new email log post. The error was caused by `get_post_type_object()` not finding my CPT, because EDD is sending emails before the `init` action. So, after verifying that the doco and piles of other references including WPSE concur that "register_post_type should only be invoked through the 'init' action", I went ahead and changed my plugin to register on `plugins_loaded`. Note that this action precedes the `after_theme_setup` action, so I'm violating both of the above Codex excerpts. Am I OK doing this, or will I strike some problem under some circumstances? BTW, when I dump the contents of `$wp_post_types` on `plugins_loaded`, it already has all the standard WordPress post types defined... Edit: OK, I'm dumb, EDD isn't sending emails out before `init`, I just needed to increase my hook's priority to beat it -- now hooking `init` at priority 1. But the question still stands...