Pass jquery var to a function in functions.php

I have this js in /js/functions.js:                    jQuery(document).ready( function($){       //Some event will trigger the ajax call, you can push whatever data to the server, simply passing it to the "data" object in ajax call       $.ajax({         url: ajax_object.ajaxurl, // this is the object instantiated in wp_localize_script function         type: 'POST',         data:{           action: 'myaction', // this is the function in your functions.php that will be triggered           name: 'John',           age: '38'         },         success: function( data ){           //Do something with the result from server           console.log( data );         }       });     });      And in functions.php I have:               <?php     add_action( 'wp_enqueue_scripts', 'so18550905_enqueue_scripts' );     function so18550905_enqueue_scripts(){       wp_register_script( 'ajaxHandle', get_template_directory_uri() . '/js/functions.js', array(), false, true );       wp_enqueue_script( 'ajaxHandle' );       wp_localize_script( 'ajaxHandle', 'ajax_object', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );     }          add_action( 'wp_ajax_nopriv_myaction', 'so18550905_wp_ajax_function' );     function so18550905_wp_ajax_function(){       //DO whatever you want with data posted       //To send back a response you have to echo the result!       echo $_POST['name'];       echo $_POST['age'];       wp_die(); // ajax call must die to avoid trailing 0 in your response     }     ?>      But I can't echo name and age on front pages. Where is the problem? Thanks.


Rotate Widgets or Content Blocks every x sec/min

Is there a way to rotate widgets or text blocks with a Flash banner? I had a widget loading a Flash Video loaded by wordTube Flash and YouTube player. The client wanted to rotate this video together with some Flash text (effect showing text being typed). I replaced the Flash text banner by the jQuery Tickertype plugin - better SEO - and I tried Datafeedr to load both alternatively. It allows you to add html and Flash into severa ads per adgroup. But I realized that plugin only rotates ads on page refresh. Any plugin that rotates (ad) blocks every x seconds or minutes? **Update 1** I am testing http://wordpress.org/extend/plugins/randomtext/ , but it does not seem to rotate even though I do not have a caching plugin running. **Update 2** jQuery on jQuery howto Blog seemed promising, but it grabs content from a file and not let's say content from a different HTML element. **Update 3** Checking http://forums.asp.net/t/1777232.aspx/1?Fade+In+Out+between+two+divs for jQuery `animate()` with 'setTimeout`and`fadeIn()`and`fadeOut()` All rather new to me and wondering if I can combine this Tickertype. **Update 4** I have added some jQuery to rotate two divs, but I cannot seem to be able to keep the text widget I use to rotate these two divs of a fixed size. Here is the basic plugin:               $(document).ready(function () {             fadeIn_();         })              function fadeIn_() {             $('#flash').fadeIn(2000,             function () {                 setTimeout("$('#flash').fadeOut(2500); fadeOut_();", 6000);             })         }              function fadeOut_() {             $('#ticker-area').fadeIn(2000,             function () {                 setTimeout("$('#ticker-area').fadeOut(2500); fadeIn_();", 6000);             })         }      And this is the HTML and CSS inside the text widget:

<object width="560" height="315" type="application/x-shockwave-flash" id="WT1" name="WT1" data="http://elc.imagewize.com/wp-content/uploads/player.swf"><param name="wmode" value="opaque"><param name="allowscriptaccess" value="always"><param name="allownetworking" value="all"><param name="flashvars" value="file=path/to/file.flv&volume=80&bufferlength=5&quality=false&logo.hide=false&image=http%3A%2F%2Fdomain.com%2Fwp-content%2Fuploads%2F2012%2F02%2Fsteve-martin-thumb.png&title=Steve%20Martin%20learning%20English&linktarget=_self"></object>

Sed venenatis diam quis lorem. Curabitur.

Fusce vehicula iaculis felis. Phasellus congue!

Morbi vitae enim vel purus sollicitudin.

      CSS:               #home-top-row .widget_text {margin-top: 50px;}          #ticker-area{         width:320px;         height:240px;         padding: 10px 0;         margin: 20px 0;         font-size: 1.5em;         font-weight: normal;         color: #060;     }          /*Flash and TickerType*/          #flash-rotate, #text-5{         width:320px;         height:240px;     }      **Update 5** Tinkered with CSS background and dimensions and now all good!


How to redirect all requests to wp-login.php?

I created some custom login/registration template pages and now I want that every request to wp-login.php to be redirected to a custom url. Now I have something like this:               add_action('init','possibly_redirect');      function possibly_redirect(){     global $pagenow;     if( '/wp-login.php' == $pagenow ) {     wp_redirect('/login');     exit();     }     }      but it doesn't work properly because when I click a logout link (in a meta widget) it will redirect me to the /login link and not doing logout. Do you have other method to do this in a safe or a better way ? Thank you.


Update Post with Modified Data

Task is to take class from `<pre class="php"></pre>`, and add that class to `<code></code>` and wrap all content of `<pre>` into `<code>` after that. I am querying WP with this args:               $args = array(         'post_type'=>'post',          'post_status'=>'any',          'order_by'=>'date',          'order'=>'DESC',          's'=> '
true,         'posts_per_page' => -1             );          // The Query     $query = new WP_Query( $args );      Then, I am updating data with this:                       $my_post = array(                 'ID'           => get_the_ID(),                 //'post_date_gmt'=> gmdate( 'Y-m-d H:i:s', time() ),                 'post_content' => $dataUpdate             );                // Return 0 (or wp_Error, if 2nd param is passed true).           wp_update_post( $my_post );      So, if post data is:               [     . . . ..      some content
       escaped markup
     . . . . .      ]      Then, the updated post would be:               [     . . . ..      some content
            escaped markup
     . . . . .      ]      I am using DOMDocument, but the ` tag that get added are coming in this form <code class="php">`, so it cannot be used with Syntax Highlighter. I thing, DOMDocument is escaping it. **How to avoid escaping of newly created tag?** **Is there any better approach I would have taken?**


Is it necessary to bump a plug-in's version if you're just updating the "Tested up to" attribute?

I've got a number of plug-in's hosted on the wordpress.org svn server ... with the immenent release of 3.1, I would like to update the "Tested up to" meta data. There will be no functional changes to the code, just the meta data. Is it necessary to change the revision number for such a trivial change?


BackPress - which libraries i need to load to work with Multisite?

i have successfully install and run those projects based on BackPress.   1. SupportPress: https://supportpress.svn.wordpress.org/trunk/   2. GeoPress: http://geopress.my/ I try to understand how i can build some custom projects that will need the MultiSite feature with the subdomains option. Does anyone knows how to do this? Which libraries i have to load? thanks a lot!


Display the first image from a post in RSS feed

I have seen other question located here , but its not useful for my case. Its not working. Also - RSS Feed Image plugin is not working as desired. I want to **display first image** of the post in RSS feed. Below is a code I am using for displaying Thumbnail / featured images               //Display TZ Thumbnail in RSS     function insertThumbnailRSS($content) {     global $post;     if ( has_post_thumbnail( $post->ID ) ){     $content = '' . get_the_post_thumbnail( $post->ID, 'thumbnail', array( 'alt' => get_the_title(), 'title' => get_the_title(), 'style' => 'float:left;margin: 20px' ) ) . '' . $content;     }     return $content;     }     add_filter('the_excerpt_rss', 'insertThumbnailRSS');     add_filter('the_content_feed', 'insertThumbnailRSS');      This one is working sweet - however; anything I tried for first image, is not working at all. The least I could use was to display first image URL. (not desired) Thanks in advance :)


Enqueue script on logon failure

I have been playing arround for a day and didn't manage to achieve what I want. Is it possible to enqueue a script if user fails (username or password) to login? I checked and played arround with wp_login_failed but no luck so far! I want to use this function in a popup login form. After login (success or failure) the page refreshes so I want to force pop up show automatically after a failure (user should not manually click the login button again) by adding javascript ( $('#login-dialog').show(); )


Users with custom roles can't read each other's comments

My site has a custom role ("coach") with its own set of capabilities (via `map_meta_cap` along with a few built-in roles). Each user is assigned a page on the site that they "own" and can edit (via a front-end editor). Each page has comments (rebranded as "reviews"). This system works pretty well, except for one thing: WordPress won't return comments on pages that this user (with the "coach" role) doesn't 'own'. I'm getting comments with `get_comments()`, and it returns exactly what I expect if I'm logged out, logged in as an administrator, or logged in as a 'coach' and viewing that coach's page. When logged in as a 'coach' and viewing another page, `get_comments()` returns an empty array. This seems like a role/capability issue, but I'm having a hard time pinning down exactly what's happening. I've played with adding various capabilities to the coach role, but with no luck. Here's the code I'm using to return comments:               $testimonials = get_comments( array(         'post_id' => $coach_post_ID,         'status'  => 'approve',     ) );      Running `var_dump( $testimonials );` returns an empty array, unless I'm logged in as that 'coach', an administrator, or logged out entirely. The coaches have all the public `read` capabilities enabled (`read` and `read_coach`) and can otherwise see all the content on other coach pages. I'm happy to provide any information you might need to help diagnose the problem. Thanks in advance!


Redirect user if theme option swich is selected

I'm using **SMOF** for my Theme Options. I added a switch option in case of the administrator wants to change the homepage (whatever it is) to other page (in this case, a "coming soon" page). If don't, redirect to the site's default page. By now I have this code:               <?php      global $data;          if ($data['general_soon_maintance'] == 1 ) {              wp_redirect( 'coming-soon-page' );         exit;             } else {         // if OFF         wp_redirect( home_url() );         exit;        }          ?>       Using the code below, the browser returns a _redirect loop_. If I write another page on the else statement (instead of the function **home_url()** ) it redirects to the page normally. The if statement works well too. I think the main problem is with the **home_url()**. Any sugestions?


Multiple languages menus problem

I'm trying to add language option to my website. I've coded my theme and I need to show the web in three different languages. I've got the little flags and I've managed to pass a php variable with the language it's selected. With that variable I've made a if for the wp_nav_menu assignment in the header.php. It works actually. When I change the language the correct menu in the correct language comes up. The problem is that when I hit in a menu item and the selected page opens the menu is gone. Disappears. Can anybody help me, plase? Here is the code I use. In header.php               if ($language == 'en') {        wp_nav_menu(array(               'theme_location' => 'eng',           'container_class' => 'main-nav',            'container' => 'nav'     ));     } else if ($language == 'de') {     wp_nav_menu(array(         'theme_location' => 'ger',         'container_class' => 'main-nav',          'container' => 'nav'     ));          } else {          wp_nav_menu(array(         'theme_location' => 'esp',         'container_class' => 'main-nav',          'container' => 'nav'     ));          }      And in the functions.php               add_theme_support ('menus');     //Create Nav Menu     if (function_exists ('register_nav_menus')) {     register_nav_menus (array(                                 'esp' => 'Spanish menu',                 'eng' => 'English menu',                 'ger' => 'Deutsch menu'         ));     }      And the html for the flag link in header.php


How to place my g+ or fb plugin at the bottom of post or page?

I recently installed the google+ and facebook widget plugins to my pages and I do not like it's current position. I'm not sure where to begin looking.. Thanks.


Change the Default Pages Menu View in wp-admin

I can't seem to figure out how to change the default view for _"Pages"_ in the admin menu. The initial view is the _"Pages"_ view (`/wp-admin/edit.php?post_type=page`) How could it change this to something else?   Like _"Add New Page"_? (`/wp-admin/post-new.php?post_type=page`) I've tried several different options including rebuilding the menu with a custom menu, but it seems like WordPress automatically keeps redirecting the _"Pages"_ view (`/wp-admin/edit.php?post_type=page`).


$post object is null

I am trying to use the `$post` object from functions.php in my theme however if I attempt to `var_dump($post)` it returns `NULL`. Here is my code:               function breadcrumb_navigation() {         var_dump($post);         $page = $post;         $parents = array();         while ($page->post_parent){             array_push($parents, $page);             $page = $page->post_parent;         }         if (sizeof($parents) > 0) {             array_reverse($parents);             foreach($parents as $parent) {                 echo '
ID).'">'.$parent->post_title.'
', wp_list_pages(array('child_of' => $post->post_parent,'exclude' => $post->ID)), '

';             }         }     }      Can anyone tell why this would be happening?


custom post type taxonomies UI radiobuttons not checkboxes

Is there a way to replace the default checkboxes by radio buttons in the custom post type taxonomy UI? I have custom post type 'questions' with taxonomy 'answer type' (single selection [radio button], multiple selection [checkboxes] and pattern matching [dropdown boxes). I need to make sure the users can only pick one option from 'answer type'. Is there a way to get this done?


Taxonomy structure help

I have been struggling with Taxonomies and Post Types for a while and could really use help understanding what would be the best implementation for my situation. Have a look here: http://shaulzofef.com/netivyah/resources/audio-lessons/ I setup a few post types; Books, Magazines, Articles and Audiolessons. I setup a few Taxonomies: Language, Author, Teacher. Teacher is associated to one post type only, Audiolessons, but Language is associated to all post types. I made a submenu on the audio page that has English, Hebrew and Russian at parent level and underneath a list of teachers in each language. I have a few problems: 1 - Some teachers teach in more than one language, so if I click on Joseph under English how will I make it list only the posts with taxonomy term Joseph AND taxonomy term English? 2 - When I click on English it lists the English Audiolessons AND other posts associated with taxonomy term English (articles, books and so on). How would I list only the Audiolessons? I realize I can code a Wordpress query for posts related to post type and taxonomy, however that will require a file for each combination.. I could create separate taxonomies for each post type, 'Audio-Language' for instance, then I could easily list them, but that doesn't seem right.. then what if I do want an option to list all English resources together. Should I create hierarchical taxonomies instead?.. I'm getting confused. Any help much appreciated.


Custom post type with custom fields enabled, is there a way to set a default group of fileds?

I defined the custom postype: property, like this               function register_cpt_property() {                  $labels = array(                  'name' => _x( 'properties', 'property' ),                 'singular_name' => _x( 'property', 'property' ),                 'add_new' => _x( 'Add New', 'property' ),                 'add_new_item' => _x( 'Add New property', 'property' ),                 'edit_item' => _x( 'Edit property', 'property' ),                 'new_item' => _x( 'New property', 'property' ),                 'view_item' => _x( 'View property', 'property' ),                 'search_items' => _x( 'Search properties', 'property' ),                 'not_found' => _x( 'No properties found', 'property' ),                 'not_found_in_trash' => _x( 'No properties found in Trash', 'property' ),                 'parent_item_colon' => _x( 'Parent property:', 'property' ),                 'menu_name' => _x( 'properties', 'property' ),             );                  $args = array(                  'labels' => $labels,                 'hierarchical' => false,                      'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'custom-fields' ),                 'taxonomies' => array( 'category', 'zone', 'rent' ),                 'public' => true,                 'show_ui' => true,                 'show_in_menu' => true,                           'show_in_nav_menus' => true,                 'publicly_queryable' => true,                 'exclude_from_search' => false,                 'has_archive' => true,                 'query_var' => true,                 'can_export' => true,                 'rewrite' => true,                 'capability_type' => 'post'             );                  register_post_type( 'property', $args );         }      The thing is that this generates this module: ![enter image description here](http://i.stack.imgur.com/bWBjM.png) Wich asks the user for wich custom fields to use, wich is great; but, is there a way to set a default group? Something that makes this module, initially, like this? ![enter image description here](http://i.stack.imgur.com/bh0Rr.png) ( I want to Do this so the user doesn't forget any of these.. But it's ok if he wants to add more) Is there a way to achieve this?


Recent Posts titles not working with Qtranslate

I am using a WordPress 3.8 installation with qtranslate, and everything is working except for the recent posts titles. Qtranslate displays the titles with all languages after each other. Like: _English title German title French title_ The code I am using to display a list with recent post titles is:               <?php     $recent_posts = wp_get_recent_posts();     foreach( $recent_posts as $recent ){         echo '
' .   $recent["post_title"].'
 ';     }     ?>      I have googled for this problem and it seems like Qtranslate does not work with `post_title`. How can I make it work?


Save time when posts has been favorited

I want to add the time when a user marked a post as favorite and want to display it.               function wpfp_add_favorite($post_id = "") {         if ( empty($post_id) ) $post_id = $_REQUEST['postid'];         if (wpfp_get_option('opt_only_registered') && !is_user_logged_in() )             wpfp_die_or_go(wpfp_get_option('text_only_registered') );              if (wpfp_do_add_to_list($post_id)) {             // added, now?             do_action('wpfp_after_add', $post_id);             if (wpfp_get_option('statics')) wpfp_update_post_meta($post_id, 1);             if (wpfp_get_option('added') == 'show remove link') {                 $str = wpfp_link(1, "remove", 0, array( 'post_id' => $post_id ) );                 wpfp_die_or_go($str);             } else {                 wpfp_die_or_go(wpfp_get_option('added'));             }         }     }          function wpfp_add_to_usermeta($post_id) {         $wpfp_favorites = wpfp_get_user_meta();         $wpfp_favorites[] = $post_id;         wpfp_update_user_meta($wpfp_favorites);         return true;     }      Is there something to do in it ?


Single Page for two custom post types

I have a child theme with two custom post types 'jazz clubs' and 'jazz festival'. I would like the single.php to either display different content dependent on whether the post is from jazz clubs or jazz festival. The problem is, how can I create this using single.php file. Have tried creating single-jazz-clubs.php and single-jazz-festival.php but the current single.php keeps loading the parent content. Actually I can `<?php get_template_part( 'content', 'club' ); ?>` from the single.php but is there a way of making sure it can show festival CPT, the post belongs to that post type. The current single.php look like this               get_header(); ?>
             <?php while ( have_posts() ) : the_post(); ?>                 <?php get_template_part( 'content', get_post_format() ); ?>s                                      <?php previous_post_link( '%link', '' . _x( '«', 'Previous post link', 'wpforge' ) . ' %title' ); ?>                     <?php next_post_link( '%link', '%title ' . _x( '»', 'Next post link', 'wpforge' ) . '' ); ?>                                       <?php comments_template( '', true ); ?>                  <?php endwhile; // end of the loop. ?>
      And here are my CPT's               function jazz_clubs() {          $labels = array(         'name'                => _x( 'Jazz Clubs', 'Post Type General Name', 'text_domain' ),         'singular_name'       => _x( 'Jazz Club', 'Post Type Singular Name', 'text_domain' ),         'menu_name'           => __( 'Jazz Clubs', 'text_domain' ),         'parent_item_colon'   => __( 'Parent Jazz Clubs:', 'text_domain' ),         'all_items'           => __( 'All Jazz Clubs', 'text_domain' ),         'view_item'           => __( 'View Jazz Clubs', 'text_domain' ),         'add_new_item'        => __( 'Add New Jazz Club', 'text_domain' ),         'add_new'             => __( 'New Jazz Club', 'text_domain' ),         'edit_item'           => __( 'Edit Jazz Club', 'text_domain' ),         'update_item'         => __( 'Update Jazz Club', 'text_domain' ),         'search_items'        => __( 'Search Jazz Club', 'text_domain' ),         'not_found'           => __( 'No jazz club found', 'text_domain' ),         'not_found_in_trash'  => __( 'No jazz clubs found in Trash', 'text_domain' ),     );     $args = array(         'label'               => __( 'jazz club', 'text_domain' ),         'description'         => __( 'Jazz Clubs around the world', 'text_domain' ),         'labels'              => $labels,         'supports'            => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'trackbacks', 'revisions','post-formats' ),         'taxonomies'          => array( 'region', 'country', 'city', 'state', 'post_tag' ),         'hierarchical'        => false,         'public'              => true,         'show_ui'             => true,         'show_in_menu'        => true,         'show_in_nav_menus'   => true,         'show_in_admin_bar'   => true,         'menu_position'       => 5,         'menu_icon'           => '/images/16-logo.png', // 16px16         'can_export'          => true,         'has_archive'         => true,         'exclude_from_search' => false,         'publicly_queryable'  => true,         'query_var'           => 'jazz clubs',         'capability_type'     => 'page',     );     register_post_type( 'jazz clubs', $args );      } add_action( 'init', 'jazz_clubs', 0 ); ?>               function jazz_festival() {          $labels = array(         'name'                => _x( 'Jazz Festivals', 'Post Type General Name', 'text_domain' ),         'singular_name'       => _x( 'Jazz Festival', 'Post Type Singular Name', 'text_domain' ),         'menu_name'           => __( 'Jazz Festivals', 'text_domain' ),         'parent_item_colon'   => __( 'Parent Jazz Festivals:', 'text_domain' ),         'all_items'           => __( 'All Jazz Festivals', 'text_domain' ),         'view_item'           => __( 'View Jazz Festivals', 'text_domain' ),         'add_new_item'        => __( 'Add New Jazz Festivals', 'text_domain' ),         'add_new'             => __( 'New Jazz Festival', 'text_domain' ),         'edit_item'           => __( 'Edit Jazz Festivals', 'text_domain' ),         'update_item'         => __( 'Update Jazz Festival', 'text_domain' ),         'search_items'        => __( 'Search Jazz Festival', 'text_domain' ),         'not_found'           => __( 'No jazz festivals found', 'text_domain' ),         'not_found_in_trash'  => __( 'No jazz festivals found in Trash', 'text_domain' ),     );     $args = array(         'label'               => __( 'jazz festival', 'text_domain' ),         'description'         => __( 'Jazz Festivals around the world', 'text_domain' ),         'labels'              => $labels,         'supports'            => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'trackbacks', 'revisions', 'post-formats', ),         'taxonomies'          => array( 'region', 'country', 'city', 'months', 'musicians', 'post_tag'),         'hierarchical'        => false,         'public'              => true,         'show_ui'             => true,         'show_in_menu'        => true,         'show_in_nav_menus'   => true,         'show_in_admin_bar'   => true,         'menu_position'       => 5,         'menu_icon'           => '/images/16-logo.png',         'can_export'          => true,         'has_archive'         => true,         'exclude_from_search' => false,         'publicly_queryable'  => true,         'query_var'           => 'jazz festival',         'capability_type'     => 'page',     );     register_post_type( 'jazz festival', $args );      } add_action( 'init', 'jazz_festival', 0 ); ?>


Can i use third party setting api to my plugin?

I am new in wordpress plugin development platform and i am trying to develop a plugin. I need a setting option for this plugin. I have made my decision to use this https://github.com/tareq1988/wordpress-settings-api-class . Is there any problem if i don't change the name of function of that setting api? So please tell me, can i use that without change the function name ?


Display list of tags as drop down menu or radio buttons in a meta box?

I would like to group posts of a custom post type based on tags, but the default functionality does not do for the project I am working on. I want the user to be able to select only one tag, not multiple tags, from a list of all the tags entered for that custom post type (drop down or radio buttons). The user can create as many tags as he wants from the page for adding a custom taxonomy, and all these tags will be listed in the meta box on the single custom post page. Any suggestion?


Editing a Post, 99% CPU?

I have a blog with ~15k posts, and a DB size of 14.4M. The website works blazingly fast from the front end, but post-edit and post- listing screens hang - either loading partially or not at all. Even worse, the entire server gets bogged down after trying... Examining the process manager showed that `/public_html/wp-admin/edit.php` or `/public_html/wp-admin/post.php` (post-listing and post-edit, respectively - yeah I know they seem backwards) was eating 99% CPU. I experienced this problem on a 3rd tier Bluehost VPS, so I upgraded to a Heart Internet Hybrid 250 (12core, 28gb ram) to try and mitigate the problem - no dice :/ Any help getting this resolved is greatly appreciated - telling clients they have to edit pages through phpMyAdmin is not an option :) Running MySQL processes:               Id      User    Host        db  Command     Time    State   Info          338     leech.. localhost   leech.. Sleep   1959            NULL     426     tmhp_.. localhost   tmhp_.. Sleep   581             NULL     433     root    localhost   NULL    Sleep   132             NULL     441     root    localhost   NULL    Query   0       NULL    SHOW PROCESSLIST      Process Example:               Pid     Owner   Priority    CPU %   Memory %    Command     29447   tmhp        0       99.8    0.6         /usr/bin/php /home/tmhp/public_html/wp-admin/edit.php      Edit: This might be pertinent: When on the add-new or post-edit pages the title loads and is editable, but the content editor loads halfway, additionally, the text appears but is white and only visible when highlighted... Also, using the 2012 theme with no plugins... Edit2: Given enough time (~3-5 minutes), the post-edit page will load fully and the process will terminate. This doesn't seem to happen with the post- listing page, however. Additionally, I've narrowed down the problem on the post-edit page to the page-attributes meta-box. As a short term remedy I've created a plugin which does the following:               //Remove some features of pages so editing is faster     if (is_admin()) :     function my_remove_meta_boxes() {         remove_meta_box('pageparentdiv', 'page', 'side');     }     add_action( 'admin_menu', 'my_remove_meta_boxes' );     endif;          function remove_page_attribute_support() {         remove_post_type_support('page','page-attributes');     }          add_action( 'init', 'remove_page_attribute_support' );               // Remove the Posts and Pages menus from the admin screen     function custom_admincss() {        echo '<style type="text/css">                #menu-pages{display:none !important}                #menu-posts{display:none !important}              </style>';     }          add_action('admin_head', 'custom_admincss');


Pages redirect me to the homepage

I am the admin of a multi Wordpress websites that are controlled from one Administration page. After updating to the latest version of Wordpress, 3.6.1, all of the pages are redirected to the to the homepage. Does anybody experienced this problem before? Thanks in advance


Displaying posts sorting by a custom criterion

I wish to display my posts, not according to the date, but to a completely custom criterion. Ideally, I would manually set a numerical value to each post and the WP loop would display posts according to this value. So if post X has value 1, post Y has value 2 and Z value 3, it would display first X, then Y, than Z, even though the date criterion would entail a different order. Hope it makes sense. How to achieve this?


How to display only same level taxonomies

Lets say I am inside custom taxonomy subtaxonomy. Viewing either archive.php or single.php page. I want to display there only subcategories what are same level as the one what I am looking. Now it will show me also other subcategories what are listed under another top level category. My current code is:               <?php                    $args=array(     'post_type'                => 'koogid',     'child_of'                 => 0,     'parent'                   => '',     'orderby'                  => 'name',     'order'                    => 'ASC',     'hide_empty'               => 1,     'hierarchical'             => 1,     'exclude'                  => '',     'include'                  => '',     'number'                   => '',     'taxonomy'                 => 'custom_cat',     'pad_counts'               => false     );          $categories=get_categories($args);                              foreach ( $categories as $category ) {          if ( $category->parent > 0 ) {     continue;     }           echo '
' . $category->name . '
';          $querystr = "SELECT $wpdb->posts.*                   FROM $wpdb->posts, $wpdb->term_relationships, $wpdb->terms                   WHERE term_id = (" . $category->cat_ID . ")                   AND term_taxonomy_id = (" . $category->term_taxonomy_id . ")                   AND ID = object_id                   AND post_type = 'biblioteka'                   AND post_status = 'publish'                   ORDER BY post_date DESC";               $categories2 = get_terms('custom_cat',array('parent' => $category->term_id , 'hide_empty'=> '0' ));                         foreach ( $categories2 as $category ) {          // echo '
' . $category->name  .'
';          echo '
name  . '" ' . '>' . $category->name.'
';          }     }


How to upload image and attach to Woocommerce product gallery?

I got the following code which takes and image, uploads it to my server and sets it as a featured image. How can i change it so it adds the image to the product gallery in Woocommerce? Maybe something like generating and attaching metadata?               function postmeta_img_update($postid, $img ) {     global $post;     require_once(ABSPATH . 'wp-includes/pluggable.php');      // If Custom Post Meta Field for a Image/Thumnail NOT Exists     if( !get_post_meta($postid, "skipimage", true) ): // if meta exists then skip          // Get File Extention     $ext = substr(strrchr($img,'.'),1);          // WordPress Upload Directory to Copy to (must be CHMOD to 777)     $uploads = wp_upload_dir();     $copydir = $uploads['path']."/";          // Code to Copy Image to WordPress Upload Directory (Server Must Support     file_get_content/fopen/fputs)     $data = file_get_contents($img);     $filetitle = strtolower(str_replace(array(' ', '-', '.', '(', ')', '!', '@', '#', '$', '%', '^', '&', '*', '_', '=', '+'), "-", get_the_title()));     $file = fopen($copydir . "$filetitle-$postid.$ext", "w+");     fputs($file, $data);     fclose($file);          // Insert Image to WordPress Media Libarby     $filepath = $uploads['path']."/$filetitle-$post->ID.$ext";          $wp_filetype = wp_check_filetype(basename($filepath), null );     $attachment = array(          'post_mime_type' => $wp_filetype['type'],          'post_title' => get_the_title(),          'post_content' => 'Image for '.get_the_title(),          'post_status' => 'inherit'             );          wp_insert_attachment( $attachment, $filepath, $postid);          // Get Attachment ID for Post     global $wpdb; $attachment_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_parent = '$postid' AND post_status = 'inherit' AND post_type='attachment' ORDER BY post_date DESC LIMIT 1");     // Attached Image as Featured Thumbnail in Post     update_post_meta($postid, "_thumbnail_id", $attachment_id);          endif;          }


Pagination issue for pages with multiple categories

I want to display in a page posts from multiple categories, but it doesn't paginate.               $extra_posts = new WP_Query( 'cat=5,7,24&posts_per_page=3&orderby=date' );     if ( $extra_posts->have_posts() )     {         while( $extra_posts->have_posts() )         {             $extra_posts->the_post();     //does something              }          }         ?>
<?php next_posts_link('« Newer articles') ?>

<?php previous_posts_link('older articles »') ?>
      Only three posts are shown and no pagination.


Create advanced/editable wordpress profile page on the frontend

I'm spending days and days traying to code a frontend user profile page where logged-in users can edit their data, but seems there is no right way to do that. Nobody on web seems to explain a secure and good-coded method without using plugins. So, I created a file called profile-page.php               <?php          /*     * Template Name: User Profile     * Allow users to update their profiles from Frontend.     */               global $current_user, $wp_roles;     get_currentuserinfo();                    /* Someone do not use global variable        but this code: (which one is better?)             require_once( ABSPATH . 'wp-admin/includes/user.php' );        require_once( ABSPATH . 'wp-admin/includes/misc.php' );        define( 'IS_PROFILE_PAGE', true );        wp_enqueue_script( 'user-profile' );        $current_user = wp_get_current_user();     */                              if ( 'POST' == $_SERVER['REQUEST_METHOD'] ) {                  check_admin_referer( 'update-user_' . $current_user->ID );                  if ( ! current_user_can( 'edit_user', $current_user->ID ) )        wp_die( __( 'Error Message' ) );                  $errors = edit_user( $current_user->ID );             // Save        if ( ! is_wp_error( $errors ) ) {                $message = __( 'Success: Profile updated', '' );           $style = 'success';                do_action( 'personal_options_update', $current_user->ID ); // Save all data in db           wp_redirect( get_permalink() );                exit;             // Error        } else {                $message = $errors->get_error_message();           $style = 'error';             }     }               get_header();          ?>
                           <?php if ( !is_user_logged_in() ) : ?>
             <?php _e('You must log in to edit.', 'textdomain'); ?>
       <?php else : ?>       <?php echo '
Welcome '. $current_user->first_name .'
'; ?>                         <?php     if ( isset( $message ) ) {        echo '
' . $message . '
';     } ?>                         <form class="" action="<?php the_permalink(); ?>" method="post" id="your-profile">                        <?php wp_nonce_field( 'update-user_' . $current_user->ID ); ?>              <input type="hidden" name="from" value="profile" />         <input type="hidden" name="checkuser_id" value="<?php echo $current_user->ID; ?>" />                                           <input type="text" name="first_name" id="input_01" value="<?php echo esc_attr( get_the_author_meta( 'first_name', $user->ID ) ); ?>" />                             <input type="hidden" name="action" value="profile" />         <input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr( $current_user->ID ); ?>" />              <input type="submit" class="button-primary" value="<?php esc_attr_e( 'Save' ); ?>" name="submit" />                    </form>
               <?php get_sidebar(); ?>     <?php get_footer(); ?>      What do you think about it? Is it the right way? Is security check right? It not work! Please help me! Thanks


Get log of function/method calls made by do_action() on WordPress initialization

Is there any way I can get a log of the method calls that are made when `do_action( 'init')` is fired?


Query_post does not get the post_content

When I use before a loop                 query_posts( '%cat=4');      I get everything, including the post_content field, but when I use the code from here: http://codex.wordpress.org/Function_Reference/query_posts which says I can preserve the query so I can add more restrictions (in this case, a date restriction), I get everything but I do not get the post_content field. This seems odd since the function is supposed to preserve the original function.                $today = getdate();      global $wp_query;      $args = array_merge( $wp_query->query_vars, array('cat'=>4, 'order' => 'ASC'    ,'date_query'   => array(         array(             'year'      => $today["year"],             'month'     => $today["mon"],             'day'       => $today["mday"],             'compare'   => '>=',         )     )));      query_posts( $args );      Any ideas what is going on here? Thanks


Display the nav menu for a particular page id

Say that I have the id of a page that is in the wp_nav_menu() I would like to show the wp_nav_menu() for that particular page. Is that possible? I can use wp_get_nav_menu_items() to get all items for a particular page but then I have to create the html output, submenu structures etc.


JQuery not working in my plugin

This is my first time using JQuery in a WordPress plugin, and I'm having some trouble. Here is my "main" plugin document:               <?php          /*         Plugin Name: Dump-It Scheduler         Plugin URI:          Description:Description         Version: 1.0         Author: Blaine Anderson         Author URI: http://www.blainevanderson.net         License:           */          add_action( 'wp_enqueue_script', 'load_jquery' );     add_action('wp_register_script', 'register_script');     add_action('wp_enqueue_script', 'run_js_script');     add_action('admin_menu', 'add_master_schedule');      add_action('admin_menu', 'add_customer_search');      add_action('admin_menu', 'add_edit_trucks');     add_action('admin_menu', 'add_new_customer');           //Add master schedule link to Admin bar in WP     function add_master_schedule()     {         add_menu_page('Master Schedule', 'Master Schedule', 'administrator', 'Master_Dump-it_Schedule', 'display_menu');      }          //Display the master schedule when link is clicked     function display_menu()     {         include( plugin_dir_path( __FILE__ ) . '/Views/admin_main_display.php');     }          //Add customer search link to admin bar     function add_customer_search()     {         add_menu_page('Customer Search', 'Customer Search', 'administrator', 'Customer_Search', 'display_customer_search');     }          //Display customer search page     function display_customer_search()     {         include( plugin_dir_path( __FILE__ ) . '/Views/search_customer.php');     }          //Add edit trucks link to admin bar     function add_edit_trucks()     {         add_menu_page('Edit Trucks', 'Edit Trucks', 'administrator', 'Display_Edit_Trucks', 'display_edit_trucks');     }          //Display edit trucks page when link is clicked.     function display_edit_trucks()     {         include( plugin_dir_path( __FILE__ ) . '/Views/edit_trucks.php');     }          //Add 'add customer' link to admin bar     function add_new_customer()     {         add_submenu_page('Customer_Search', 'Add Customer', 'Add Customer', 'administrator', 'Add_Customer', 'display_add_customer');     }          //Display add customer page when link is clicked.     function display_add_customer()     {         include(plugin_dir_path(__FILE__) . '/Views/add_customer.php');      }          //Load jquery into plugin     function load_jquery()      {         wp_enqueue_script( 'jquery' );     }          function run_js_script()     {         wp_enqueue_script('my_plugin_script');      }     function register_script()     {         wp_register_script( 'my_plugin_script', plugins_url('/js/scheduler.js', __FILE__), array('jquery'), '1.0', false);     }     ?>      Here is my Javascript that simply displays an alert (scheduler.js):               jQuery(document).ready(function($){         alert("Hello World!");     });      I'm wondering why the alert isn't showing up. I've also tried to add the `wp_enqueue_script` to the `HTML` file, which looks like this:               <?php     wp_enqueue_script( 'my_plugin_script' );     ?>

             Master Schedule | Create Truck Routes | Customer Search | Edit Trucks | Add Customer | CMS Login |

      I'm very new to WordPress and any direction or help would be appreciated. If you need any other code, please let me know, but that is most of it. The only other code I have is the views for the other links.


How to install plugin only from PHP file?

I have a plugin for Thesis that fixes issues with Wish List Member. The plug is called thesis-wlm. It only has a box.php file. I uploaded thesis-wlm.zip as a plugin and Wordpress attempted to install it but failed. I then added the thesis-wlm folder, which contains the box.php file, to the plugins folder but nothing shows up in the plugins section. There is a plugin header that follows this format:               Name:      Author:      Description:      Version:      Class:      License:      Is there some other way to activate this plugin?


Disable author admin just use name.

I have a WPMU installation where I am super admin and im developing my blog there for my team. When I click on my name on the post, to show all my post its redirecting me to /blog/author/admin instead of /blog/author/myname. I never registered a account with the name Admin. Is it possible to just show the name of the user like with all the other not admins.


How do I add and display a custom image field to a category? I know I need to use the hook 'category_add_form_fields' however I am not quite sure how... I am relatively new to wordpress so any help is greatly appreciated!


How to modifiy All in one event calendar shortcode?

I am using All-in-one-event-calendar plugin in word-press for events. In my theme file i have added.               <?php echo do_shortcode('[ai1ec view="monthly"]')?>  //for calendar      Can i add modify plugin calendar query based on another attributes.               <?php echo do_shortcode('[ai1ec view="monthly" university_id="1,2"]')?>       In admin **Add event section** , i have added meta box with university select box and saving university in post meta table for a event. how Can i add modify short-code query. Please suggest me any solution,


Media uploads not correctly shown

I recently moved my website from a subdomain to the domain after development - then I got this problem: When I upload new images in the media uploader, they are not being correctly showed. ![enter image description here](http://i.stack.imgur.com/JgTPt.png) Do anyone have a fix for that?


Using meta query ('meta_query') with a search query ('s')

Trying to build a search that not only searches the defaults (title, content etc) but also a specific custom field. My current query:               $args = array(       'post_type' => 'post',       's' => $query,       'meta_query' => array(          array(            'key' => 'speel',            'value' => $query,            'compare' => 'LIKE'          )        )     );          $search = new WP_Query( $args )     ...      This returns posts which match both the search query AND the meta query, but I would also like it to also return posts where it simply matches either one of them. Any ideas?


Display empty taxonomy terms with get_terms()

I have a function setup as follows:               <?php $terms = get_terms("wpsc_product_category");      if ( !empty( $terms ) && !is_wp_error( $terms ) ){          foreach ( $terms as $term ) { ?>             <li class="calendar-filter-menu-item" data-filter=".<?php echo $term->slug; ?>"><?php echo $term->count; ?>
         <?php }      } ?>         Which displays the taxonomy `slug` and `count` for each taxonomy, only problem is it's not showing a taxonomy that has no posts in, only taxonomies with posts assigned to them are being show, is it possible to show empty taxonomies as well?


Convert User ID's to User Names in a single.php file

I have a post_meta "thevoters" that store users ids like: 1,2,20 ...etc, How i can turn this id's to User Names to list them in a single page? This will echo the numbers as text,               echo get_post_meta(get_the_ID(), "thevoters", true);      any help?   thanks a lot!


max_num_pages says 4, yet I am only able to navigate to the third page

**Current query:**               if ( get_query_var('paged') ) { $paged = get_query_var('paged'); } else if ( get_query_var('page') ) {$paged = get_query_var('page'); } else {$paged = 1; }          $args_main = array(         'cat'               => $my_categories_variable,         'posts_per_page'    => 3,         'paged'             => $paged     );          $main_posts_query = new WP_Query($args_main);     while($main_posts_query->have_posts()) : $main_posts_query->the_post();      **Problem:** Echoing `echo $main_posts_query->max_num_pages;` gives me **4** , yet I am only able to navigate (via `get_next_posts_link()`) to www.mywebsite.com/page/ **3** /. Am I missing something? Please do let me know if you need more information. Thank you!


Custom Post Type children and grand-children in one list

So, here is the story: i made a product catalogue with 3 custom post types:                - Product         - Filegroup (Child of Product)             - File (Child of Filegroup)      When on product page it should show a list with the Filegroup title and the loose files under the correct Filegroup. But it shows the children at both parents It's like this now:               - Filegroup 1         - File 3 (child of Filegroup 2)         - File 1 (child of Filegroup 1)         - File 2 (child of Filegroup 1)          - Filegroup 2         - File 3 (child of Filegroup 2)         - File 1 (child of Filegroup 1)         - File 2 (child of Filegroup 1)      And it needs to be:               - Filegroup 1         - File 1 (child of Filegroup 1)         - File 2 (child of Filegroup 1)          - Filegroup 2         - File 3 (child of Filegroup 2)      My current script               <?php          $childargs = array(         'post_type' => 'filegroup',         'numberposts' => -1,         'order' => 'ASC',         );         $child_posts = get_posts($childargs);              foreach ($child_posts as $child_post){         $parentid = $child_post->ID;             ?>

<?php echo $child_post->post_title; ?>
                         <?php                             $childargs2 = array(                             'post_type' => 'file',                             'numberposts' => -1,                             'post_parent' => '0'                             );                             $child_posts2 = get_posts($childargs2);                                  foreach ($child_posts2 as $child_post){                             ?>
<?php echo $child_post->post_title; ?>
                             <?php                             }                         ?>
                  <?php         }     ?>


Detecting if parent page has gallery

My function to detect is a gallery is on a page has broken and Im not sure why. So in my theme template's attachment page Im calling this function:               global $post;          $parent_id = $post->post_parent;          if ( strpos(get_post($parent_id)->post_content,'[gallery ') == false ){         $navigation_markup = 'no gallery';     }else{ $navigation_markup = 'theres a gallery!' }      It USED to work, but last night I noticed that it stopped and I'm not sure why. if the only (or first) thing in a post/page is `[gallery id="1,2,3,4,5"]` my function fails. However, if I add a space, or any character really it passes and detects the gallery. So something about `[gallery` being in the very first position returns false.


Add span to the first letter of post

Example post
Lorem ipsum dolor sit amet

Morbi elementum odio vel tortor adipiscing vel tempor risus ullamcorper.
      What I have done :               function first_paragraph($content){         return preg_replace('/
]+)?>/', '
', $content, 1);     }     add_filter('the_content', 'first_paragraph');      Which will have different `class` for first paragraph Now I want add `<span class="first-letter">L</span>` and result should be like
Lorem ipsum dolor sit amet

Morbi elementum odio vel tortor adipiscing vel tempor risus ullamcorper.
      Let me know * * * **Update:** I got it worked but not a perfect solution.               function first_paragraph($content){         $content = substr_replace($content, '', 4, 0);         $content = substr_replace($content, '', 3, 0);         $content = preg_replace('/
]+)?>/', '
', $content, 1);      return $content;     }     add_filter('the_content', 'first_paragraph');


How to create a multiple choice radio group for a single theme option

Logically, I'm thinking it should something like...               <input type="radio" id="my_category_layout">         <option value="Item1">Item 1</option>         <option value="Item2">Item 2</option>         <option value="Item3">Item 3</option>     </input>      But from what i've seen radio buttons dont markup like that. My existing code is below that creates a select list pulldown menu that allows me to capture a selected value. I'm struggling with how to convert this into a radio group. The main issue is that there is only one ID to represent the select, but I can't figure how to create three radio buttons with a single ID value that can be passed to represent the selected button. How would I do that? Here's my existing code for creating a select with a single id and multiple values...               <?php     $mySelectOptions = array("list" => "List View", "grid1" => "Grid View Multi Column", "grid2" => "Grid View Two Column");          array(  "name" => "Category Layout",          "desc" => "description goes here",          "id" => "my_category_layout",          "type" => "select",         "options" => $mySelectOptions ),     ?>     <form method="post">          <?php foreach ($options as $value)      {         switch ( $value['type'] )          {         case "select":         ?>         <select class="input" name="<?php echo $value['id']; ?>" id="<?php echo $value['id']; ?>">         <?php foreach ($value['options'] as $option) { ?>             <option<?php if ( get_settings( $value['id'] ) == $option) { echo ' selected="selected"';             }              elseif ($option == $value['std'])              {              echo ' selected="selected"';              } ?> value='<?php echo $option; ?>'>             <?php echo $option; ?></option><?php } ?>         </select>     <?php     break;     case "radio":     ?>


Can you install / activate the multisite when the install is in a subfolder?

I have _primarydomain.com_ and an _addondomain.com_ _addondomain.com_ points to _primarydomain.com/addondomain_ I have installed 2 seperate installs of wordpress on _primarydomain.com_ and _primarydomain.com/addondomain_ Can I activate multisite on _primarydomain.com/addondomain_ as _addondomain.com_? My reason for this is these are two separate sites with two separate functions, so I wanted to use separate databases. Is this possible?


Wordpress disable 'Install Themes' tab

Can someone help me disable the `Install Themes` link from the WordPress back- end?


Default Image Link Removal

Just wondering if there is a way to remove WordPress's default function of adding a tag around an inserted image. I assume its a "remove_filter" function like you can do for WPAutoP, but all my searches only turned up links for gallery plugins, etc. Thanks in advance, Pete


How to add a strip of visual editor on top of comments textarea

My blog is WP3.1.2, theme: Twenty Ten I would like to add a strip of visual editor on top of the comments box (something like you see at the top of question box on this site). How can I do it WITHOUT PLUGINS? I have searched this site and the WP forums, but could not find something I could use. Although WP displays html tags beneath the comments box that people can use to style their comments. But not everybody is fimiliar with them and how to use them. So instead I woild like to display a strip of tags for people to use easily. Simple to follow instructions please. Thanks.


Different post format options per custom post type?

I want to add post formats for each post type. For example, I have a post type 'Gallery'. I want to add 'images', 'galleries' and 'videos' in this post. In normal posts I want to use another list of post formats. I try:               function postf()     {         global $post_ID;              $postType = get_post_type( $post_ID );              if( $_GET['post_type'] || $postType == 'gallery-custompost' )         {             add_theme_support( 'post-formats', array( 'image', 'gallery', 'video' ) );             add_post_type_support( 'gallery-custompost', 'post-formats' );         }     }     add_action('init', 'postf');      When I add a new post, it works, but when I try to edit it, the post format does not appear. Does anyone have any idea how I must do it?


Can't add text in front of shortcode

Currently I'm using this shortcode within a post http://pastebin.com/K7WC2Lk3 which works great, but somehow I can't add any text in front of this shortcode, without posting it the other way around. In example some dummy text [etalage] will always be shown as [etalage] some dummy text I've read to gather the value into a variable and return it, but I have to admit, I'm not entirely sure how to accomplish this best


Custom Portfolio Page

I've a page (at /portfolio) & nav item created called Portfolio. What I'd like is for this page to either contain all the portfolio category's post in chronologically order or else all of the portfolio posts organized by portfolio subcategories (and then chronologically within). What's the easiest way to achieve this?


Loading WP core Thickbox through frontend

Looking through some of the top Google results, this question has been answered a number of times, but the answers given don't seem to be working in my WP 3.6 install. One solution given is this:               function my_thickbox() {        if (!is_admin()) {           wp_enqueue_script('thickbox', null,  array('jquery'), true);           wp_enqueue_style('thickbox.css', includes_url('/js/thickbox/thickbox.css'), null, '1.0');        }     }     add_action('init', 'my_thickbox');      Another was this: `add_action( 'wp_enqueue_scripts', 'add_thickbox' )`. I've also tried using this `add_thickbox()` with no success. All of these approaches seem to successfully load `thickbox.css`, but no JS file is showing up. I can manually go and include the path to `thickbox.js`, but that seems less desirable given that all of this seems to be handled by the core in `script-loader.php`.


Hide Menu items base on capability

What is the best way to add/remove items for the `wp_nav_menu()` based on user roles? For instance a custom menu that looks like:   * Some Page    * Some Other Page    * Special Admin Page Where the `Special Admin Page` should only be visible for admin users. Is this best done with `wp_nav_menu_items` filter or do I need a custom Walker? This is a possible duplicate of: Hide menu items for visitors and filter based on role but that doesn't appear to have been completely solved. Though it does mention a tutorial about a custom Walker that seems relevant. **EDIT:** Based on Toscho's answer and How to add a custom field in the advanced menu properties? I combined the two to form my own plugin Nav Menu Roles Fair warning that I cannot vouch for its speed and I am relatively certain that it will not work _with_ another custom Walker, but it was a one-day plugin.


Uploading a external squeeze page within WP

I'm not a developer but I'm trying to find my own way around and learning as I go along. I have a prebuild squeeze page and trying to FTP it to my site but I have learned that I don't have access to the CPanel which basically stop me from using any FTP clients. Long story short, I need to upload this squeeze page onto my site and I have no clue how to do that without FTP. I know WP is very flexible due to the numerous plug-ins so I believe there should be away to do so within WP. Is there a way in for me? The longer I wait, the more I'm losing out and it is delaying my Blog post which is dependent on this page. Please assist... Regards Ghost


Show a confirm message before plug-in activation

I want to display a message when the user try to activate my plugin. This message will ask if him really wants to activate the plugin or, if him change his mind, cancel the activation. How can I accomplish that? This is the code for the warning message just for reference. \--- UPDATED CODE ---               register_activation_hook( __FILE__, 'on_activation' );          function on_activation() {        // Add the admin notice:        add_action( 'admin_notices', 'on_activation_note' );             // Then you should check the DB option:         $plugins = get_option( 'active_plugins' );             // Do all the checks from the confirmation message        if ( !in_array(__FILE__, $plugins) ) {        unset( $plugins[ dirname( __FILE__ ) ] );        update_option( 'active_plugins', $plugins );        }     }          function on_activation_note() {     global $pagenow;     if ( $pagenow == 'plugins.php' ) {         ob_start(); ?>

Aviso
         Nulla vitae elit libero, a pharetra augue. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

Cancelar         Continuar

         <?php         echo ob_get_clean();         }     }


Uploading Images for a section

I am looking for some help with a problem please. I am building a site for a friend who is a travel writer. She has loads of images she has taken over the last few years. Here is the question, we have over 4000 images which can be broken down into areas, but what I want to be able to do is upload the images to an area (category/taxonomy), so that when she goes on her travels again this year, she can upload images just to that section and when she does the post back at her hotel only see the images to that area in the Media upload / add media? I have looked at a number of plugins but nothing seems to do it, and I really don't want to make changes to the core files of WordPress with the updates that are coming down the line this year. Any thoughts would be helpful Kind regards John


Notice: Trying to get property of non-object in options.php

I am generating the following notice in my options.php when testing my theme in wp_debug mode. I can see where the problem is but do not know how to fix this issue? It seems the non object is being called from the taxonomy array in options.php as the array cannot find the term_id because a post and or category has not been created in the custom post type. When I create a post and assign a category to it, the notice disappears.               // Pull all the custom taxonomies into an array     $options_password_taxonomies = array();     $taxonomies_password_terms_obj = get_terms('password_gallery_category');     foreach ( $taxonomies_password_terms_obj as $taxonomy) {         $options_password_taxonomies[$taxonomy->term_id] = $taxonomy->name;     }          // Select a Category for your Client Area     $options[] = array(         'name' => __('Password Protected Galleries', 'shutter'),         'desc' => __('Choose a category for password protected client galleries.',     'shutter'),         'id' => 'client_area',         'type' => 'select',         'options' => $options_password_taxonomies);


How to create posts with a specific date in bulk

I need to import posts with a specific date. They way I am doing it now is I import as draft, then I use php to publish, then use php to change the date. The problem is that if I make a mistake in the last step it is difficult to undo. Is there any other way to create posts at a specific date while having an interim state like draft and then publishing? Can I use some of the other post status like 'pending'


Display posts with comments closed, with pagination?

i'm using a custom query, which needs to display all posts with closed comments. I have this               <?php $the_query = new WP_Query('showposts=-1'); ?>     <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>          <?php if (!comments_open()) : ?>     //some posts fomatting     <?php endif; ?>          <?php endwhile;?>      So, basically, this loops through all posts, and then displays only the ones with the closed comments. It works, but i want to introduce the pagination to it. If i say posts_per_page instead of showposts, it doesn't work. Any help would be appreciated :).


Providing a function to override the default query

In a plugin, I want to provide a function for users to set the default query in their templates, so they can use some custom loops. What would be the best way of doing it? I imagine something like this:               my_plugin_set_query();     if ( have_posts() ) {         while ( have_posts() ) {             the_post();             ... iteration through a predefined post set ...         }     }


get_categories for custom post type with a specific custom taxonomy attached

Basically I have a custom post type of 'products' which has two taxonomies attached to it...the normal 'category' and a custom taxonomy called 'brands'. I have a page which is 'brand' specific. On this page I'd like to list all the 'categories' that have a 'product' in them with a term of the 'brand' whos page I'm on attached. Eg. say I'm on the "Nike" page. I want it to list all categories that have a 'product' in them with the 'brand' of "Nike" attached to them. My initial thoughts are to use get_categories but theres now way to define a specific taxonomy or 'brand'?               $categories = get_categories('orderby=name&depth=1&hide_empty=0&child_of='.$cat);      Anyone done this before or knows a way to query the database directly to get the required results? Any help is much appreicated, Thanks


How do you auto-activate plugins from child themes

(repost from Theme Hybrid Community) Let's assume a plugin or multiple-plugins are hosted on WordPress.org. Can you automatically activate plugins with the functions.php of a child theme? Is there any problem with doing such a thing? What's the best way to add plugin functionality to a child theme?


How to make link to different categories that in them selves loads different menus?

Im kinda a noob but have made some homepages for fun but got this new one that im making for a friend that´s stopped my dead in my tracks: http://yellowknife.se/artfex/ The popup (ugly as hell and will be changed into images) gives the visitor the option of three different types of products to view. I need help with how to make a custom menu load when each of these three categories are clicked. I´ve googled but didnt get to far, to little codeexperience keeps me from getting it. Anyone got any thoughts? Thanks! Dave Sweden


How to remove title attribute from gallery links and images

I want to remove the title attribute from within the output of a [gallery] shortcode e.g.                                  should be:                                  I've a feeling this has something to do with the wp_get_attachment_link function.


taxonomies or categories w/custom post

We are creating a custom post type to showcase a series of archival recordings. They will cover many topics, and be tagged with ideas/phrases from the talks, similar to a regular post. Is it better to create custom taxonomies such as--for example--topics and themes in place of categories and tags, or does it make any difference? Also, the individual recordings need to be marked w/info such as date recorded, length of recording(s) etc., but this is info that doesn't necessarily need to be searchable. Is it 'better form' (for lack of a way to explain) to create custom taxonomies for these bits of info, or just add them to the description meta box? thanks for your help.. Don


How can I customize the size of the header of my theme?

I want to change the size of my header using the Sparkling theme. In functions.php, right below this:               /**      * Implement the Custom Header feature.      */      I added this:               add_theme_support( 'custom-header' );      Below that I pasted this from custom-header.php:               function sparkling_custom_header_setup() {           add_theme_support(              'custom-header',              apply_filters(                  'sparkling_custom_header_args',                  array(                       'default-image'          => '',                       'default-text-color'     => 'dadada',                       'width'                  => 300,                        'height'                 => 76,                        'flex-height'            => true,                       'flex-width'             => true,                       'wp-head-callback'       => 'sparkling_header_style',                       'admin-head-callback'    => 'sparkling_admin_header_style',                       'admin-preview-callback' => 'sparkling_admin_header_image',                   )              )          );     }      But customizing the width and height did nothing. I also tried setting up a "flexible header" and pasted a different array template into functions.php along with this in header.php:               <img src="<?php header_image(); ?>" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" alt="" />      The latter lines I tried in various locations/permutations, as a substitute for some very similar looking code already within header.php, and in addition to that code. Still nothing.


How to do big modifications to live site?

How do you make large site wide modifications to your live site without bringing it down? I don't have a team of web designers and will be doing this solo. But still need to keep the site up and running. I'm implementing some changes to the current responsive web design. Some changes will cascade across the site and I'm not entirely sure where all of them might occur. Whole sections of the site might be deformed but I won't immediately know. I don't want to get into a situation where there are too many broken areas and I can't keep up. I don't have git or a cloud server. I use FTP to move anything or edit the theme through the WP admin area. How do other solos handle this type of situation?


Pagination works in custom query loop but it doesn't work in shortcode

It is possible for shortcodes? Paggination works fine on custom template page.But I want to display the posts with shortcodes. Posts are displayed well.But pagination works incorrectly.The same posts on all pages. My custom query loop in page template:               $page = (get_query_var('paged')) ? get_query_var('paged') : 1;               $args = array(         'posts_per_page' =>'1',          'orderby' => 'post_date',         'paged' => $paged,         'post_type' => 'accomodation',         'tax_query' => array(             'relation' => 'AND',             array(                 'taxonomy' => 'accomodation_category',                 'field' => 'slug',                 'terms' => 'gostinnitsy-2'             ),             array(                 'taxonomy' => 'location',                 'field' => 'slug',                 'terms' => 'litva'             )         )     );     $custom_query = new WP_Query( $args );     // Pagination fix     $temp_query = $wp_query;     $wp_query   = NULL;     $wp_query   = $custom_query;          ?>                  have_posts() ) :         while ($custom_query-> have_posts() ) :             $custom_query->the_post();?>                                                                    max_num_pages );               $wp_query = NULL;     $wp_query = $temp_query;?>           And my shortcode in function.php                    function accomodation_catalog_shortcode( $atts )     {     extract(shortcode_atts(array(          'accomodation' => '',          'location'     => '',          'number'       =>'-1',          'orderby'      => 'post_date'        ), $atts));         $page = (get_query_var('paged')) ? get_query_var('paged') : 1;            global $post;             $args = array(         'posts_per_page' =>$number,          'orderby' => $orderby,         'paged' => $paged,         'post_type' => 'accomodation',         'tax_query' => array(             'relation' => 'AND',             array(                 'taxonomy' => 'accomodation_category',                 'field' => 'slug',                 'terms' => $accomodation             ),             array(                 'taxonomy' => 'location',                 'field' => 'slug',                 'terms' => $location             )         )     );     $custom_query = new WP_Query( $args );     // Pagination fix     $temp_query = $wp_query;     $wp_query   = NULL;     $wp_query   = $custom_query;          ?>                  have_posts() ) :         while ($custom_query-> have_posts() ) :             $custom_query->the_post();?>                                                                    max_num_pages );               $wp_query = NULL;     $wp_query = $temp_query;?>                                  I corrected the error:'paged' => $page,     and pagination work!                              But why when I want to display shortcode content under page content, shortcode content are displayed above page content?                              In admin:                                   <p>page content<p>     [ accomodation-catalog location='slug ' accomodation='slug']      display `<div>shortcode content</div> <p>page content<p> ` What is wrong?


password protected custom content type

I have created a custom content type called 'clients'. When I create an individual 'client' page I can add a password with visibility/password on the right hand side The clinet pages have a taxonomy/permalink of 'clients' so a url is mysite.com/clients/client1 However if a user typed in mysite.com/clients they would see a list of all the client custom posts. Is there a way of password protecting this or preventing users from seeing it, as clients should only be able to see their own page. Even though they are password protected it doesnt look neat that they can see a list of other clinets


How can i count the images that are atacht to NextGEN Gallery

How can i count images form NextGen Gallery, the NextGen Gallery is insite a custom field. Custom field for NextGen Gallery is " poze " I search for it, i found this NextGen - Display Image Count Per Gallery               <?php      global $wpdb;      $images = intval( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures WHERE galleryid = {$gallery->ID}") ); ?>      <?php echo $images; ?>      This code it display me the 0 count of pictures... Mode 2 wath i try                 <?php              global $wpdb;              $images = intval( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->nggpictures") ); ?>              <?php echo $images; ?>      This code it display me the all pictures of galery's... Mode 3 wath i try               <?php $related_posts = get_field('poze');$count = 0;if( !empty($related_posts) ){$count = count( $related_posts ); }echo $count; ?>      This code is retriving me the number of galerry's How can i retrive the number pof pictures atached to that gallery... Ex: 12 pictures How can i add the custom field (poze - where ID is stored) ... anny solution woud be apreciate.


How to load wp_editor() through AJAX/jQuery

I have a theme that is custom developed and really complex. One of the things that I have is multiple content areas where users can specify content for specific tabs. I load multiple instances of the WordPress editor through the `wp_editor()` function. It works perfectly. (This is all on the admin side, in the "Page" post type) However, I began making a few improvements, including the ability to add/remove tabs dynamically (before, I loaded 6 editors on the page). Users may have 1-7 tabs. When users add a tab, it needs to add an instance of the editor to the page. However, no matter what I try, I cannot get it to load and display correctly. Here are the 2 things that I have tried so far:   1. Create a php file that has the admin bootstrap included, and then loading the editor with `wp_editor()`. I then do a jQuery `$.load` to call the page and include the resulting HTML in the area that it needs to display. This doesn't really work, however, as the editors formatting buttons disappear (it's worth noting, that pulling the page up directly, the editor displays and functions perfectly)   2. Loaded the editor on the page, inside a hidden div, and then once a tab is added, use jquery to move it into place. This loads the editor in tact, but you cannot use any of the editor buttons (they display, but don't do anything), and you can't put your cursor in the text area (curious, however, that switching to HTML mode allows typing and some interaction with the HTML mode buttons) So the question is, has anyone had any luck adding editors through AJAX calls? Any advice?


How to load wp_editor via AJAX

Does anyone know how o load wp_editor via AJAX in WordPress? My markup and editor is getting loaded properly but editor controls are not getting loaded properly, it may be because Javascript is not running in AJAX call. Any help would be appreciated.


problem when adding wp_editor with ajax

I have a problems with wp_editor() . Somewhere in my plugin, i want to dynamically add fields some are basic input, and there is also an editor. I use ajax to add these fields, and all is going as planned except for the editor fields throwing the error : " _Uncaught TypeError: Cannot read property 'canvas' of undefined_ " Is there any specific way dealing with wp_editor in ajax request or am i missing something ? **php side :**               add_action( 'wp_ajax_add_new_proposition_callback', array(&$this, 'add_new_proposition_callback') );          public function poll_manage()     {         $nb_prop = 0;         <form method="post">

         <input type="button" value="Ajouter une proposition" class="button" id="addnewprop" />         <input type="hidden" name="nbprop" id="nbprop" value="<?php echo ($nb_prop+1) ?>" />         </form>     }          public function add_new_proposition_callback()     {         $prop_id = isset($_POST['prop_id']) ? (int)$_POST['prop_id'] : 1;         echo '

'.$prop_id.' : New proposition

Proposition         <input type="text" id="propo'.$prop_id.'" name="propo'.$prop_id.'" class="thepropo" size="60" value="" />

Description';         wp_editor( '', 'descrq'.$prop_id, array('teeny'=>true, 'editor_class'=>'thepropoc') );         echo $content.'

Answer

<input type="radio" class="open" name="open'.$prop_id.'" value="1"  /> yes

<input type="radio" class="open" name="open'.$prop_id.'" value="0"  /> no

         ';         die();     }      **js side :**               ...         $('#addnewprop').click(function(){             var params = {                 "action": "add_new_proposition_callback",//callback function                 "prop_id": $('#nbprop').val()             };             $.ajax({                 data: params,                 type: 'POST',                 url: php_data.ajax_url,                 success: function(data, status) {                     onSuccessAddNewProposition(data);                 }             });         });         function onSuccessAddNewProposition(data){             $('#propositionlist').append(data);//append proposition             $('#nbprop').val(parseInt($('#nbprop').val())+1);//update proposition count         }      Thanks in advance PS: I'm using WP 3.8.2


Load tinyMCE / wp_editor() via AJAX

> **Possible Duplicate:**   >  How to load wp_editor() through AJAX/jQuery There are several questions about this (like this, or that), but none of them provides a solution to me. The situation: I have a metabox. Inside this metabox I want to dynamically add tinyMCE editors. The code: PHP:               add_action('wp_ajax_insert_tinymce', 'insert_tinymce');     function insert_tinymce(){         wp_editor('','editor-id');         exit;     }      JS:               $.post(         global.ajaxurl,         {             action : 'insert_tinymce'         },         function(response) {                  $(response).appendTo('#target-div');                  console.log(tinyMCE); // no instance of 'editor-id'             console.log(tinyMCEPreInit.mceInit); // 'editor-id' not listed             console.log(tinyMCE.activeEditor); // null         }     );      The result is a editor window (with html and visual tabs), a upload button and a textarea but completly without buttons. What I tried (as suggested in the other questions):               // In the response function     tinyMCE.init({         skin : "wp_theme",         mode : "exact",         elements : "editor-id",         theme: "advanced"     });               // In the response function     tinyMCE.init(tinyMCEPreInit.mceInit['editor-id']);               // in the PHP     ob_start();     wp_editor( '', 'editor-id' );     echo ob_get_clean();      This first one works, but I would have to set many settings manually, plus my custom buttons don't show up. The second one obviously doesn't work, because there is no `editor-id` listed in `tinyMCEPreInit.mceInit` The third one (output buffering) makes no difference. * * * I have noticed that `wp_editor()` adds the tinyMCE instances to `tinyMCEPreInit` and adds it via `admin_print_footer_scripts` hook. So I would have to dynamically update `tinyMCEPreInit` (without losing the instance of the main editor) and then fire `tinyMCE.init(tinyMCEPreInit.mceInit['editor- id'])` \- **MAYBE** Any help highly appreciated ;-) Thanks!


wp_editor call with ajax

I'm working on a wordpress plugin that manages a database. The database has a table that has the id field name and descr. I have a php file that has two buttons, one and another rule change. When you click on the switch, the button triggers a javascript event that produces an ajax request cleaning a div and puts the contents of about.php Archiving File ajax.js                $.ajax({             type: "POST",             url: "http://localhost/project/wp-content/plugins/admin/about.php",             data: {"id":id},             success: function(data)             {                  $("#admin div").empty();                  $("#admin div").append(data);             }       });      File about.php               <?php          $descr = $_POST['id']     $html = "<div>".wp_editor('','textarea', array('textarea_name' => $descr, 'media_buttons' => false))."</div>";     echo $html;          ?>      In the file there is about one textarea I implement the wp_editor, however when ajax returns the contents of the textarea about.php looks like this: ![enter image description here](http://i.stack.imgur.com/6Hlr5.jpg) How do I bring the features of textarea along with the buttons via ajax?


Displaying media for custom post type

I created a custom post type for Products. I can display all the fields no problem (either in a list or a single-product.php). I wanted to use the Media library and associate an uploaded picture with the Product post type (mostly to handle all the thumbnail work automatically). I uploaded a photo to the media library and associated with a specific Product post type.                $args = array(             'label' => __('Products'),             'labels' => $labels,             'public' => true,             'can_export' => true,             'show_ui' => true,             '_builtin' => false,             'capability_type' => 'post',             'menu_icon' => get_bloginfo('template_url').'/functions/images/product.png',             'hierarchical' => false,             'rewrite' => array( "slug" => "product" ),             'supports' => array('title', 'thumbnail'), //MAYBE add thumbnail later!             'show_in_nav_menus' => true                  );      I've tried everything to display the thumbnail and picture for the Product but it's not working: `the_post_thumbnail();`, `get_the_post_thumbnail` but nothing works. Here's my single-product.php:
             <?php                  $attachment_args = array(                     'post_type' => 'attachment',                     'numberposts' => -1,                     'post_status' => null,                     'post_parent' => $post->ID                         );                      $attachment = get_posts($attachment_args); ?>             <img src="<?php echo wp_get_attachment_image_src($attachment->ID, 'full', false); ?>"  />
<?php echo get_post_meta($post->ID, $prefix.'description', true); ?>

             <?php //this gets the custom fields for the document links (PDF Files)               $custom_field_keys = get_post_custom_keys();               foreach ( $custom_field_keys as $key => $value ) {                 $valuet = trim($value);                   if ( '_' == $valuet{0} || $prefix != substr($valuet, 0, 4) || $prefix.'description' == $valuet )                   continue;                 $n = substr($valuet, -1);                      if ( $valuet == $prefix.'docname'.$n)                     echo '
ID, $prefix.'docurl'.$n, true) . '" target="_blank">' . get_post_meta($post->ID, $prefix.'docname'.$n, true) . '
';                    }             ?>

      Am I missing something? Thank you!


remove_filter right way

What is the right way to remove filter in condition? **method 1**               public function update_loop($query) {         global $wp;              if(!$query->is_main_query() || $query->is_admin)                 return;              if (!array_key_exists('top', $wp->query_vars))                 return;              add_filter('posts_clauses', array(&$this, 'top_clauses'), 10, 2);     }          public function top_clauses($clauses, $query) {         // somethig here              remove_filter('posts_clauses', array(&$this, 'top_clauses'), 10, 2);              return $clauses;     }      **method 2**               public function update_loop($query) {         global $wp;         add_filter('posts_clauses', array(&$this, 'top_clauses'), 10, 2);     }          public function top_clauses($clauses, $query) {         global $wp;         if(!$query->is_main_query() || $query->is_admin)                 return;              if (!array_key_exists('top', $wp->query_vars))                 return;              // something here              return $clauses;     }      Do they working properly both?


How to attach a uploaded video to post from front end

Hello am building a user generated content sharing theme This is my code for video submission from front end But this code only allows to add videos from a url How can i allow them to upload videos and then attach it to post Heres the code !                <?php     /*      Template Name: Submit Content video Template     */          // if you are not using this in a child of Twenty Eleven, you need to replicate the  html structure of your own theme.          ?>     <?php include("Header-submit-vid.php"); ?>

     <?php                if(isset($_POST['new_post']) == '1') {      $post_title = $_POST['post_title'];       $post_category = 'todays_post';      $post_content = $_POST['post_content'];     $tags = $_POST['post_tags'];     $winerating = $_POST['winerating'];                                    $new_post = array(       'ID' => '',       'post_author' => $user->ID,        'post_category' => array($post_category),       'post_content' => $post_content,       'tags_input'    =>  array($tags),       'post_title' => $post_title,       'post_category' =>   array($_POST['cat']),  //       'post_status' => 'publish',       'post_type' => 'post',        'winerating' => $winerating     );                $post_id = wp_insert_post($new_post);                             if (!function_exists('wp_generate_attachment_metadata')){             require_once(ABSPATH . "wp-admin" . '/includes/image.php');             require_once(ABSPATH . "wp-admin" . '/includes/file.php');             require_once(ABSPATH . "wp-admin" . '/includes/media.php');         }          if ($_FILES) {             foreach ($_FILES as $file => $array) {                 if ($_FILES[$file]['error'] !== UPLOAD_ERR_OK) {                     return "upload error : " . $_FILES[$file]['error'];                 }                 $attach_id = media_handle_upload( $file, $post_id );             }            }      if ($attach_id > 0){     $post = get_post($post_id,'ARRAY_A');     $image = wp_get_attachment_image_src( $attach_id, 'large' );      $image_tag = '
<a href="'.$image[0].'" rel="lightbox"  title="<?php the_title();? >" >
';           //add image under the content      $post['post_content'] = $image_tag . $post['post_content'];           //add image above the content      //$post['post_content'] = $post['post_content'] . $image_tag;                      $post_id =  wp_update_post( $post );           }                               // This will redirect you to the newly created post       $post = get_post($post_id);         wp_redirect( get_permalink($post_id));       exit();               }              ?>                     <title>Add Your Funny Video</title>                               <meta charset=utf-8 />                                     <  form method="post" action="" enctype="multipart/form-data" name="myform">

                                             Enter Your Video Url Here :-         <input type="url" name="post_content" size="53" required="required" id="text-desc" class="rounded" style="position: relative;right: -86px;">

                        Post Title
        <input type="text" required="required" name="post_title" size="53" id="input-title" placeholder="Add A Title Here" class="rounded" style="position: relative;right: -86px;">

                    <fieldset class="tags">                   Post Tags :-
              <input  type="text" class="rounded" placeholder="Add Some Tags To Get Higher  Votes"value="" size="53" tabindex="35" name="post_tags" id="post_tags"  style="position: relative;right: -86px;">          </fieldset>
                  <fieldset class="category">                       Select Your Post Category

<?php wp_dropdown_categories( 'tab_index=10&taxonomy=category&hide_empty=0' ); ?>
                 </fieldset>                              <input type="hidden" name="new_post" value="1" />

<input class="submitbutton" type="submit" name="submit" value="Add"  />

           </form>

<?php include("sidebar-submit.php"); ?>

<?php get_footer(); ?>


WooCommerce: multiple input field for multiple product variations

I'm trying to customize the default Woocommerce theme to my needs. I have a product that comes in two variations: it's wine, so variation A is a 6 bottle pack, and variation B is a 12 bottle wooden case. I'd like to have a double input text field next to the product that will let me add them to the shopping cart. Something like what you can see in this image (don't mind the numbers, they are just random in the design ;) ): ![double input field](http://i.stack.imgur.com/3MQ8w.jpg) Right now I've managed to have only 1 single text field that let me add only 1 variation, OR a button that sends me to the product detail page with a dropdown that let me select one of the two variations. **But I'd like to do it directly on the catalogue (archive) page, and not with a dropdown menu, but with 2 different input fields.** Can you help me with that? It seems that customizing Woocommerce is not that easy... :( Right now I'm trying to edit content-product.php, I've commented out some "default" woocommerce action to customize it with my code. This is my actual content-product.php but it only shows one single input field for just one variation of the product.               <?php     /**      * The template for displaying product content within loops.      *      * Override this template by copying it to yourtheme/woocommerce/content-product.php      *      * @author      WooThemes      * @package     WooCommerce/Templates      * @version     1.6.4      */          global $product, $woocommerce_loop;          // Store loop count we're currently on     if ( empty( $woocommerce_loop['loop'] ) )         $woocommerce_loop['loop'] = 0;          // Store column count for displaying the grid     if ( empty( $woocommerce_loop['columns'] ) )         $woocommerce_loop['columns'] = apply_filters( 'loop_shop_columns', 4 );          // Ensure visibilty     if ( ! $product->is_visible() )         return;          // Increase loop count     $woocommerce_loop['loop']++;     ?>     <li class="product-catalog <?php         if ( $woocommerce_loop['loop'] % $woocommerce_loop['columns'] == 0 )             echo 'last';         elseif ( ( $woocommerce_loop['loop'] - 1 ) % $woocommerce_loop['columns'] == 0 )             echo 'first';         ?>">              <?php do_action( 'woocommerce_before_shop_loop_item' ); ?>                            <?php                 /**                  * woocommerce_before_shop_loop_item_title hook                  *                  * @hooked woocommerce_show_product_loop_sale_flash - 10                  * @hooked woocommerce_template_loop_product_thumbnail - 10                  */                 //do_action( 'woocommerce_before_shop_loop_item_title' );             ?>             <?php echo get_the_post_thumbnail( $post->ID, 'shop_catalog'  ) ?>
<?php the_title(); ?>
             <?php the_excerpt();              echo '
post->ID).'" title="More details" class="read-more-link">More Details  »
'             ?>             <form action="<?php echo esc_url( $product->add_to_cart_url() ); ?>" class="cart" method="post" enctype='multipart/form-data'>                 <?php woocommerce_quantity_input(); ?>
(Six bottle minimum, price is based
on a per bottle cost of $15.95)
                      <button type="submit" class="button alt">Add to chart</button> <a href="<?php echo $woocommerce->cart->get_cart_url(); ?>" class="button-link">Checkout                  </form>             <?php                 /**                  * woocommerce_after_shop_loop_item_title hook                  *                  * @hooked woocommerce_template_loop_price - 10                  */                 //do_action( 'woocommerce_after_shop_loop_item_title' );             ?>                        <?php //do_action( 'woocommerce_after_shop_loop_item' ); ?>


Wordpress woocommerce shipping order

Hey guys can you please help me with something regarding the woocommerce plugin? I want only these fields show up in the shipping section (i think it requires a reorder of the fields, but i don't know where to begin) Name Address 1 Adress 2 Email | Telephone Company FIELD 1 | FIELD 2 (for the company details)


Create QuickStart Package for Wordpress just like in Joomla

I need a simple help that I am unable find a good documentation for creating a quickstart package for Wordpress, same like we already have in Joomla. I have very much noob to wordpress dev. I recently built a wordpress website in which I have ported an HTML theme into wordpress theme. Now, all devs are finished, website is fine in my local machine, I just need to create a quickstart/ready- to-work package of this wordpress file, what I mean is, once install this package into live server/anywhere, it should be like a normal wordpress install but it will have all contents and theme that I have created.


Disable NextGEN Gallery on specific template?

How can I disable plugin and all its hooks on specific template? I even took out the wp_footer and get_footer out of my template, but somehow still nextgen manages to add it's crap _always_ before body tag.


oEmbed youtube video aspect ratio

When I insert youtube video in my post by just putting the link(http://youtu.be/KvtkknNawCQ). The video aspect ratio becomes 4:3. How can I change to 16:9?


Deregister scripts on unnecessary pages using remove_action

> **To all would-be close-voters:** This question is not a duplicate, because > I need to remove all scripts added by plugin using `remove_action`. > > In Very stubborn wp_register_script / add_action vs remove used > `wp_dequeue_script` function to remove scripts one by one, but I need to > remove them all (which was added by plugin using `add_action`) using > `remove_action`! `wp_dequeue_script` function can't remove custom code like this:               add_action('wp_head', 'print_style');          function print_style() {         echo '<style>body { margin: 0; }</style>';     }      I have installed WP Polls plugin. I am using it in some of the pages and need to deregister its styles and scripts on other pages. I found some code in the plugin which registers scripts: ### Function: Enqueue Polls JavaScripts/CSS               add_action('wp_enqueue_scripts', 'poll_scripts');     function poll_scripts() {         // code     }      So for deregistering its scripts i am using next code in my functions.php:               add_action( 'wp_enqueue_scripts', 'deregister_polls_scripts_and_styles' );          function deregister_polls_scripts_and_styles() {         if ( is_home() ) {             remove_action( 'wp_enqueue_scripts', 'poll_scripts');         }     }      So it must deregister polls scripts on homepage, but id does not. What i am doing wrong? **P.S. 1** Scripts are removing in this case:               add_action( 'after_setup_theme', 'wc_deregister_polls_scripts_and_styles' );          function wc_deregister_polls_scripts_and_styles() {         remove_action('wp_enqueue_scripts', 'poll_scripts');         remove_action('wp_head', 'poll_head_scripts');     }      But i need to remove it on some pages like this:               add_action( 'after_setup_theme', 'wc_deregister_polls_scripts_and_styles' );          function wc_deregister_polls_scripts_and_styles() {         if ( is_page('developers') ) {             remove_action('wp_enqueue_scripts', 'poll_scripts');             remove_action('wp_head', 'poll_head_scripts');         }     }      So in this case it does not work. I have installed another plugin and all works fine in this case. Same actions, BUT all works:               add_action( 'wp_enqueue_scripts', 'wc_deregister_scripts_and_styles' );          function wc_deregister_scripts_and_styles() {         if ( !is_home() && !is_tax('brand') ) {             remove_action( 'wp_enqueue_scripts', 'uag_frontend_styles', 999 );             remove_action( 'wp_footer', 'uag_footer_scripts');         }     }      **P. S. 2** This is another plugin.               add_action('wp_enqueue_scripts', 'uag_frontend_styles', 999);     function uag_frontend_styles() {              /* main stylesheet */         wp_register_style( 'uag_style', uag_url . 'css/uag.css');         wp_enqueue_style('uag_style');         }      This is Polls:               add_action('wp_enqueue_scripts', 'poll_scripts');     function poll_scripts() {         global $text_direction;         if(@file_exists(get_stylesheet_directory().'/polls-css.css')) {             wp_enqueue_style('wp-polls', get_stylesheet_directory_uri().'/polls-css.css', false, '2.63', 'all');         } else {             wp_enqueue_style('wp-polls', plugins_url('wp-polls/polls-css.css'), false, '2.63', 'all');         }         if('rtl' == $text_direction) {             if(@file_exists(get_stylesheet_directory().'/polls-css-rtl.css')) {                 wp_enqueue_style('wp-polls-rtl', get_stylesheet_directory_uri().'/polls-css-rtl.css', false, '2.63', 'all');             } else {                 wp_enqueue_style('wp-polls-rtl', plugins_url('wp-polls/polls-css-rtl.css'), false, '2.63', 'all');             }         }         $poll_ajax_style = get_option('poll_ajax_style');         $pollbar = get_option('poll_bar');         wp_enqueue_script('wp-polls', plugins_url('wp-polls/polls-js.js'), array('jquery'), '2.63', true);     // Other same code     }


How to make the_tags title translatable?

How can I make the text in the_tags function translatable? Currently I'm using following:               <?php the_tags('
Post Tags',' ','
'); ?>        But I'd like to make 'Post Tags' text translatable by adding the text domain, similar to this:               _e('Post Tags', 'textdomain');