Ajax template: how to handle head section

I know it's _easy stuff_ , but I'm new to this and I can't understand which is the best approach. ## Background The template I'm working on is a dual theme Desktop/Mobile, UA Sniffing based. _Now_ I just added responsiveness through enquire.js and ajax and everithing changed: I'm struggling in getting things to work properly, is the first time I'm dealing with ajax. ## Scenario My template is _dynamically loaded through ajax_ in fact if you try to resize the width of the window below 1080px, the mobile template will show up. (it will show up on every mobile device too but this is not important for us atm) So, responsiveness has been implemented with the help of enquire.js and ajax calls (see code below). Originally, the template was static so at the moment, the whole section is still conditionally loaded through if statements in functions.php. (e.g. the video script should just load on certain pages of the desktop version) ## Issues   1. The mobile template -which has been styled with the mobile.css stylesheet- doesn't seem to have any effect. Should I change the way stylesheets and scripts are loaded due to the new ajax/enquire thing?   2. the content i.e. the_content(), doesn't show up. Why? And how to load it in my scenario? found! -- document.write(data) was owerwriting everything! I added $("body").append(data); instead ## Follows the code **functions.php**                   //Load Stylesheet     function add_desktop_styles() {         wp_register_style('reset', get_template_directory_uri().'/reset.css');              wp_register_style('style', get_template_directory_uri().'/style.css', array('reset') );         wp_enqueue_style('style');              //$mobile = mobile_device_detect();         //if ($mobile==true) {         if (wp_is_mobile()) {             wp_register_style('mobile', get_template_directory_uri().'/mobile.css', array('reset') );             wp_enqueue_style('mobile');         }     }     add_action('wp_head', 'add_desktop_styles', '1');                    //UA Sniffing     function devicecontrol() {             require_once('_/inc/mobile_device_detect.php');     }     add_action('wp_loaded', 'devicecontrol', '2');                    //AJAX     function your_function_name() {         wp_enqueue_script( 'function', get_template_directory_uri().'/_/js/my_js_stuff.js', array('jquery','enquire'), true);         wp_localize_script( 'function', 'my_ajax_script', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );     }     add_action('template_redirect', 'your_function_name');          function get_mobile_template()     {         include('templates/pages/homepage-phone.php');         die();     }     add_action("wp_ajax_nopriv_get_mobile_template", "get_mobile_template");     add_action("wp_ajax_get_mobile_template", "get_mobile_template");          function get_desktop_template()     {         if (!wp_is_mobile()) {             include('templates/pages/homepage-computer.php');         } else {             include('templates/pages/homepage-phone.php');         }         die();     }     add_action("wp_ajax_nopriv_get_desktop_template", "get_desktop_template");     add_action("wp_ajax_get_desktop_template", "get_desktop_template");                    //jQuery     if ( !function_exists( 'core_mods' ) ) {         function core_mods() {             if ( !is_admin() ) {                 wp_deregister_script( 'jquery' );                 wp_register_script( 'jquery', ( "//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ), false);                 wp_enqueue_script( 'jquery' );             }         }         add_action( 'wp_enqueue_scripts', 'core_mods','2' );     }                    //Scripts Mobile     function add_mobile_scripts() {         wp_register_style('video-css', get_template_directory_uri().'/_/js/videojs/video-js.css');         wp_enqueue_style('video-css');         wp_register_script( 'video-js', get_template_directory_uri().'/_/js/videojs/video.js', null, false );         wp_enqueue_script( 'video-js' );     }     function isMobile() {         //$mobile = mobile_device_detect();         ///if ($mobile==true)         if (wp_is_mobile()) {             add_mobile_scripts();         }     }     add_action( 'wp_enqueue_scripts', 'isMobile', '1' );                    //Scripts Desktop     function addSlide() {         /*wp_register_script( 'modernizr', get_template_directory_uri().'/_/js/modernizr.js', null, false );         wp_enqueue_script( 'modernizr' );*/         wp_register_script( 'enquire', get_template_directory_uri().'/_/js/enquire.min.js', null, false );         wp_enqueue_script( 'enquire' );         wp_register_script( 'jwplayer', get_template_directory_uri().'/_/js/jwplayer.js', null, false );         wp_enqueue_script( 'jwplayer' );         wp_register_script( 'bootstrap', get_template_directory_uri().'/_/js/bootstrap.js', array('jquery'), false );         wp_enqueue_script( 'bootstrap' );         wp_register_script( 'spk_slide', get_template_directory_uri().'/_/js/slides.js', array('jquery'), false );         wp_enqueue_script( 'spk_slide' );     }                    // Slider just on front page     function isSlideshowPage() {       if ( is_front_page()         || is_page('Bankkaufmann')         || is_page('Hochschulabsolvent')         || is_page('Professional')         || is_page('Die Prüfungsstellen')         || is_page('Von Beruf Verbandsprüfer')) {             addSlide();         }     }     add_action( 'wp_enqueue_scripts', 'isSlideshowPage' );      **Js script** this script at the moment loads on all pages, I will wrap it and call it from the page-template later               enquire.register("screen and (max-width:1080px)", {              // OPTIONAL         // If supplied, triggered when a media query matches.         match : function() {             jQuery.ajax({                 url: my_ajax_script.ajaxurl,                 data: ({action : 'get_mobile_template'}),                 success: function(data) {                 document.write(data);                 }             });         },              unmatch : function() {$("body").empty();},              // OPTIONAL         // If supplied, triggered once, when the handler is registered.         setup : function() {},              // OPTIONAL, defaults to false         // If set to true, defers execution of the setup function         // until the first time the media query is matched         deferSetup : true,              // OPTIONAL         // If supplied, triggered when handler is unregistered.         // Place cleanup code here         destroy : function() {}          });          enquire.register("screen and (min-width:1081px)", {              // OPTIONAL         // If supplied, triggered when a media query matches.         match : function() {             jQuery.ajax({                 url: my_ajax_script.ajaxurl,                 data: ({action : 'get_desktop_template'}),                 success: function(data) {                 document.write(data);                 }             });         },              unmatch : function() {$("body").empty();},              // OPTIONAL         // If supplied, triggered once, when the handler is registered.         setup : function() {},              // OPTIONAL, defaults to false         // If set to true, defers execution of the setup function         // until the first time the media query is matched         deferSetup : true,              // OPTIONAL         // If supplied, triggered when handler is unregistered.         // Place cleanup code here         destroy : function() {}          });


How to control Facebook share information for the front page?

Is there a way to prove information to Facebook so I can control what the title and description information is that comes up when pasting the front page of my blog on facebook? Right now, it seems to grab a random post... not the latest... for th information. I'd prefer to either set the information myself for the front page OR insure that it shows information from my 1st/featured post. How can I get control over this? (again, this isn't related to a "like" button, or anything... but posting the root URL straight to a Facebook status. Sharing the whole site, not a post.)


Redirect to post after submission with Gravity Forms?

How do I redirect to a post after submission with gravity forms. It gives you the option to put in query string values but when I add `{post_id}/{Video Title:1}` I get `mysite.com/?123/name+of+post` and it just goes back to the homepage. My permalink structure is `post_id/postname` and `{Video Title:1}` equals the post name but it uses plus sings instead of dashes. What am I doing wrong?


why is $wpdb->update() causing a DB error from within wp_set_password()

I have a page-template for my custom theme that enables the user to reset their password from the front-end. I'm calling wp_set_password() and everything runs but the password is not changed in the DB. When I turn on $wpdb->show_errors() I get the following:               WordPress database error: []     UPDATE `wp_users` SET `user_pass` = '$P$BohZQNR7x.6IVoyG1LGH4Wv3xeycd70' WHERE `ID` = 9      the error happens inside wp_set_password() here:               function wp_set_password( $password, $user_id ) {             global $wpdb;             $hash = wp_hash_password( trim( $password ) );             $wpdb->update($wpdb->users, array('user_pass' => $hash, 'user_activatio\     n_key' => ''), array('ID' => $user_id) );                                                    wp_cache_delete($user_id, 'users');          }      This code is wp-includes/pluggable.php... I'm guessing that there is something _really_ obvious that I'm not understanding. I hope someone can clue me in... **[EDIT]:** after looking at this question I tried the suggestion listed there and discovered that update() is returning '1' which indicates that it successfully updated one row which is what it should be doing. But how come the DB is not being updated when I inspect it with phpmyadmin? **[EDIT 2]:** I am also using RedBeanPHP together with this template to access the same database. When I comment out the code to connect to the DB, then the update effects the DB. So perhaps this is a MySQL question and not a wordpress question? When does RedBeanPHP having a DB handle to the DB stop WPDB from updating the DB?? Sorry if this is the wrong place for the question. I would in general like an idea of how to debug this type of problem. Thanks!


Custom Post Type Date Based Archive URL rewrite

> **Possible Duplicate:**   >  custom post types, wp_get_archives and add_rewrite_rule I have a custom post type called "course" and I would like to create a date based archive similar to the default post archives which look like mysite.com/2012/05. I want to use urls like mysite.com/ **course** /2012/05. How can I do this using the WordPress rewrite API? While avoiding plugins. This solution is very close How to give a CPT (custom post type) a date based url but I would like to avoid using a query var if possible and stick with the year/month based urls.


How to add thumbnails to posts and pages automatically in a uniformed fixed elegant way?

please i am wondering if there was a plugin or hack that enables me to append a nice looking thumbnail for each post or page i publish on my blog. Currently, i am able to add the featured images but appending those images to my posts using the below code is not getting me any tidy results.               <?php     if ( has_post_thumbnail() ) {     the_post_thumbnail();     }  ?>      I am mainly looking for something simple that would fix those thumbnails automatically and uniformly in my posts or pages without adding them manually and adjusting their sizes and positions within the text one by one. As if i have 500+ posts, i have to repeat the process 500 times spending long hours adjusting each single image in my posts which is literally very time consuming. At the moment i have them set already as featured images but not displayed inside the posts or pages. ## Please check the below picture for an example of a tidy thumbnail: ![enter image description here](http://i.stack.imgur.com/3XmKw.jpg) Thanks in advance for your help! any suggestions are greatly appreciate it.


How to map permalinks with accented letters to sanitized slugs?

To keep legacy entries on a blog hosted on TypePad on sync with a new WordPress installation... How do I map this permalink with accented letters:               domain.com/no-es-fácil-alejarse-de-la-política      to this clean WP permalink without accented letter:               domain.com/no-es-facil-alejarse-de-la-politica      What is the best way to accomplish this?


Why is my custom loop not filtering correctly nor paginating?

Hopefully someone can help me with this as I've been struggling for a few days. I've built a form on a page that lets users filter Events by custom taxonomies Type, Period and Duration. These are working individually i.e. the filter shows all posts with either Type=x or Period=y but not combined. Can anyone see why? Here's my code in Pastie I'm also trying to figure out how to paginate my results for my custom loop, but can't figure out why it's not working? Any help massively appreciated. Thanks osu **EDIT** Ok, for some reason, I can't use the array method to pass my variables to query_posts() and I'm assuming this is because with the plugin Query Multiple Taxonomies which I need installed for this to work, it only works with the method 'post_type=event&fttype=daily' etc. Here's my new code which is working: http://www.pastie.org/1586564 HOWEVER, even though the pagination is working when you first visit the page, after you submit the form, the pagination stops working. So, nearly nearly there, but I need some help with the last part if anyone can be so kind? Thanks osu


After creating hierarchical post type, still not getting any way to set parent

After creating a custom post type like below, I still dont get any option to set the parent of the post, am I missing something?               register_post_type(       'projects',       array(         'labels' => array(           'name' => 'Projects',           'singular_name' => 'Project'         ),         'public' => true,         'capability_type' => 'post',         'supports' => array('title', 'editor', 'thumbnail', 'excerpt', 'comments'),         'hierarchical' => true,         'menu_position' => 5       )     );      ![](http://imgur.com/m224s.jpg)


Multiple TinyMCE Editors in one Admin Page

Please could someone give me an idiots guide to adding more than one TinyMCE editor to a page editor page please. I am creating my own wordpress theme and the multiple editors are an essential part of the website. I would like to know what code I need to add and where I add it for the editors to appear in the Editor side and the code needed to output the code to the live website. I have searched online for the answer but can not understand the ones that I have found. I have only just started learning PHP. Any help will be gratefully appreciated! Andi


Hook into create_category

I'm trying to in some way hook into when a new category is created. What I would like to do is to see the term and slug that was created and log them/email them. I have tried to hook in to create_category(). That only gives me an ID, not the term and slug. Would be great if someone could lead me on the right track.


Get_template_part inside a folder

So I've the following code in order to search for templates inside a custom theme I'm working on:               <?php $my_theme = wp_get_theme();     get_template_part( 'masthead',  $my_theme->Template); ?>      Basically what it does, is that it does a search for a file called "masthead- themename.php". If that file does not exists, then it looks for a file called "masthead.php". This works as expected. However, I would to have something that searches for the file inside of a folder called "templates" as a first option and if not, then search for the template name in the theme's root folder. I tried this               <?php $my_theme = wp_get_theme();     get_template_part( 'templates/masthead',  $my_theme->Template); ?>      But this only works if the file exists in the template's folder. If the file exists in the root's theme folder, it does not recognize it. Any ideas? Thanks!


Add auto increment value to custom meta

I have a custom meta "code" in my CPT. How can I make it so that it has a number that will auto increment every time the admin publishes a post? My solution is to add a table in the database that is "code". Every time the user publishes a post, it will add 1 to the code table. Then I will use a script to append the code from the db to the meta. But it does not seem to add in the db. Please present alternative/better solutions.


Combine the results of two loops

I currently have these 2 loops running on a single page               $related = p2p_type( 'artist_to_song' )->my_get_related( get_queried_object() );     $features = p2p_type( 'song_to_feature' )->my_get_related( get_queried_object() );               if ( $related->have_posts() ) :         while ( $related->have_posts() ) : $related->the_post();           //content        endwhile;        wp_reset_postdata();                                  endif;          if ( $features->have_posts() ) :         while ( $features->have_posts() ) : $features->the_post();           //content        endwhile;        wp_reset_postdata();                                  endif;      Is it possible to combine the results of these loops into one so that all the posts are listed in chronological order as opposed to the results of `$related` being followed by `$features`.


User Roles Not Sticking

I have added a custom user role of super_poster, basically they make 20 posts and once they hit $postlimit get auto-moved back down to contributer level, the moving down and post counting works ok, my problem is that the wp system adds the user into "none" instead of into contributer role               if ($count_posts >= $postlimit) {         $current_user->remove_role( 'super_poster' );         $current_user->add_role( 'contributer' );            }      contributer is set for new user default on sign-up, so the situation i have is in wp-admin user edit page i can see the newly moved (into contributer from super poster) has still got "additional capabilities of contributer" however user role dropdown says --No role for this site -- wp-admin users page shows the super_poster as in user group "none" what gives?


How i will get the images of highest scored users?

I am using a Q/A plugin for the user scores, I have function like below, I want to take the images of the highest scored users, how can I get the images of the highest users, and I want to display it in home page with the images and score with separate boxes , like StackOverflow, for running this query do I need `add_filter()`. Where do I add this code?               function the_top_qa_users(){         global $wpdb;              $user_ids = $wpdb->get_col("SELECT DISTINCT user_id         FROM $wpdb->usermeta         WHERE meta_key = '_qa_rep'         AND meta_value IS NOT NULL         ORDER BY meta_value DESC         LIMIT 0 , 5");              foreach($user_ids as $id){             the_qa_user_link($id);             echo '<br/>';         }          }


Post and Page Inheritance to subsites in a WordPress Network

I have to develop a multi-country, multi-lingual website. One country may have multiple languages. I have setup a WordPress Network and created subsites for each country like following.               abc.com/ > Global Website     abc.com/usa > USA Website     abc.com/fra > France Website      I am detecting Countries through Geo Location API and forcefully redirect them to their own country's website. Each country has their own set of languages e.g. France will have English and French with French as default language. I decided to use PolyLang for language translations. It works fine.               abc.com/fra/ > default french website     abc.com/fra/en > english translation of the french website.      The issue I am facing is I have duplicate english contents in every sub site. Is there anyway we can avoid duplicates and english version of subsites uses the english pages/posts from global site. Ideally, Admin should be able to select which one goes to sub site and which one does not. There is an event section too, that can have global events as well as local/country level events. I can think of following solutions and their drawbacks   1. ThreeWP Broadcast plugin. This plugin broadcast page/posts to other sites on selection. Seems to be an excellent choice but duplicates the content what I am avoiding. Morover, I am not sure how it will work with PolyLang translations.   2. Adding 'template_redirect' or 'wp' action, if subsite cant find a slug, and same slug is available in global site it should be populated and avoid 404. We also need to Intercept or override WP_Query calls to run same query on global site and return the results. About PolyLang, I am not sure how it will work. I guess, it can be sorted out. This approach is complicated and may end up no-where.  Anyone have any better solution? A plugin, or idea that can solve this interesting mystery? I believe, its a common scenario for a multinational company. So, There has to be a viable solution to this.


Shortcode won't execute

I've created a shortcode using my limited knowledge, google, and stackexchange to do so. But when I load the page, it loads above the page contents and appears as html text.               (shortocode text)     -------     page contents appearing normally      As I've said, I have limited (Zero) knowledge of this type of coding and I'm unable to find out which part/what isn't working. I've attached a compacted version of the code I've used, with less content being displayed in the shortcode function.               // Add Shortcode     function p_formatage( $atts , $content = null ) {              // Attributes         extract( shortcode_atts(             array(                 'postid' => '',                 'ptitle' => '',                 'pimage' => '',             ), $atts )         );              $postid = $atts['postid'];         $ptitle = $atts['ptitle'];         $pimage = $atts['pimage'];              // Post title         $p-ptitle = if ( empty( $ptitle ) ) {         echo "Whoops! Looks like went wrong here!";         }         else {           if ( $postid == true ) {          echo "' . $ptitle . '";          }          else {           echo "' . $ptitle . '";          }         }              $p-beta = if ( empty( $pimage) ) {         echo "$ptitle";         }         else {          echo "";         }             $pclass = if ( $postid ) {         echo "$p-ptitle";         }         else {          echo "$p-beta";         }              // Output         $output = {             echo "$pclass";         }              return $output;     }          add_shortcode( 'p-fmt', 'p_formatage' );


How to track a users progress through pages by inserting data into Wordpress Database?

My website users can learn British Sign Language through Video Tuts, Quizzes and games etc. I would like to track the users progress through the pages of the course and add that data to a Wordpress Database. The course structure from the first page is roughly like this: Stage 1 intro --> (next page) Video tut --> Quiz --> Quiz page 2 --> Exam --> Stage 2 intro.. etc I was thinking about inserting/updating an integer or string (that represents progress) on a 'save & next' page button through PHP. This would increase the number or change the string in the users database and allow me to track which pages they have worked through and display it in other parts of the site (account page, next to username, course page etc). It would also allow me to restrict access until they have completed prerequisites (if I were to ever want to do that). Could someone give me a brief explanation on how to do this or suggest an alternative? I am familiar with PHP and mysql but my skills aren't quite adequate enough to execute something like this safely. Thank you.


how to add limit records in wordpress query

I have this query which is returning the all records from database whose type is equal to 'quote2'. No I want to know how to limit the record. I mean I just want to show last 10 records added in the database. I am new in wordpress and want to learn syntax of my required query.               global $wpdb;      $querystr = "select $wpdb->posts.*      FROM $wpdb->posts     WHERE $wpdb->posts.post_type = 'quote2'     ";


Nested wp_query loop doesn't show connected posts

I have have a wp_query loop nested in another wp_query loop. The first loop queries the latest movies. The second loop queries the persons connected to each movie from the first loop (movies and persons are connected with the Posts2Posts plugin). Seperately both loops work fine, but put together only the first loop shows the movies and the second loop doesn't show the connected performers. What's wrong with the nested loop? Thanks!

Latest Movies
         <?php // LOOP 1             $args = array(                  'orderby' => 'cf-release-date',                 'order'=> 'desc',                 'post_type' => 'movie'                 );             $the_query = new WP_Query( $args ); ?>                   <?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
                 <a href="<?php the_permalink(); ?>"><img src="<?php echo types_render_field("cf-movie-dvd-cover", array(output=>"raw"));?>">
<a class="title-link" href="<?php the_permalink(); ?>"><?php the_title(); ?>

                     <?php                         // LOOP 2: Find connected PERSONS                         $connected = new WP_Query( array(                            'connected_type' => 'movies_to_persons',                           'connected_items' => get_queried_object(),                           'connected_meta' => array(                                 array(                                     'value' => 'actor',                                 )                             ),                           'nopaging' => true,                             'orderby' => 'title',                           'order' => 'asc'                         ) );                              // Display connected PERSONS                         if ( $connected->have_posts() ) :                     ?>
Featuring:
                              <?php while ( $connected->have_posts() ) : $connected->the_post(); ?>                             <a href="<?php the_permalink(); ?>"><?php the_title(); ?>                         <?php endwhile; ?>                          <?php                          // Prevent weirdness                         wp_reset_postdata();                              endif;                     ?>

              <?php endwhile; else: ?>
Sorry, there are no Movies to display
              <?php endif; ?>


Jetpack plugin - 'posts_per_page' not overriding 'Blog pages show at most' option, also different values for different post types?

I have Jetpack installed and I have got Infinite Scroll working on my theme but `posts_per_page` is having no effect, the number of posts initially shown and loaded is my "Blogs show at most" number in Settings -> Reading which is 5.               function mytheme_render_infinite_scroll() {         while ( have_posts() ) : the_post();                 if ('mytheme_custom_post_type' == get_post_type()) :                     get_template_part( 'content', 'archive-custom' );                 else :                     get_template_part( 'content', get_post_format() );                 endif;         endwhile;     }          function mytheme_jetpack_setup() {         add_theme_support( 'infinite-scroll', array(             'container'      => 'content',             'footer_widgets' => 'footer-widgets',             'type'           => 'click',             'render'         => 'mytheme_render_infinite_scroll',             'wrapper'        => true,             'posts_per_page' => '15'         ) );     }      I am also rendering a different content template depending on what the current post type is using the `mytheme_render_infinite_scroll` function above. It would be great if I could set the `posts_per_page` value to be different depending on post type too, eg. have 5 posts per page show on a Blog archive but have 15 posts per page show on an archive page of `mytheme_custom_post_type`. I am not sure how to do this, my attempt would be:               function mytheme_render_infinite_scroll() {         while ( have_posts() ) : the_post();                 if ('mytheme_custom_post_type' == get_post_type()) :                     get_template_part( 'content', 'archive-custom' );                 else :                     get_template_part( 'content', get_post_format() );                 endif;         endwhile;     }          function mytheme_infinite_scroll_posts_per_page()         while ( have_posts() ) : the_post();             if ('mytheme_custom_post_type' == get_post_type()) :                 return 15;             else :                 return 5;             endif;     endwhile;          function mytheme_jetpack_setup() {         add_theme_support( 'infinite-scroll', array(             'container'      => 'content',             'footer_widgets' => 'footer-widgets',             'type'           => 'click',             'render'         => 'mytheme_render_infinite_scroll',             'wrapper'        => true,             'posts_per_page' => 'mytheme_infinite_scroll_posts_per_page'         ) );     }     add_action( 'after_setup_theme', 'mytheme_jetpack_setup' );      ... but I have no idea if this would work, Jetpack is probably not set up to handle this! Can't test it either because as I said above the `posts_per_page` argument isn't having any effect. The Jetpack support doc is here: http://jetpack.me/support/infinite-scroll/ **EDIT:** I've done some testing and the conclusion I've come to is Jetpack is built so that the `posts_per_page` argument only has an effect if the `type` is not set as `click`. I can't find this specifically stated in any documentation so I may be wrong but I've got `posts_per_page` working with `'type' => 'scroll'` but not with `'type' => 'click'`


Show Custom Post Type values in Wordpress grid view

I have created a custom post type in WordPress as shown in figure.      ![enter image description here](http://i.stack.imgur.com/71Di2.png) What i want is to show the values eneterd in this custom post in the grid view of admin panel. Now the admin panel is only showing the Post title, date and comment images but i want to show the Pair2,buy sell and activity fields values as entered in my custom post . I have searched alot but couldn't find any solution. How should i go about it in WordPress? ![enter image description here](http://i.stack.imgur.com/ukG7R.png)      **EDIT**   Here is how i am making my custom post                  <?php     if( ! function_exists( 'quote_create_post_type' ) ) :       function quote_create_post_type() {         $labels = array(           'name' => __( 'ForexPair' ),           'singular_name' => __( 'ForexPair' ),           'add_new' => __( 'Add Pair Entry' ),           'all_items' => __( 'All Pairs' ),           'add_new_item' => __( 'Add Pair' ),           'edit_item' => __( 'Edit Pair' ),           'new_item' => __( 'New Pair' ),           'view_item' => __( 'View Pair' ),           'search_items' => __( 'Search Pairs' ),           'not_found' => __( 'No pair found' ),           'not_found_in_trash' => __( 'No pair found in trash' ),           'parent_item_colon' => __( 'Parent pair' )           //'menu_name' => default to 'name'         );         $args = array(           'labels' => $labels,           'public' => true,           'has_archive' => true,           'publicly_queryable' => true,           'query_var' => true,           'rewrite' => true,           'capability_type' => 'post',           'hierarchical' => false,           'supports' => array(             'title'           ),           'register_meta_box_cb' => 'quote_add_post_type_metabox'         );         register_post_type( 'quote', $args );         //flush_rewrite_rules();            }       add_action( 'init', 'quote_create_post_type' );                 function quote_add_post_type_metabox() { // add the meta box         //add_meta_box( 'quote_metabox', 'quote_metabox', 'quote', 'normal' );         add_meta_box( 'quote_metabox', 'Pair Entries', 'quote_metabox', 'quote', 'normal' );       }                 function quote_metabox() {         global $post;         // Noncename needed to verify where the data originated         echo '<input type="hidden" name="quote_post_noncename" id="quote_post_noncename" value="' . wp_create_nonce( plugin_basename(__FILE__) ) . '" />';              // Get the data if its already been entered         $quote_post_entryprice = get_post_meta($post->ID, '_quote_post_entryprice', true);         $quote_post_stoploss = get_post_meta($post->ID, '_quote_post_stoploss', true);         $quote_post_pairname = get_post_meta($post->ID, '_quote_post_pairname', true);         $quote_post_buysell = get_post_meta($post->ID, '_quote_post_buysell', true);         $quote_post_activity = get_post_meta($post->ID, '_quote_post_activity', true);         $quote_post_takeprofit = get_post_meta($post->ID, '_quote_post_takeprofit', true);         // Echo out the field         ?>        <link rel="stylesheet" href="http://gripforex.com/wp-content/themes/Forsy/select2.css" />

                  Pair:                   <select name="quote_post_pairname" id="e1" style="width:144px;">       <option value="AUD/CAD" <?php if($quote_post_pairname=="AUD/CAD") echo "selected"; ?> >AUD/CAD</option>       <option value="AUD/CHF" <?php if($quote_post_pairname=="AUD/CHF") echo "selected"; ?> >AUD/CHF</option>                      </select>

             Buy Sell               <select name="quote_post_buysell" id="e2" style="width:144px;">                 <option value="Buy" <?php if($quote_post_buysell=="Buy") echo "selected"; ?> >Buy</option>                 <option value="Sell" <?php if($quote_post_buysell=="Sell") echo "selected"; ?> >Sell</option>               </select>

             Activity               <select name="quote_post_activity" id="e3" style="width:144px;">                 <option value="Get Ready" <?php if($quote_post_activity=="Get Ready") echo "selected"; ?> >Get Ready</option>                 <option value="Active" <?php if($quote_post_activity=="Active") echo "selected"; ?> >Active</option>               </select>

             Entry Price
               <input type="text" name="quote_post_entryprice" class="widefat" value="<?php echo $quote_post_entryprice; ?>">

Stop Loss
               <input type="text" name="quote_post_stoploss" value="<?php echo $quote_post_stoploss; ?>" class="widefat" />

Take Profit
               <input type="text" name="quote_post_takeprofit" value="<?php echo $quote_post_takeprofit; ?>" class="widefat" />

       <?php       }                 function quote_post_save_meta( $post_id, $post ) { // save the data              if( !wp_verify_nonce( $_POST['quote_post_noncename'], plugin_basename(__FILE__) ) ) {           return $post->ID;         }              // is the user allowed to edit the post or page?         if( ! current_user_can( 'edit_post', $post->ID )){           return $post->ID;         }              $quote_post_meta['_quote_post_entryprice'] = $_POST['quote_post_entryprice'];         $quote_post_meta['_quote_post_stoploss'] = $_POST['quote_post_stoploss'];         $quote_post_meta['_quote_post_pairname'] = $_POST['quote_post_pairname'];         $quote_post_meta['_quote_post_buysell'] = $_POST['quote_post_buysell'];         $quote_post_meta['_quote_post_activity'] = $_POST['quote_post_activity'];         $quote_post_meta['_quote_post_takeprofit'] = $_POST['quote_post_takeprofit'];         // add values as custom fields         foreach( $quote_post_meta as $key => $value ) { // cycle through the $quote_post_meta array           // if( $post->post_type == 'revision' ) return; // don't store custom data twice           $value = implode(',', (array)$value); // if $value is an array, make it a CSV (unlikely)           if( get_post_meta( $post->ID, $key, FALSE ) ) { // if the custom field already has a value             update_post_meta($post->ID, $key, $value);           } else { // if the custom field doesn't have a value             add_post_meta( $post->ID, $key, $value );           }           if( !$value ) { // delete if blank             delete_post_meta( $post->ID, $key );           }         }       }       add_action( 'save_post', 'quote_post_save_meta', 1, 2 ); // save the custom fields     endif; // end of function_exists()               if( ! function_exists( 'view_quotes_posts' ) ) : // output       function view_quotes_posts( $num = 4, $do_shortcode = 1, $strip_shortcodes = 0 ) {              $args = array(           'numberposts'     => $num,           'offset'          => 0,           //'category'        => ,           'orderby'         => 'menu_order, post_date', // post_date, rand           'order'           => 'DESC',                'post_type'       => 'quote',                'post_status'     => 'publish',           'suppress_filters' => true,         );              $posts = get_posts( $args );         global $wpdb;           $querystr = "select $wpdb->posts.*          FROM $wpdb->posts       WHERE $wpdb->posts.post_type = 'quote'       ";                   $html = '

Pair	Action	Status	Entry Price	Stop Loss	Take Profit
';         foreach ( $posts as $post ) {           $meta_entryprice = get_post_meta( $post->ID, '_quote_post_entryprice', true );           $meta_stoploss = get_post_meta( $post->ID, '_quote_post_stoploss', true );           $meta_pairname = get_post_meta( $post->ID, '_quote_post_pairname', true );           $meta_buysell = get_post_meta( $post->ID, '_quote_post_buysell', true );           $meta_activity = get_post_meta( $post->ID, '_quote_post_activity', true );           $meta_takeprofit = get_post_meta( $post->ID, '_quote_post_takeprofit', true );                     $html.='
';           $html .= '                    '.$meta_pairname.'	               '.$meta_buysell.'	               '.$meta_activity.'	               '.$meta_entryprice.'	                    '.$meta_stoploss.'	                    '.$meta_takeprofit.'	             ';           $html.='
';         }         $html .="
";         $html = '
'.$html.'
';         return $html;       }     endif;      ?>


Has anyone tried putting PHP ActiveRecord on Wordpress?

I have worked with Ruby on Rails and I was looking for some code that did something close to the wonderfull RoR's ActiveRecord. I stepped by this site. Its PHP-ActiveRecord! I found it amazing, and it was exactly what I was looking for, but I didn't find anyone trying to use it on WordPress, so I got a little scared. Any experiences you could share? My first idea was to require the library in functions.php and create a child theme with the models inside a folder. What I really don't know is how it's going to deal with the tables in the database it can't mess with. Well, I'll wait your impressions.


blog page showing as home/landing page despite template change and reading settings

Live site. I'm having trouble pinpointing exactly why the Blog page is showing up as the Home/landing page. I've changed the page template to General/page.php and have WP reading settings set to Front Page as Static/Home, and Posts page as Blog. Any ideas? All of the other pages I've set to use the General template have done so without issue. index.php               <?php get_header(); ?>

Hi, I'm Dylan Elchami-
a health and fitness enthusiast with a passion for inspiring.

My interests are vast and ever changing, but my virtues remain true. I love to motivate, create, make people healthier, stronger, sexier, and flat out better all while building great, unmitigated relationships along the way. Please roam my site and enjoy all the information I post for you, and if you have a question please don't hesitate to contact me- it's your way of giving back for all the free information because helping you is what makes me feel AWESOME.

Stay in touch-

<img src="<?php echo get_template_directory_uri(); ?>/img/facebook.png" alt="Like on Facebook" />

<img src="<?php echo get_template_directory_uri(); ?>/img/twitter.png" alt="Follow on Twitter" />

<img src="<?php echo get_template_directory_uri(); ?>/img/linkedin.png" alt="Connect on LinkedIn" />

                  <?php $my_query = new WP_Query( array( 'posts_per_page' => 3, 'nopaging' => true ) );             echo $post_count;             while ( $my_query->have_posts() ) : ( $my_query->the_post() ); ?>

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

                     <?php the_post_thumbnail( array(120,102) ); ?>

             <?php endwhile; ?>
          <?php get_sidebar(); ?>          <?php get_footer(); ?>      page.php               <?php     /*     Template Name: General     */     ?>          <?php get_header(); ?>

             <?php if(have_posts()) : while(have_posts()) : the_post(); ?>             <?php endwhile; ?>             <?php else : ?>
I'm not sure what you're looking for.
             <?php endif; ?>

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

written by <?php the_author(); ?> on <?php the_date(); ?>

                 <?php the_content('read more...'); ?>

          <?php get_sidebar(); ?>          <?php get_footer(); ?>


How do I create a gallery page?

I've been pulling my hair out trying to figure out how to make a photo gallery page. I hope I can explain it in a way everyone can understand. I have alot of galleries on my site and I would like to display them on one page and have one image as a link to open that gallery post. Like the gallery on this theme http://themes.devilcantburn.com/stereoline/gallery/. I'm kinda new to wordpress and not sure what the best way of displaying the galleries are, someone suggested creating a page template, which I tried but i was too complicted for me to work out how to add the images to the links. I would prefer to use coding rather then a plugin but at this point i'm willing to try anything as long as i get the result i need. I like the way my galleries currently display on my site, but not the way they are displayed when your searching through them. (http://bgpworld.com/?cat=157). If anyone has a solution I would be really grateful. Thanks


Sort users by custom user meta value

I'm trying to sort users by a custom meta value "user_business" which is their business name that way when users are listed they're sorted alphabetically by their business name as they should be. I'm currently using:               <?php                             // WP_User_Query arguments                             $args = array (                                 'exclude'        => array( 1 ),                                 'count_total'    => true,                                 'fields'         => 'all_with_meta',                             );                                       // The User Query                             $user_query = new WP_User_Query( $args );                                  // The User Loop                             if ( ! empty( $user_query->results ) ) {                                 foreach ( $user_query->results as $user ) { ?>      Is there a way that I can order users by meta key "user_business"?


Not enough memory

Sometimes after activating a plugin the admin side is blank with a memory error message, sometimes the front page too. The standard fix is to increase the memory in config.php. What is the best way to prevent in advance all or most memory problems to occur ?


Wordpress Action Hooks and Post ID?

I'm creating a very basic Wordpress plugin whose purpose is to display a numerical value beside each post. My Logic for the plugin function ( **plugin.php** ) is this:               <?php     function foo($post_id){     $somevalue=1 //Some random value     add_post_meta($post_id, 'posts_numericalvalue', '0', true) or update_post_meta($_post_id, 'posts_numericalvalue', $somevalue);     }          add_action('post_save', 'foo');     ?>      And in my template's **index.php** , I have (inside the loop):               <?php     ....     printf(__('Permanent Link to %s', 'kubrick'), the_title_attribute('echo=0'));     $numerical_val = get_post_meta($post->ID, posts_numericalvalue);      echo 'this post has a value of ' .$numerical_val;     ....     ?>      1) The code above is obviously not working. I think its because my function in plugin.php requires me to pass the current post's ID, but the action hook doesn't pass the post's current ID I guess (correct me if I'm wrong). How do I pass the post ID to my function inside plugin.php using an action hook? 2) Any other elegant way of doing this? I just need to assign my posts with a numerical value which should be updated with 1 if the post already has one, zero if the post hasn't got one already. Any help is much appreciated. Thanks.


Remove admin menu for custom taxonomy attached to custom post type

I'm trying to create a taxonomy that is sort of hidden.. meaning i intend to adjust the metabox so that you can only select a unique term from 3 options. "featured","normal" or "excluded". but i can't figure out how to remove the administration menu. the following removes the Tags menu item from underneath Posts:               add_action('admin_menu','yoursite_admin_menu');     function yoursite_admin_menu() {         // remove_submenu_page was introduced in 3.1         remove_submenu_page( 'edit.php', 'edit-tags.php?taxonomy=post_tag' );     }      but this doesn't remove the Featured taxonomy from underneath Portfolio               add_action('admin_menu','yoursite_admin_menu');     function yoursite_admin_menu() {         // remove_submenu_page was introduced in 3.1         remove_submenu_page( 'edit.php?post_type=portfolio', 'edit-tags.php?taxonomy=featured&post_type=portfolio' );     }      i've tried it a couple of different ways w/ regards to the slugs, but can't get any of them to work. what am i missing?


How to limit search to first letter of title?

I was wondering if there was a way to make the search only look for the first letter in the posts title, basically let's say my search query is www.mysite.com/?s=q I'd like to get all posts that start with the letter "Q". Is this possible? Thanks in advance.


How to create full header but keep content narrow

I want to set a full header in wordpress theme, while i want to keep the content narrow (center). How can i do that? I'm trying like:
              ...

      It will display background image fine, the title and other text inside the header will be totally in the left side. (As its the wrapper which keeps the content center,and now header is outside of the wrapper). If i put the header inside the wrapper tag, the text inside header is at right place but the header image will also be displayed within the wrapper area only (it will not be shown on full body). I want to have one image in header background, and a different image in body background. I will be thankful if you can help me with this problem.


Problem creating a table with dbDelta

I'm working on a plugin that _was_ creating a table successfully. However, I decided to test it in a fresh install of Wordpress (on my local server) and now the table is not being created in my activation code. Instead I am getting the error message: > The plugin generated 149 characters of unexpected output during activation. > If you notice “headers already sent” messages, problems with syndication > feeds or other issues, try deactivating or removing this plugin. Here is my code:               function nc_create_location_table() {         // makes the location table         global $wpdb;         global $simple_location_version;              $table_name = $wpdb->prefix . "nc_location";              $installed_ver = get_option( "simple_location_version" );              if( $installed_ver != $simple_location_version ) {             $sql = "CREATE TABLE " . $table_name . " (                     location_id MEDIUMINT(9) NOT NULL AUTO_INCREMENT,                     PRIMARY KEY  (location_id),                         name VARCHAR (100),                         street_no VARCHAR (5),                         street_name VARCHAR (75),                         city VARCHAR (75),                         province_state VARCHAR (75),                         postal_code VARCHAR(10),                         country VARCHAR (75)                 );";                  require_once(ABSPATH . 'wp-admin/includes/upgrade.php');             dbDelta($sql);                  update_option("simple_location_version", $simple_location_version);              }              $tmp = get_option('nc_location_options');              if(($tmp['chkbox_reset']=='on')||(!is_array($tmp))) {         echo 'setting defaults';             $arr = array(                 "nc_location_zoom"=>10,                  "nc_location_width" => "200",                  "nc_location_height" => "200",                  "nc_location_drop_down_maptype" => "road",             );             update_option('nc_location_options', $arr);         }     }          register_activation_hook(__FILE__,'nc_create_location_table');      When I check my tables, I see that my table hasn't been created, and also I am getting an error message. If anyone can shine a light on why code that _was_ working is now not working (and also, is it possible to see _where_ the unexpected output is...as there's no display as to what the error is other than this message)?


Passing inputs from one column to the Other within a post

I have a post with 2 column layout. The first column has an mp3 player. I am thinking of adding a Lyrics window in the second column. Based on the song selected by the user, the Lyrics window will display the Song Lyrics. (without refreshing the whole page). Is this possible in a self-hosted wordpress site? Thanks for helping.


Help with walker for nav

For some reason, this walker won't work when I pass in `'echo ' => 0`, it always prints the nav, and never returns the nav as a var. I can't seem to figure out where it's by passing that in wordpress. Any chance anyone can spot the problem?               function bones_main_nav() {         $menu_args = array(             'menu' => 'main_nav', /* menu name */             'menu_class' => 'nav',             'echo ' => 0,             'theme_location' => 'main_nav', /* where in the theme it's assigned */             'container' => 'false', /* container class */             //'fallback_cb' => 'bones_main_nav_fallback', /* menu fallback */             'depth' => '2', /* suppress lower levels for now */             'walker' => new description_walker()         );              echo wp_nav_menu($menu_args);         /*         if(function_exists('new_beginnings')) {             $topNav = wp_get_cache('topNav');             if ($topNav === false) {                 $topNav = wp_nav_menu($menu_args);                 print_r($topNav);                 wp_set_cache('topNav', $topNav, 4000);             }             echo $topNav;         } else {             echo wp_nav_menu($menu_args);         }         */     }                                   // this is the fallback for header menu     function bones_main_nav_fallback() {         // not calling this in case of multiple level pages - hope to add dropdown menu as an enhancement         //wp_page_menu( 'show_home=Home&menu_class=menu' );     }          // this is the fallback for footer menu     function bones_footer_links_fallback() {         /* you can put a default here if you like */     }          // Menu output mods     class description_walker extends Walker_Nav_Menu {           function start_el(&$output, $item, $depth, $args) {                 global $wp_query;                 $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';                      $class_names = $value = '';                      // If the item has children, add the dropdown class for bootstrap                 if ( $args->has_children ) {                     $class_names = "dropdown ";                 }                      $classes = empty( $item->classes ) ? array() : (array) $item->classes;                      $class_names .= join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );                 $class_names = ' class="'. esc_attr( $class_names ) . '"';                      $output .= $indent . '
ID . '"' . $value . $class_names .'>';                      $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';                 $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';                 $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';                 $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';                 // if the item has children add these two attributes to the anchor tag                 if ( $args->has_children ) {                     $attributes .= 'class="dropdown-toggle" data-toggle="dropdown"';                 }                      $item_output = $args->before;                 $item_output .= '';                 $item_output .= $args->link_before .apply_filters( 'the_title', $item->title, $item->ID );                 $item_output .= $args->link_after;                 // if the item has children add the caret just before closing the anchor tag                 if ( $args->has_children ) {                     $item_output .= '';                 }                 else{                     $item_output .= '';                 }                 $item_output .= $args->after;                      $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );                 }                  function start_lvl(&$output, $depth) {                 $indent = str_repeat("\t", $depth);                 $output .= "\n$indent
\n";             }                  function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output )                 {                     $id_field = $this->db_fields['id'];                     if ( is_object( $args[0] ) ) {                         $args[0]->has_children = ! empty( $children_elements[$element->$id_field] );                     }                     return parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );                 }               }


SQL Query members by profile fields Buddypress

i am trying to add a profile based search option into my existing plugin. my plugin already search members by distance within a certain radius and i want to add the option to filter results by profile fields. what i am trying to do is getting the user id that has the matching values entered in the search form. i am trying something like:               SELECT user_id FROM {$bp->profile->table_name_data}      WHERE (field_id1 = "field1" AND value1 = "value1")     AND (field_id2 = "field2" AND value2 = "value2")     AND (field_id3 = "field3" AND value3 = "valu3")     ........      but this doesn't work. it will work with the WHERE clause only but not when i am adding the ANDs. i assume this is have something to do with joins maybe? any help would be much appreciated.


Can someone explain Wordpress caching, and what's the best in my scenario?

I'm creating a website that has two basic user groups: Subscribers and Editors. Bot can create posts via a custom form using `wp_insert_post()`, but Editors are allowed to mark a post as private, effectively sharing a single post only among other Editors. As Wordpress already filters private posts out of the loop for anyone lower than Editors, i'm wondering how this will affect my caching because (as far as I understand) I'll have two caches: one showing posts to Subscribers, and one showing posts to Editors which also includes private posts. Within the loop I'm using:   * `current_user_can()`: to include or exclude some post content based on Subscriber/Editor/Administrator   * `get_post_status()`: to include or exclude some post content based on if the post is "private" or "published"   * `get_post_meta()`: to retrieve various custom fields Right now I'm using 26 queries in 0.198 seconds on index.php and 28 queries in 0.193 seconds on single.php. How would one effectively cache this? I don't have any caching plugin yet but I do have access to xCache. Many thanks!


Automatic Theme Upgrade hooks?

If you do a radical update of a theme, can you prevent people from unintentionally upgrading until they have read and approved a warning telling them the changes might break their child themes? Or, is it best to fork your theme and call it Theme2 or something similar?


How to allow specific extensions and file size to wp_mail attachment?

I am trying to create a form with an attachment option that will be sent to an email when the form is submitted on a wordpress site. My codes work fine and it sends email in a HTMKL table format to my email address. Also I am able to send attachment using the codes. The issue arises when I consider the attachment file extensions and file size. I do not know that how to restrict big size of files and set attachments for some allowed extensions only. My code is:               <?php     //Setup an empty array.     $errors = array();          if($_POST["submit"]) {         $to = "myemail@gmail.com";         $subject = "New reservations request";         $hotel = $_POST["hotel_url"];         $sender = $_POST["sendername"];         $senderEmail = $_POST["senderEmail"];              //Check the name and make sure that it isn't a blank/empty string.         if(empty($sender)){             //Blank string, add error to $errors array.                     $errors['sendername'] = "Please enter your name!";         }              /*  attachment */            move_uploaded_file($_FILES["attachment"]["tmp_name"],WP_CONTENT_DIR .'/uploads/'.basename($_FILES['attachment']['name']));         $attachments = array(WP_CONTENT_DIR ."/uploads/".$_FILES["attachment"]["name"]);                  if(empty($errors)){                  $mailBody = "

                             No	                             Item	                             Description

                             01	                             Hotel	                             $hotel

                             02	                             Name	                             $sender

                             03	                             E-Mail	                             $senderEmail

";                        $headers = array('From: '.$_POST['sendername'].' <'.$_POST['senderEmail'].'>');                      $mail_sent = wp_mail( $to, $subject, $mailBody, $headers, $attachments );                }         }              if ($mail_sent) {     ?>
Request sent
          <?php      } else {     ?>          <form id="" name="" action="<?php echo get_permalink(); ?>" method="post" enctype="multipart/form-data">     <input type="hidden" name="hotel_url" value="<?php echo get_permalink();?>" />

Your Details

Name

                 <input type="text" name="sendername"/>                 <?php if(isset($errors['sendername'])) { echo ''.$errors['sendername'].''; } ?>

E-Mail

                     <input type="email" name="senderEmail" pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$" required value="<?PHP if(!empty($errors)) { echo $senderEmail;} ?>"/>

                Select A File To Upload:         <input type="file" name="attachment">              <input type="submit" value="Submit" name="submit">     </form>          <?php     }     ?>      The above code send the attachment to my mail and it saves the file into my uploads dirctory. I know I have to do something around this area **/* attachment */** to allow specific extensions and size of the file. but how to do that? eg: if I have to allow .png, .jpg, .pdf only and the maximum file is 1mb how can I do that? where and what code I have to amend into the above codes?


Help with query function get_calendar()

I have a own "get_calendar" function (plugin) cloned from the default wp function. I just wanna see posts that have a certain custom field set (true). How do I add this goal into:               $gotsome = $wpdb->get_var("SELECT 1 as test FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 1");      the name of the custom field checkbox is               ua_allow_future_check      So if this field returns true, I want those posts to show in the calendar!


Future post ID not showing

I'm attempting to send an email notification when a scheduled post is published. I've tried quite a few different ways. I receive the email but the id (and other random details) are not published with it. Is there something that I'm fundamentally missing in this code? I tried both outside and inside and a few other ways. The dap post is a fictional custom post type that I was initially testing on and then thought that it may be custom post types. So I used a regular post and nothing. I also disabled all plugins except for the one containing the code below. Still nothing worked. I can see the details if I publish immediately but not from when it's scheduled.               add_action( 'init', 'create_dap_post_types' );          function create_dap_post_types() {         register_post_type( 'dap',              array(                 'labels' => array(                     'name' => __( 'Daps' ),                     'singular_name' => __( 'Dap' )                 ),                 'public' => true,             )         );     }                    function status_changes( $new_status, $old_status, $post ) {      global $post;      global $wpdb;      global $wp_query;           if ($new_status == 'publish') {         //$post = get_post($id);             $id = get_the_ID();         $post = get_post($id);         $post_title = $post->post_title;           // $author = get_userdata($post->post_author);          // the rest of your function here          $link = get_permalink($post->ID);         $date = mysql2date('M j Y', $post->post_date);         $category = get_the_category($post->ID);         //$category = $category[0]->cat_name;              $to = "//left blank to void out email";         $subject = $post_title;         $message = "

 schedulenotificte

 Let's begin: author " . //$author .                     " the link? " . $link;         wp_mail( $to, $subjet, $message);      }               }       //add_action( 'transition_post_status', 'status_changes', 100, 3 );               add_action('publish_'. $_POST['post_type'], 'scheduledNotification');     add_action('future_to_publish_dap', 'scheduledNotification');     add_action('new_to_publish_dap', 'scheduledNotification');     add_action('draft_to_publish_dap', 'scheduledNotification');     add_action('pending_to_publish_dap', 'scheduledNotification');     add_action('future_to_publish_dap', 'scheduledNotification');     add_action('auto-draft_to_publish_dap', 'scheduledNotification');     add_action('pending_to_future', 'scheduledNotification');     add_action('approved_to_future', 'scheduledNotification');          function scheduledNotification() {       global $post;       global $wp_query;       $post = $wp_query->post;       //$post = get_post($id);       $my_postid = $post->ID;//This is page id or post id       $content_post = get_post($my_postid);       $content = $content_post->post_content;       $content = apply_filters('the_content', $content);       $content = str_replace(']]>', ']]>', $content);            $id = get_the_ID();       $post = get_post($id);            $link = get_permalink($post->ID);       $date = mysql2date('M j Y', $post->post_date);       $category = get_the_category($post->ID);                 $to = "//left blank";       $subject = $post->post_title;       $message = "

 schedulenot

Let's begin shall we?:

author " . //$author .                 " the link? " . $link .                  "
 this is the content
" . $content .                 "
 this is the idea
" . $post->ID;       wp_mail( $to, $subject, $message);     }          function hereIsATest ($post) {       global $post;       global $wp_query;       $post = $wp_query->post;            $my_postid = $post->ID;//This is page id or post id       $content_post = get_post($my_postid);       $content = $content_post->post_content;       $content = apply_filters('the_content', $content);       $content = str_replace(']]>', ']]>', $content);                      $subject = $post->title;       $message = "
 hereisatest
 this is the id " . $post->ID .              "This is content " . $post->content .             "
 the title
" . $post->post_title .             "what else there" . $subject .              "
 id
" . get_the_ID() .              "
 id_
" . $post->ID .             "
 id
" . $post->content_post;        wp_mail("//blank", $subject , $message);     }          add_action('publish_'. $_POST['post_type'], 'hereIsATest');               add_action( 'transition_post_status', 'inLoop', 100, 3 );     add_action ('wp_transition_post_status', 'inLoop');          function inLoop($new_status, $old_status, $post) {       global $post;       $thePostID = $post->ID;            if ($new_status == 'publish') {         $to = "blank";         $subject = $thePostID;         $message = "
 This is insidethe loop
" . $thePostID .                 "
 the title ////" . get_the_title() .                 "
 get the title
" . get_the_title() .                  "
 old status is:
 " . $old_status .                  "
 new status is:
 " . $new_status .                  "
 dump post:
" . $rpost;              wp_mail($to, $subject, $message);         }     }          add_action( 'transition_post_status', 'outLoop', 100, 3 );     add_action('wp_transition_post_status', 'outLoop');          function outLoop($new_status, $old_status, $post) {       // Works in single posts outside of the loop       global $wp_query;            if ($new_status == 'publish') {         $thePostID = $wp_query->post->ID;         //$rpost = print_r($post, true);         $to = "email";         $subject = $thePostID;         $message = "
 This is outside the loop
" . $thePostID .                  "
 get the title
" . get_the_title() .                  "
 old status is:
 " . $old_status .                  "
 new status is:
 " . $new_status .                  "
 dump post:
";              wp_mail($to, $subject, $message);        }          }


Calling a class method instantiated by ajax call in wordpress

I have an ajax call in Wordpress that instantiate a class. I want to be able to call the class methods in other functions. Here is the code to demonstrate. Ajax call:                 kalimahJS(".a").click(function() {                  var data = {                 'action': 'list_items'             };                  kalimahJS.ajax({                 url: ajaxurl,                 type: "POST",                 data: data,                 success: function(data, textStatus, jqXHR) {                     console.log(data);                 }             })         })      PHP class:               <?php     class Plugin     {         var $itemsClass;              public function __construct()         {                  add_action('wp_ajax_list_items', array(                 $this,                 'list_items'             ));         }              function list_items()         {             // Get class instance             $this->itemsClass = new itemsClass();                  echo "success";             die();         }              function another_function()         {             // Can't access this function             $this->itemsClass->list_items();                  return false;         }     }      I am not able to access `list_items()` method of `$this->itemsClass` since it is instantiated from an Ajax call. Is there another way to do this?


How to export and import woocommerce product reviews along with product

I want to export and also import all the product reviews along with product meta in woocommerce. I have tried woocommerce product import csv suite, WP CSV, export comments. They don't export comments along with product details. either comments separately or product data separately not together. Any help is appreciated.


Adding content to custom taxonomy category pages

I can't figure out or find an answer on how to enable the description in the custom taxonomy category pages. Under description field it says: "The description is not prominent by default; however, some themes may show it.". I've managed to enable it to normal category pages by adding this code to archive.php               <?php echo category_description(); ?>      But it's still disabled on taxonomy pages. Any help will be appreciated. **Problem solved** I find out that my theme has taxonomy.php where this code               <?php echo term_description(); ?>      needs to be added to make the description visible on custom taxonomy page. Thanks to @PieterGoosen for helping me out.


Show billing_address, sku and more in email

I'm setting up my first store with woocommerce, and I'm nearly done without great problems. My php skills are very limited and I'm stuck on a little s.th. I need some data in a very special format in the admin-new-order-mail. So I copied the template file into my custom theme and tried to get the necessary fields. I was able to get some of them, but the address data I get only in a simple array provided by a function.               $adresse = $order->get_billing_address( );      I get this: blablastr. 55, Hometown, 22321, DE How can I get the field billing_adress_1 directly? I also need to loop through the products to get the sku, price, and more. Also shipping and payment infos. I don't understand the API pages on wootheme.com. Maybe someone can point me into the right direction. This is my code so far. I put it at the bottom of admin-new-order.php               $ordNr = $order->get_order_number();     $ordNr = substr($bestNr,4,10);     $date = date_i18n( woocommerce_date_format(), strtotime( $order->order_date ) );     $time = date_i18n( woocommerce_time_format(), strtotime( $order->order_date ) );     $adresse = array();     $adresse = $order->get_billing_address( );     $officerCode = '##OFFICER-START##
       Date:' . $date . '
       Time:' . $time . '
' .       $ordNr . '|' . $ordNr . '| | |' . $order->billing_email . '|' . $order->billing_phone . '
       |

       ##comment##

     ##OFFICER-END##';     print($officerCode);      As I mentioned, I'm not a programmer and appreciate any help.


Simple Calendar

I'm using the ACF (Advanced Custom Fields) and selected the date picker. I'm wondering if anyone has created a simple calendar plugin that can grab the field and produce a calendar. How should I do that?


Is there a way to display others posts in my post?

Is there a way I can pull in the content from another post into my own post without writing code? What I mean is that I have created a post called, "Apple post". I also created a post called, "Orange port". I create a third post called, "Fruit". In this post I want to display the content from the first two. I also have second blog on another server that has, "Pear post". I want to pull the content in from that as well. Will Wordpress do this?


Fetching Video From YouTube Automatically

I am using WordPress, and a theme called DeTube. Is kind of a YouTube clone, and I use this website to upload mainly videos from YouTube. Is there anyway to fetch videos and populate all the required fields, name, url, tags, using a plug in. Is there any other method to do this. Like for example fetching a particular video just by adding it's url? **Edit** I found this great plugin called External Videos, it does exactly what i want, but is not interrogated with the theme I am working on, it just fetches the videos and post them as regular posts. I guess if there is no ready solution, i will have to do the coding by my- self.


Using characters to separate menus in navigation bar

I’m attempting to modify my blog's navigation menu (http://reasonandfolly.com/) to replicate what is here: http://chimpchomp.us/ Two pieces represent a challenge: 1. The separators 2. The line on right/left of menus. I’m fairly new to WP and can’t be certain if this requires a change to CSS or PHP. Any guidance would be appreciated!


Remember form field values with page navigation

I have a form on a page template that controls which posts show up on the page and how those posts are ordered. You can see what I mean here: http://www.theseattlevine.com/the-vine The questions I have is, how do I get the form to "remember" the selected values when the user uses the pagination at the bottom to go to the next page or a specific page? EDIT: Looks like sessions in the answer, but I can't get it to work. Any help is appreciated. Here is my current code after formatting and adding the suggestion below. It's still not working.                   <?php      /**      * Template Name: The Vine      *      * @package WordPress      * @subpackage Twenty_Eleven      * @since Twenty Eleven 1.0      */ ?>          <?php         //Form Processing-----------------------------------------------------------------         //Display chosen number of posts per page         $gridperpage = array("8", "16", "32", "64", "96");         $listperpage = array("10", "20", "40", "65", "100");         $perpagecurrent = $_POST['perpage'];         //If the number is already set, use it              if (isset($_POST['perpage'])) {             $perpage = $_POST['perpage'];         }              //If the number of posts matches the multiples of the grid numbers AND we're on the list page, switch the count to 20              if ((!in_array($perpagecurrent, $listperpage)) && (($_POST['view']) == 'list') ){             $perpage = '20';         }              //If we're on the grid page and the number is a multiple from the list page, switch to 32. Also do this if there is no value set yet since the default view is the grid         elseif (((!in_array($perpagecurrent, $gridperpage)) && (($_POST['view']) == 'grid')) || (!$_POST['perpage']) ){             $perpage = '32';         }              //Display chosen post types              if ((!$_POST['userposts']) && (!$_POST['posts'])) :         $posttype= array('tsv_userpost', 'post');         elseif ((($_POST['userposts']) == 'true') && (($_POST['posts']) == 'true')) :         $posttype= array('tsv_userpost', 'post');         elseif ((($_POST['userposts']) == 'true') && (($_POST['posts']) == '')) :         $posttype= 'tsv_userpost';         elseif ((($_POST['userposts']) == '') && (($_POST['posts']) == 'true')) :         $posttype= 'post';         endif;         //Display only selected User Post Categories              if (isset($_POST['showvideos']) && ($_POST['showvideos'] == 'true')) {             $cats[]='user-video';         }                   if (isset($_POST['showimages']) && ($_POST['showimages'] == 'true')) {             $cats[]='user-image';         }                   if (isset($_POST['showaudio']) && ($_POST['showaudio'] == 'true')) {             $cats[]='user-audio';         }                   if (isset($_POST['showwriting']) && ($_POST['showwriting'] == 'true')) {             $cats[]='user-writing';         }                   if (isset($_POST['showevents']) && ($_POST['showevents'] == 'true')) {             $cats[]='user-event';         }              ;         $upostcat = implode(',',$cats); //Put all the selected categories into the $upostcat array         ?>      <?php          //Sort posts by selected method              if (isset($_POST['sortby']) && ($_POST['sortby'] == 'date')) {             $sortmetakey='';             $sortby='date';         }              elseif (isset($_POST['sortby']) && ($_POST['sortby'] == 'rating')) {             $sortmetakey='ratings_average';             $sortby='meta_value_num date';         }              elseif (isset($_POST['sortby']) && ($_POST['sortby'] == 'favscount')) {             $sortmetakey='wpfp_favorites';             $sortby='meta_value_num date';         }              elseif (isset($_POST['sortby']) && ($_POST['sortby'] == 'viewcount')) {             $sortmetakey='_count-views_all';             $sortby='meta_value_num date';         }              ;         ?>          <?php //Session              session_start();         // your formfields         $post_fields = array( 'sortby', 'view', 'perpage' , 'posts' , 'userposts' , 'showaudio' , 'showvideos' , 'showimages' , 'showevents' , 'showwriting' );         $form_data = array();         // copy needed form data from $_POST array         foreach ( $post_fields as $key )         if ( isset( $_POST[$key] ) )    $form_data[$key] = $_POST[$key];         // save your form data in a session if no form data was saved before              if (  ! empty( $form_data )    &&  ! isset( $_SESSION['form_data'] ))  $_SESSION['form_data'] = serialize( $form_data );         // read saved form data from session              if (  isset( $_SESSION['form_data'] )    &&  ! empty( $_SESSION['form_data'] )    &&  empty( $form_data ))  $form_data = unserialize( $_SESSION['form_data'] );         ?>                     <?php          //Start of content         get_header();         ?>
     <?php  //Search the vine ?>
         <form method="get" id="searchform" action="<?php  echo esc_url( home_url( '/' ) ); ?>">             <?php  _e( 'Search', 'twentyeleven' ); ?>             <input type="text" class="field" name="s" id="vinesearch" placeholder="<?php  esc_attr_e( 'Search', 'twentyeleven' ); ?>" />             <input type="submit" class="submit" name="submit" id="searchsubmit" value="<?php  esc_attr_e( 'Search', 'twentyeleven' ); ?>" />         </form>
     <?php  //Browse the vine ?>     <?php      //Start filter menu      ?>         <form method="post" id="vine-sort-form" >         <?php                 if ($_SERVER['REQUEST_METHOD']!='POST') {             $notsubmitted='checked';             $notsubmitted_dd='selected';         }              ;         //Auto-select all post types when user first selects to show userposts                if ('true' == ($_POST['userposts']) && ('' == ($_POST['showvideos'])) && ('' == ($_POST['showaudio'])) && ('' == ($_POST['showimages'])) && ('' == ($_POST['showwriting'])) && ('' == ($_POST['showevents'])) ) {             $userpostselected='checked';         }              ;         //Dont allow both post types to go unselected              if ('true' != ($_POST['userposts']) && ('true' != ($_POST['posts']))) {             $noselectnone='checked';         }              ;         ?>         <?php php//Choose View  ?>         <?php      if (($_POST['view'] == 'grid') || (!isset($_POST['view']))) { ?>         <input id="viewgrid" type="radio" name="view" value="grid" onclick="this.form.submit()" <?php                   if ('grid' == ($_POST['view'])) :             echo 'checked';             elseif ($notsubmitted) :             echo $notsubmitted;             endif ?> style="display:none;">                  <?php  } else { ?>           <input id="viewgrid" type="radio" name="view" value="grid" onclick="this.form.submit()" <?php                   if ('grid' == ($_POST['view'])) :             echo 'checked';             elseif ($notsubmitted) :             echo $notsubmitted;             endif ?> style="display:none;">                  <?php  } ?>         <?php      if ($_POST['view'] == 'list') { ?>         <input id="viewlist" type="radio" name="view" value="list" onclick="this.form.submit()" <?php                   if ('list' == ($_POST['view'])) :             echo 'checked';             endif ?> style="display:none;">                  <?php  } else { ?>         <input id="viewlist" type="radio" name="view" value="list" onclick="this.form.submit()" <?php                   if ('list' == ($_POST['view'])) :             echo 'checked';             endif ?> style="display:none;">                  <?php  } ?>

Per page:
         <?php  if ((($_POST['view']) == 'grid') || (!isset($_POST['perpage']))) { ?>         <select name="perpage" id="perpage">             <option value="8" <?php                   if ('8' == ($_POST['perpage'])) :             echo 'selected="selected"';             endif;             ?> onclick="this.form.submit()">2 rows (8)</option>             <option value="16" <?php                   if ('16' == ($_POST['perpage'])) :             echo 'selected="selected"';             endif;             ?> onclick="this.form.submit()">4 rows (16)</option>             <option value="32" <?php                   if ('32' == ($_POST['perpage'])) :             echo 'selected="selected"';             elseif ((in_array($perpagecurrent, $listperpage))) :             echo 'selected="selected"';             elseif (!$_POST['perpage']) :             echo 'selected="selected"';             endif;             ?> onclick="this.form.submit()">8 rows (32)</option>             <option value="64" <?php                   if ('64' == ($_POST['perpage'])) :             echo 'selected="selected"';             endif;             ?> onclick="this.form.submit()">16 rows (64)</option>             <option value="96" <?php                   if ('96' == ($_POST['perpage'])) :             echo 'selected="selected"';             endif;             ?> onclick="this.form.submit()">24 rows (96)</option>         </select>         <?php  } else { ?>         <select name="perpage" id="perpage">             <option value="10" <?php                   if ('10' == ($_POST['perpage'])) :             echo 'selected="selected"';             endif;             ?> onclick="this.form.submit()">10 posts</option>             <option value="20" <?php                   if ('20' == ($_POST['perpage'])) :             echo 'selected="selected"';             elseif ((in_array($perpagecurrent, $gridperpage))) :             echo 'selected="selected"';             elseif (!$_POST['perpage']) :             echo 'selected="selected"';             endif;             ?> onclick="this.form.submit()">20 posts</option>             <option value="40" <?php                   if ('40' == ($_POST['perpage'])) :             echo 'selected="selected"';             endif;             ?> onclick="this.form.submit()">40 posts</option>             <option value="65" <?php                   if ('65' == ($_POST['perpage'])) :             echo 'selected="selected"';             endif;             ?> onclick="this.form.submit()">65 posts</option>             <option value="100" <?php                   if ('100' == ($_POST['perpage'])) :             echo 'selected="selected"';             endif;             ?> onclick="this.form.submit()">100 posts</option>         </select>         <?php  } ?>
Sort by:
         <input type="radio" name="sortby" value="date" onclick="this.form.submit()" <?php               if ('date' == ($_POST['sortby'])) :         echo 'checked';         elseif ($notsubmitted) :         echo $notsubmitted;         endif;         ?>>Date
         <input type="radio" name="sortby" value="rating" onclick="this.form.submit()" <?php               if ('rating' == ($_POST['sortby'])) :         echo 'checked';         endif ?>>Rating
         <input type="radio" name="sortby" value="favscount" onclick="this.form.submit()" <?php               if ('favscount' == ($_POST['sortby'])) :         echo 'checked';         endif ?>># of Favs
         <input type="radio" name="sortby" value="viewcount" onclick="this.form.submit()" <?php               if ('viewcount' == ($_POST['sortby'])) :         echo 'checked';         endif ?>># of Views

Post Type:
         <input type="checkbox" name="posts" value="true" onclick="this.form.submit()" <?php               if ('true' == ($_POST['posts'])) :         echo 'checked';         elseif ($notsubmitted) :         echo $notsubmitted;         elseif($noselectnone) :         echo $noselectnone;         endif;         ?>>Featured Posts
         <input type="checkbox" name="userposts" value="true" onclick="this.form.submit()" <?php               if ('true' == ($_POST['userposts'])) :         echo 'checked';         elseif ($notsubmitted) :         echo $notsubmitted;         elseif($noselectnone) :         echo $noselectnone;         endif;         ?>>User Posts

             <?php               if ('true' == ($_POST['userposts'])) {                  if ('' == ($_POST['posts'])) {                 ?>             <input type="checkbox" name="showvideos" value="true" onclick="this.form.submit()" <?php                       if ('true' == ($_POST['showvideos'])) :                 echo 'checked';                 elseif ($notsubmitted) :                 echo $notsubmitted;                 elseif ($userpostselected) :                 echo $userpostselected;                 endif;                 ?>>Video
             <input type="checkbox" name="showimages" value="true" onclick="this.form.submit()" <?php                       if ('true' == ($_POST['showimages'])) :                 echo 'checked';                 elseif ($notsubmitted) :                 echo $notsubmitted;                 elseif ($userpostselected) :                 echo $userpostselected;                 endif;                 ?>>Images
             <input type="checkbox" name="showwriting" value="true" onclick="this.form.submit()" <?php                       if ('true' == ($_POST['showwriting'])) :                 echo 'checked';                 elseif ($notsubmitted) :                 echo $notsubmitted;                 elseif ($userpostselected) :                 echo $userpostselected;                 endif;                 ?>>Writing
             <input type="checkbox" name="showaudio" value="true" onclick="this.form.submit()" <?php                       if ('true' == ($_POST['showaudio'])) :                 echo 'checked';                 elseif ($notsubmitted) :                 echo $notsubmitted;                 elseif ($userpostselected) :                 echo $userpostselected;                 endif;                 ?>>Audio
             <input type="checkbox" name="showevents" value="true" onclick="this.form.submit()" <?php                       if ('true' == ($_POST['showevents'])) :                 echo 'checked';                 elseif ($notsubmitted) :                 echo $notsubmitted;                 elseif ($userpostselected) :                 echo $userpostselected;                 endif;                 ?>>Events
             <?php              }              }              ?>
               </form>
<?php  //.thevinemenu ?>
<?php //.vine-display ?>             <?php         // The Query           $counter = 1;         $paged = (get_query_var('paged')) ? get_query_var('paged') :         1;         $the_query = new WP_Query( array('post_type'=> $posttype,'posts_per_page'=>$perpage,'paged'=> $paged,'category_name'=>$upostcat,'meta_key' =>$sortmetakey, 'orderby' =>$sortby, 'order'=> 'DESC'));         //Top Navigation         wp_pagenavi( array( 'query' => $the_query ) );         //Start loop         while ( $the_query->have_posts() ) :         $the_query->the_post();              if ('grid' == ($_POST['view']) || ($_SERVER['REQUEST_METHOD']!='POST')) :         get_template_part('the-vine', 'grid');         elseif ('list' == ($_POST['view'])) :         get_template_part('the-vine', 'list');         endif;         ?>       <?php  endwhile; ?>
<?php  wp_pagenavi( array( 'query' => $the_query ) ); ?>
     <?php  wp_reset_query(); ?>
     <?php  get_footer(); ?>


Make change in media library affect images in published articles

Is there any way/plugin to make wordpress change the description/alt text/caption of an image used in already written articles if I change any of those texts of that specific image in the media library?


Categories in media library

I want to add a rather big sound collection to the media library. The problem is that i can't add category to the bunch of files while uploading them... I even can't add it to one uploading file.... And I can't find the way to solve this problem. It's a big work to add the category to thousands of sound files. Is it possible to add a tag field or a catagory field to the media library and include appropriate field to the uploading media library page? The plugins in answer do not allow to set a category in the time of uploading... probably it's time to add more features for users to work with media library in wordpress?


Sysc the content and pages between two WordPress install?

I've some questions about Sysc the content and pages between two WordPress install we just build a site: Example.com.au and we need to sync all product pages (and some other pages) to dealer sites , but need custom header & footer + other pages for example, There are dealerships who sell the caravans (Testing.com.au sample dealer ) we will take a copy of Example.com.au and customize it as per clients logo and dealer specific content but we want to have certain pages be 'pulled / sync'd' from Example.com.au , so when they update Example.com.au, the changes go out to the other dealers sites like Testing.com.au Any help and possible solutions ? Cheers


Category page when using static front page

I'm using a "static" front page with the posts on a page called News. Is it possible to make the categories use that as the base? Like this: /news/[category_name]/ And is it also possible to do the same with posts? /news/2012/09/17/post-title


Registration page background color covering 1 screen not covering full page

Good Day, I have been researching this for a few days and cannot find a solution. The website is http://gwendolinesroadtrip.com/ The background color of the registration page is not filling the entire page. I have tried almost all suggestions without touching the original WordPress files or Twenty Twelve theme files. The plugins I am using are jonradio Private Site and Register Plus Redux. I have removed them both but the problem is still there. Thank you in advance for any help Debbie


Is there a way to change select-list for new custom taxonomy?

When you add a category in the admin-panel, the adminstrator can select it's parent. Something like:               - Category1     -- Subcategory1 to Category1     -- Subcategory2 to Category1     -- Subcategory3 to Category1     ....     - Category2     -- Subcategory1 to Category2     -- Subcategory2 to Category2     -- Subcategory3 to Category2     ....       I have created a custom taxonomy. Is there a way to change these options to be only parent - selection like this for this specific taxonomy?               - Category1     - Category2     ....       ? (Is there a hook for this for a taxonomy at all?)


Display taxonomy with a maximum number of letters

I'm looking for a function which displays a post's taxonomy with a maximum number of letters. I've achieved with title (How to limit the max number of characteres in the title that are displayed), but I'm not able to do it with taxonomies. E.g. I have this:               echo '
'.get_the_term_list( get_the_ID(), 'Artistas', '
', '
' ).'
';      This shows the "Artistas" taxonomy. I want to show only the first 10 letters. Any idea of how to hook in to change it?


How to run a subdirectory multisite install under a subdomain

I am on a VPS running Nginx as a backend server. I want to set up a sub-directory multisite WordPress installation, however I want all sub-sites to be under one sub-domain also. For example: My main site:               domain.com      Subsites:               clients.domain.com/site1     clients.domain.com/site2     clients.domain.com/site3      I realise I can install another copy of WordPress under `clients.domain.com` and use that as the Multisite home, however since `domain.com` is already running WordPress this strikes me as inefficient in terms of management and disk space especially as I only wish to serve a login page at the root of that subdomain anyway. I also realise I can redirect all requests to `clients.domain.com` to `domain.com` however I don't want the subsites or their related files to be accessible via `domain.com/site1`. The subsites should recognise their parent site as being `domain.com`. What is the best method for going about this?


Can you group pages associated to a specific parent menu item in the admin area?

I'm creating a site that has many neighborhood pages (27) and each of those neighborhood pages has a link to a Points of Interest page, History page, and Gallery page. Would that mean that at the end of the day in this particular example i would have to create 108 pages that would be the sum of all the neighborhood pages and each of their Points of Interest, History and Gallery pages combined. I realize that each type of page (Neighborhood, Points of Interest, Gallery and History) has it's own template for each given page type with custom fields for the individual content and specific content that each holds i'm just trying to figure out if that's about how many pages i would be creating? Then is there any way to group these pages for example Neighborhood 1 and its Points of Interest, History and Gallery page so that the admin user could just go to a specific Neighborhood and find all the relevant pages to it together? Or would they all just display in a long list which from what i can tell doesn't even allow you to drag and move in order? Any help would be great, thank you.


How can I let users create and share their own image galleries?

After searching on Google and this site, I found some old, outdated posts regarding this topic, so I figured I'd start a new one. How can I let users create their own public gallery and upload their own pictures to it? I want to set up a central "Gallery" page where users can view all the latest uploads, and choose a specific user's gallery to browse through. Basically, as the admin, I don't want to have to sit there and make separate galleries for each user to upload to (I think that's what NextGen does): I want every user to automatically get one and start uploading to it and share it. Can anyone offer any pointers to a way to do this?


How to add icon over specific thumb

I wanted to do the following, and I know its possible, but I don't know how. I'm looking at `in_category`, but it doesn't make to much sense. Basically what I want to do, for an example on my homepage, category page and similar posts are shown with title and a thumb. And for this thumbs I want to add function like this If post/thumb is inside category video -> add video icon above it. I guess with css I would need to position it, for an example at the bottom right corner. Any ideas how to this


Ways to create a paid wordpress plugin?

I can't find a lot of information on google about creating a paid wordpress plugin. I'm already versed into plugin development, but what are my options to have a freemium model ? I would like to restrict some parts of my plugin to paid users but obviously, as every wordpress plugin source code is free, is that really possible ? How do plugins like Gravityforms protect their plugin from being redistributed to the wild ?


how to request a script more than once in wordpress

Can I ask how I can request a script more than once in wordpress. For example:               for($i = 0; $i < 2 ; $i++){     wp_enqueue_script('alerthello.js', 'example.com/example.js');     }      I expect the code to display two hello, but it display one only instead.


delete value 0 in post meta

I have a simple question. I have this code and its correct,               <?php global $wp_query;     $postid = $wp_query->post->ID;     $meta = get_post_meta($postid, 'codigopostal', true);     if($meta != $empty) { echo "(".$meta.")"; } ?>      but when the user don't put nothing, value is 0. I want delete that value on frontpage.               <?php global $wp_query;     $postid = $wp_query->post->ID;     $meta = get_post_meta($postid, 'codigopostal', true);     if($meta != $empty) {         echo "(".$meta.")";     }      else if($meta != 0) {         echo "";     }     ?>      I added else if... but is wrong.