Knowledge base high performance Live Search

I'm trying to build a live search function for a knowledge base plugin so that as soon as a user types something into the search field possible results are loaded below the search field as close to real time as possible. If possible, I'd like to avoid hitting the database with ajax. Instead, I'd like to store possible results in an array and search this array instead of the database. Does anyone have any idea how best to do this? Ideally, I don't want to build the array in real time, I think it should be a batch process that occurs each time the user saves a knowledge base item (this is a custom post type that I've created). So, for example, the array can be built and then stored in a single database field that's loaded as and when the live search is displayed. I have some questions:- 1) Do you think that storing results in an array rather than hitting the database is a feasible approach? 2) Do you have any suggestions as to the best approach of building this array. Should it occur on save, or perhaps it should be triggered by a "Build knowledge base index" button? Which do you think will be best for the end user?


Wordpress 3.3.1 Page template not showing in admin area

I have created a page with the php comment at the start of the file:               <?php     /*     Template Name=> Team Detail     */     ?>      and saved it as team-detail.php in my theme's root directory. Now when I want to add a page with this as the template for that page, I cannot see this template in the admin area under ->add new page-> template. Have tried reactivating the theme to no use.


Choosing the right kind of hosting for a Wordpress multisite

This question is not so much about ISPs and service providers as about the type of hosting that I should choose for a network site. > Should I go for shared hosting, dedicated hosting, VPS or cloud? I am being tasked with building a network of university portals that will be white-labeled and handed over to their respective admins. There's a lot of custom development so I would like to have control over apache modules, php ini settings and mysql. These subdomains are unlikely to be heavily trafficked but need to be secure and fast. Are there specialists out there that you would recommend? Would like to hear about past experiences (positive and negative) with service providers too. UPDATE: Let me just clarify budget here: It should be under $1000 US a year


How to change header dimensions in Wordpress?

How can I alter the requirements for the header dimensions so that I can take an uncropped image and fill the top section (centring the whole image) instead of having white space at the top? I would prefer to just be able to edit the CSS and not bother with child themes, as I don't think I will ever need to upgrade the theme. Here is my site http://carolbadre.wordpress.com/ and here is the uncropped image: http://math.stanford.edu/~vakil/11-245/grr.png


Reseting admin password through PHPMyadmin fails

Following the PHPMyAdmin instructions of this article fails to reset my password properly. I go into WP_Users, find my admin account, click edit, enter my password, change the dropdown to MD5, click save, but this password does not work when I try to login to WP-Admin with this username. Confused.


Pagination with $_POST and $_SESSION

I have a page on my site where in the left column is a set of checkboxes representing taxonomies and in the right column is a list of posts that fall into the selected taxonomies. The user is able to check and uncheck these boxes and submit a form which then shows the results in the right column. That works great, here is the simplified code I'm using:                   <?php session_start();          if (isset($_POST)) {     $_SESSION['filters'] = $_POST;     }     ?>
         <form id="filters" method="POST">             <input type="checkbox" name="filter1" value="term1" />             <input type="checkbox" name="filter1" value="term2" />             <input type="checkbox" name="filter1" value="term3" />             <input type="checkbox" name="filter2" value="term1" />             <input type="checkbox" name="filter2" value="term2" />             <input type="checkbox" name="filter2" value="term3" />     </form>

         <?php         //The query is here, which changes dynamically based on the boxes checked above         I'm using $_SESSION['filters'] to call $_POST variables inside the query         ?>
      The problem is, when Wordpress does its navigation thing, it goes to a URL like mysite.com/thispage/page/2/ which doesn't retain the form values like I need it to. It resets them as if the form has not been submitted at all. How do I get the selected to values to follow the user when they navigate the results pages. This is the first time I'm attempting to use sessions, so I could be on the wrong track altogether. Any help is appreciated.


Categories sorting

I'm using code below to spit out custom post types along with its categories, so Category 1 ---post 1 ---post 2 Category 2 ---post 1 ---post 2 ---post 3 etc. That works well for me, however I would like to be able to sort my categories by count so orderby=count so catgories with larger amount of post will go to the top of the list at the moment that is not working in my code below, any idea why? Many thanks for help                <?php          // List posts by the terms for a custom taxonomy of any post type          $post_type = 'our_drinks';     $tax = ('our-drinks');     $tax_terms = get_terms( $tax, 'orderby=count&order=ASC&hide_empty=0&hierarchical=true');     if ($tax_terms) {         foreach ($tax_terms  as $tax_term) {         $args = array(             'post_type' => $post_type,             "$tax" => $tax_term->slug,             'post_status' => 'publish',             'order' => 'ASC',             'posts_per_page' => -1,             'caller_get_posts'=> 1         );                  $my_query = null;             $my_query = new WP_Query($args);                  if( $my_query->have_posts() ) : ?>                                    <div class="category_title">                                          <?php echo $tax_term->name; ?>                                  </div>                  <?php while ( $my_query->have_posts() ) : $my_query->the_post();  ?>                                                       LOOP CONTENT GOES HERE                                            <?php endwhile; ?>                              v<?php else : ?>             <?php endif; // if have_posts()             wp_reset_query();              } // end foreach #tax_terms     }     ?>


Proper way to change the path of uploads folder for existing WordPress site

Until now I have used default WordPress directory structure, however since I started using GIT, I plan to setup WordPress as a submodule and also change the paths of upload folder. Since the path for existing images is already set in the database, is there a way to change them automatically?


Add button to kitchen sink toggle

I have created a simple function along with a shortcode, my goal is now to add a button in the sink toggle of wordpress so that the user doesn't have to type anything. Is this hard to achieve? how can I do it. I thought this was simple, but by looking at this tutorial http://brettterpstra.com/2010/04/17/adding-a-tinymce-button/ it seems rather complex and you have to do some hacks or something. Is there a quicker way?


Empty permalinks settings in .htaccess

Permalinks not working other than set to "Default'. I want to change it to `/%postname%.html`, and default `.htaccess` is as follows:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>     # END WordPress      But sometimes it becomes …               # BEGIN WordPress          # END WordPress      … whenever I change the settings of Permalinks. I already change the permission of `.htaccess` to `777` and mod_rewrite is working. `AllowOverride All` has been set to my working directory. Any ideas?


Make specific tag visible only to logged in users in front-end

I have this specific tag I need to assign to my posts but I need to hide it from regular visitors so that only logged in people can see it. How do I go about it? What WordPress function/hook should I be looking into? I know that I could use `is_user_logged_in()` and I am also looking into `is_tag()`, but how do I put this together? Currently I'm having it displayed in my single template with `the_tags()`, but it doesn't seem to offer a parameter to exclude a particular tag. Pseudo code would be: if user is logged in then show all tags except a specific tag.


Control verbosity level of WP DEBUG?

I've been at a loss so far and so I thought I'd pose the question: Is there a way to modify the verbosity level of the WP `debug.log` via `wp-config.php` or elsewhere? Just an fyi, here is what I have in my `wp-config.php` to enable logging:               ///////////////////////////////////////////////////     // DEBUG           // Enable WP_DEBUG mode     define('WP_DEBUG', true);          // Enable Debug logging to the /wp-content/debug.log file     define('WP_DEBUG_LOG', true);          // Disable display of errors and warnings      define('WP_DEBUG_DISPLAY', false);     @ini_set('display_errors',0);          // Use dev versions of core JS and CSS files (only needed if you are modifying these core files)     define('SCRIPT_DEBUG', true);          // END DEBUG     /////////////////////////////////////////////////


Adding querystring variable breaks admin URLs

I've set up some admin pages using add_sub_menu() and whenever I add an additional querystring variable beyond the "page=" portion of the URL, I get a "Cannot load 'page-slug'." message. When I remove the every variable the page loads correctly. Here is my add menu code:               add_submenu_page(       'plugin-slug',       __( 'Post Types - Add', 'plugin-slug' ),       null,       'manage_options',       'plugin-slug-posttypes-add',       'display_admin_page_posttype_add'     );      If I browse to: /wp-admin/admin.php?page=plugin-slug-posttypes-add it works fine. But browsing to: /wp-admin/admin.php?page=plugin-slug-posttypes-add&post_type=sampletype returns: Cannot load content-toolkit-posttypes-add.


How to add parameter to wp_enqueue_script?

I have the situation that I need to include special scripts only in case a parameter in a macro is used. For the background, see the following:   * My plugin ChessTempoViewer which wraps a JavaScript library for usage in WP.   * There I add the necessary libraries by using `wp_enqueue_script`.   * I would like to internationalize the output of the viewer, which is described here. So to use that internationalization, I should have to include the relevant script depending on the locale that should be used. This should be of course defined by the user, so the user should have the option to do something like:               [ctlocale locale="de_DE"][/ctlocale]     [ctpgn] 1. e4 e5 2. Nf3 ... [/ctpgn]      which should result in an output for the moves:               1. e4 e5 2. Sf3      S for Springer in German instead of N for Night in English. My code currently looks like that:               function pgnviewer_js_and_css(){       wp_enqueue_script("jquery");       wp_enqueue_script('pgnyui', 'http://chesstempo.com/js/pgnyui.js');       wp_enqueue_script('pgnviewer', 'http://chesstempo.com/js/pgnviewer.js');       wp_enqueue_style('pgnviewer-css', 'http://chesstempo.com/css/board-min.css');       wp_enqueue_style('ctpgn', plugins_url('ctpgn.css', __FILE__));     }          add_action('wp_enqueue_scripts', 'pgnviewer_js_and_css');          function chessTempoViewer($attributes, $content = NULL) {       ..     }      How could I include an additional tag `ctlocale` as in the example above (as the first entry) to ensure that the script is included before the other scripts?


Selecting a dynamic sidebar via metabox in wordpress

I am developing a wordpress theme where are 3 sideboxes. I want to select a sidebox through metabox in my admin page so that particular sidebar shows up in front-end. My codes are:- In function               array(                     'name'    => __( 'Select Sidebar', 'cmb' ),                     'desc'    => __( 'Select Your sidebar', 'cmb' ),                     'id'      => $prefix . 'test_select',                     'type'    => 'select',                     'options' => array(                         array( 'name' => __( 'sidebar-1', 'cmb' ), 'value' => 'sidebar-1', ),                         array( 'name' => __( 'sidebar-2', 'cmb' ), 'value' => 'sidebar-2', ),                         array( 'name' => __( 'sidebar-3', 'cmb' ), 'value' => 'sidebar-3', ),                     ),                 ),      In my theme file :-               <?php get_sidebar(); ?>      and in my sidebar.php                <?php do_action( 'before_sidebar' ); ?>             <?php                      global $post;                     $sidebar = get_post_meta($post->ID, '_cmb_test_select', true); ?>                       <?php if ( $sidebar != 'sidebar-1' ) :  ?>                           <?php ! dynamic_sidebar( $sidebar = 'sidebar-1');  ?>

          <?php  elseif( $sidebar != 'sidebar-2') : ?>                   <?php  ( ! dynamic_sidebar( 'sidebar-2' )) ?>                                                            <?php  elseif( $sidebar != 'sidebar-3')   :?>                    <?php  ( ! dynamic_sidebar( 'sidebar-3' )) ?>                                                                                <?php endif; ?>      But when I select the relevant sidebar in the admin page the same sidebar is not showing in front-end. Please help me to sort out where I am going wrong Thanks in advance.


All plugins deactivated. What could cause this?

I have an AWS server running four WordPress sites. All plugins have been deactivated on one of the sites and I cannot enable them. When I try enabling them in bulk, or individually, there is no error and it even says "Plugin activated.", but they are not. I have tried changing the ACLs temporarily, so that the webserver has full access. I have tried moving directories of plugins that have been recently updated, but nothing works. I have found that UpdraftPlus backups stopped being produced by this site and a similarly configured one (similar custom-made theme and nearly the same plugins) two days ago. Also, I have noticed that WP-CLI has not been working properly with these two similar sites over the last couple of days. I don't know what else to say. I'm completely stumped. What can I do about this?


Latest Posts not in the right order

I have changed my website's homepage to show only latest posts on the home page by going to settings > reading and using the "Latest Posts" option, but I just can't get things to work properly. On the homepage, the entire content of a post is displayed instead of just its title and summary and this doesn't just happen on the homepage, it happens on category pages, archive pages all render this way. My website is popularitybar.com , I'm using a mobile theme to test run things at the moment. These are the contents of my theme's index.php file               <?php get_header(); ?>

                            <?php // the loop ?>             <?php if (have_posts()) : ?>                      <?php while (have_posts()) : the_post(); ?>     <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>               <?php $postformatbackground = get_post_meta($post->ID, 'PostFormatBackground', true); ?>     <div style="background-image: url(<?php echo $postformatbackground; ?>);background-size:100% auto;position:absolute !important;z-index:-1;top:0;bottom:0;left:0;right:0;width:100%:height:100%;opacity:.4;">
               <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?>               <?php $featuredembed = get_post_meta($post->ID, 'FeaturedEmbed', true); ?>
<?php echo $featuredembed; ?>
                    <?php $shortcode = get_post_meta($post->ID, 'Shortcode', true); ?><?php echo do_shortcode($shortcode); ?>
     <a href="<?php the_permalink(); ?>#respond"><?php comments_number( ''.__('no comments', 'hero').'', '1 '.__('comment', 'hero').'', '% '.__('comments', 'hero').'' ); ?>     <?php the_tags('','',''); ?>

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

<?php the_content( __( 'Continues..', 'hero' ) ); ?>

          <?php endwhile; ?>                                    <?php get_template_part( 'includes/pagination'); ?>               <?php else : ?>
<?php _e( 'Sorry, nothing found.', 'hero' ); ?>
               <?php endif; ?>
                    <?php get_footer(); ?>      Thanks!


How WordPress is able to change locale without using setlocale

In my plugin I print out the current locales via                   $originalLocales = explode(";", setlocale(LC_ALL, 0));              var_export($originalLocales);die;      Obviously the result is same as the `WPLANG`defined. However, I've grep all the wordpress ' code, I cannot find a single call via `setlocale`, so how WordPress is able to change locale without using setlocale?


In wordpress site how to Redirect the non-www version of the site to the www version to remove duplicate content


Custom post type: Add "Edit | Quick Edit | Trash | View" links to date (if title is not shown in column)?

I've created a custom post type for my "Testimonials", I don't need a title(s), how can I write a function that Adds the " _Edit | Quick Edit | Trash | View_ " links to "date" if title isn't shown in the column. I'm using the plugin "Admin Columns" to hide the columns I don't wish to show. ![base](http://i.stack.imgur.com/R7ATr.png) I'm trying to re-use this code from this previous StackExchange question ( No Edit / Delete Links for Custom Post Type? ), however I have already created the fields "Author" etc. Using this code gives this result. ![result](http://i.stack.imgur.com/4y0Y1.png)


Custom login page problem!

I am trying to make custom login page by adding 1 in functions.php and 2 into theme folder. but I can't even execute the theme. I can activate the theme without 1 and 2. However, the site goes frozen both way trying to update the functions.php after pushing 2 to server and modifying the functions.php on dashboard, and trying to activate the theme after pushing the theme including 1,2 to server. The file is available at www.lastech.com.au/green.zip I tried so many different way to sort this out but it is not working. I spent almost a week. Please help me guys! 1.               function custom_login() {      echo '<link rel="stylesheet" type="text/css" href="'.get_bloginfo('template_directory').'/custom-login.css" />';      }     add_action('login_head', 'custom_login');      2.               custom-login.css file      My file is available at www.lastech.com.au/green.zip Regards BK


Configure which plugin custom post types get registered

I am writing a plugin that creates custom post types, but i want users to be able to turn them on and off via a filter in the `functions.php` file. The issue i'm having is that custom post types `register_post_type` has to be called during `init` and `functions.php` is read far after this. How can I allow users to provide an array using a filter or action that will control which post types `register_post_type` gets called?               // currently the custom post type constructor has this     if(!post_type_exists($this->name)) {       add_action("init", array($this, "register_post_type"));       add_action("init", array($this, "configure_meta_boxes"));       add_action("save_post", array($this, "save"));            add_filter('myplugin_get_shortcodes', array($this, "configure_shortcodes"));     }      The filter works just fine so I know it's being called, but for whatever reason the actions aren't.


WordPress fetch_feed returning only one (latest) item

I am trying to get feed details, using `fetch_feed` function, from a input field populated by users. I followed the code snippet from here. It gets the items nicely, but the problem is, it is returning only the latest item from the feed. The code is almost same, only I am using it inside a function that hooked into a AJAX action. Here is the code I am using:               function display_feed_items() {              include_once( ABSPATH . WPINC . '/feed.php' );              $rss = fetch_feed( $_POST['feed'] );              if ( ! is_wp_error( $rss ) ) :                  $maxitems = $rss->get_item_quantity( 7 );                   $rss_items = $rss->get_items( 0, $maxitems );              endif;              if ( $maxitems == 0 ) :             $feeds = '
 '. _e( 'No items' ). '
';         else :             foreach ( $rss_items as $item ) :                 $feedlink = esc_url( $item->get_permalink() );                 $feedtitle = esc_html( $item->get_title() );                 $feeds = '
' . $feedtitle . '
';             endforeach;         endif;              echo $feeds;         die();     }     add_action( 'wp_ajax_getfeeddetails', 'display_feed_items' );     add_action( 'wp_ajax_nopriv_getfeeddetails', 'display_feed_items' );      Where I am doing wrong?


direct custom post query interferes with other queries on page

In a previous question, I was struggling with how to get my custom post type(s) to show when performing standard category/tag queries, since by default Wordpress doesn't include CPT's in these queries. After quite a bit of hunting I found the answer to be this:               add_filter('pre_get_posts', 'query_post_type');     function query_post_type($query) {       if($query->is_category() || $query->is_tag() || $query->is_home() && $query->is_main_query()) {          $post_type = get_query_var('post_type');          if($post_type)             $post_type = $post_type;           else             $post_type = array('post','my_custom_post_type');           $query->set('post_type',$post_type);          return $query;       }     }      And, it works great... I can now assign categories/tags to my custom post types, and then query them and see the results. HOWEVER, with this code in place, I now have an entirely new problem which ONLY happens when the above code is in place... if I now query or view my Custom Post Type directly (that is, not via a category/tag), then suddenly my standard query items on the page (such as, a category listing in the footer) go blank. I'm not understanding how this is happening, since I am checking to assure `$query->is_main_query()`, so it seems the initial if statement would be false.... Do I now have to write another separate function so that when I query or view a custom post type directly, I can then allow standard post types to function on the same page?? Any help appreciated... * * * ## UPDATE Thanks for the comments, I have figured out why this is problematic: When I had my initial solution (not shown in this post), everything worked great with basic queries from the standard and CPT - but as I progressed into multiple queries, I realized that in certain cases, such as pages with queries spread around, in main page, some in footer, suddenly I ran into a crossover effect - like my menu would disappear at times, etc. So that's when the `&& $query->is_main_query()` was added (see full code above) - and of course it worked better then, because I was only applying this to the main query, thus avoiding menu/footer issues... or so I thought. Since adding this new version of the code, all seemed well - until I queried my CPT 'DIRECTLY'... when I did this, one of my standard footer widgets (calling a simple category query) went blank. As I started looking at this, I could see that in my initial IF query in the above code, it is performing an 'OR OR OR AND' - when technically, to keep this code to ONLY the main query, I would need to do something like '(( OR OR OR ) AND )' - or, wrap the entire function in in an `if ($query->is_main_query() {` So, I went ahead and did this (see below)... and when I did it, that solved the 'Direct CPT' call problem - allowing me to now directly query a CPT without blowing up the footer query.               add_filter('pre_get_posts', 'query_post_type');     function query_post_type($query) {     if ($query->is_main_query()) {     if($query->is_category() || $query->is_tag() || $query->is_home() ) {     $post_type = get_query_var('post_type');     if($post_type)         $post_type = $post_type;      else         $post_type = array('post','my_custom_post_type');      $query->set('post_type',$post_type);     return $query;         }           }     }      So, this seems great, right?? But, not so... because since my first version of this wasn't set up as I had intended, it was allowing my CPT to be added to the standard category/tag queries at times when NOT in the main_query... so now that I have officially filtered this so it can ONLY effect the main_query in all cases, my on-page Tab query calls are failing... (these are making calls to my CPT via category within jquery tabs on each page). So my new question is: given my SECOND version of code above, which allows me to incorporate my CPT into standard cat/tag queries, AND query my CPT directly, with no ill effect to other queries on the page - how do I now determine what query my TAB calls are making? Because it is obviously not the main_query - and therefore, I now need to target those so that I can include my CPT, much like I have done for the main query?


get_posts - get all posts by author id

I want to get all posts by certain author id (current user). Later, I want to pick the first post made by this user (ASC). I guess I do not use the right arguments in get_posts, am I? $current_user_posts always contains an Array with all blog posts in multiple different WP_Post Objects.               global $current_user;     get_currentuserinfo();                                $args = array(         'author'        =>  $current_user->ID, // I could also use $user_ID, right?         'orderby'       =>  'post_date',         'order'         =>  'ASC'          );          // get his posts 'ASC'     $current_user_posts = get_posts( $args );


Run function AFTER theme options are saved?

Weird question, how can I run a custom function AFTER my theme settings are saved? I see that the register_settings() function has a sanitize callback, but that runs before the settings are changed. I need something to run after they're saved. Is there an action or filter I can use to do that? EDIT - SO I have this setting I made:               add_settings_section(         'kjd_body_background_settings_section', // ID hook name         null, // label         null, // function name         'kjd_body_background_settings' // page name     );                   add_settings_field(             'kjd_body_background_colors', // ID hook name             null, //label             null, //callback             'kjd_body_background_settings', // page name             'kjd_body_background_settings_section' // parent section      );      and this function:               function kjd_update_stylesheet( $oldvalue, $_newvalue ){        echo 'updated!';        die();     }     add_action('update_options_kjd_body_background_settings','kjd_update_stylesheet',10, 2);          //add_action('update_options_kjd_body_background_colors','kjd_update_stylesheet',10, 2);


Wordpress Iris Colour Picker adding iOS touch events

I've implemented an Iris Colour Picker into the front-end of my theme thanks to the help provided in this question and all works well on the desktop front. However, it seems as though when it comes to an iPad device the colour picker doesn't work as expected. The mouse dragging event isn't being recognised, however clicking around the colour area works, it's like the mousedrag event isn't being recognised. Is this a known issue and is there perhaps a way I can duckpunch the functionality into the colour picker?


Simple tree display of WordPress menu

I want to display my wordpress menu in the form of a simple tree like this:                 >First menu item          >sub-menu-1             >sub-sub-menu-1          >sub-menu-2          >sub-menu-3            >Second menu item          >sub-menu-1            >Third menu item          >sub-menu-1          >sub-menu-2          >sub-menu-3      I know there is this `wp_nav_menu()` but how do I add class to sub-menu so that I can give some left margin and make it look like, it's nested?


Attaching meta box to specific category/taxonomy in custom post type

I have this case here and can't figure out how to do it. I have a custom post type with taxonomies and a meta boxes to that specific post type. The idea is some metaboxes to appear only when category/taxonomy is checked. Any help appreciate.               <script type="text/javascript">          jQuery(function($)     {         function my_check_categories()         {             $('#eg_vehicles_make_model').hide();                  $('#typeschecklist input[type="checkbox"]').each(function(i,e)             {                 var id = $(this).attr('id').match(/-([0-9]*)$/i);                      id = (id && id[1]) ? parseInt(id[1]) : null ;                      if ($.inArray(id, [7,10]) > -1 && $(this).is(':checked'))                 {                     $('#eg_vehicles_make_model').show();                 }             });         }              $('#typeschecklist input[type="checkbox"]').live('click', my_check_categories);              my_check_categories();     });


Get multiple roles with get_users

I've got some code like this:               $query_args = array();     $query_args['fields'] = array( 'ID', 'display_name' );     $query_args['role'] = 'subscriber';     $users = get_users( $query_args );     foreach ($users as $user) $users_array[$user->ID] = $user->display_name;      I want to get more roles and also include `contributor`, `author` and some custom roles I created with the Role Scoper plugin e.g. `Manager`, etc. Any ideas how I can do this with `get_users`? Thanks


How do I implement JQueryUI dialog modal in a WP plugin?

I have a Wordpress plugin I created which creates custom top level menu and submenu fine. The Submenu calls this, (entire code beneath) the BranchMaintenance php form, which shows branches in a table, ex the dbase, (using $Wpdb). It's getting the JQueryUI dialog modal form to popup which is the problem. doubtless my code is responsible, ...clueless re things like no name variable outer/toplevel functions as per in the code e.g. $(function() {   so any help extra ideas ....Thx I am trying to action the scripts I need to a) hide the dialog form initially (it appears above my table of branch data)..probably got this way wrong b) display it when called (this still as per the original demo code) Thx Neal
     <form name="Sandwich Baron Branch Maintenance" method="post" action="<?php echo str_replace( '%   7E', '~', $_SERVER['REQUEST_URI']); ?>">                      //This was placed in the head of a normal HTML form in the Demo 'http://jqueryui.com/demos/dialog/modal-        form.html'...field validation is removed for now.                    <?php     function fn_DeleteBranch(Id)     {        //$wpdb->   etc etc ; //deletes this branch (by Id) from the dbase     }     ?>                         <?php     // Hook for adding Dialog form HOPEFULLY     add_action('admin_init', "#dialog-form" );     add_action( 'admin_init', 'my_Deregister_scripts' );      add_action( 'admin_enqueue_scripts-options_page-{page}', 'myplugin_admin_scripts' );           function my_Deregister_scripts()  {                wp_deregister_script( 'jquery-ui' );  //Deregister WP's version         }            function myplugin_admin_scripts(){        //  syntax   wp_enqueue_script( $handle,$src,$deps,$ver,$in_footer );        //  $src  = the url where the scripts are stored        //  $in_footer Normally scripts are placed in the  section, so defaults to false             //wp_register_script( 'jquery-ui', plugins_url( 'js/jquery-ui.js', __FILE__ ), array( 'jquery' ) );          wp_enqueue_script('jquery');          wp_enqueue_script('jquery-ui-core');          wp_enqueue_script('jquery-ui-dialog');     wp_enqueue_script('jquery-ui-1.8.17.custom.min' );     wp_enqueue_script('jquery-bgiframe-2.1.2' );     wp_enqueue_script('jquery-ui-mouse' );     wp_enqueue_script('jquery-ui-button' );     wp_enqueue_script('jquery-ui-draggable' );     wp_enqueue_script('jquery-ui-position' );     wp_enqueue_script('jquery-ui-resizable' );     wp_enqueue_script('jquery-effects-core' );           wp_enqueue_script('jquery-ui-widget' );          //jquery-ui-1.8.17.custom         wp_enqueue_style('jquery-   style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');     }     ?>

All form fields are required.
          <form>     <fieldset>         Branch Name         <input type="text" name="txtBrname" id="txtBrName" class="text ui-widget-content ui-corner-all" />         Tel         <input type="text" name="txtTel" id="txtTel" value="" class="text ui-widget-content ui-corner-all" />                    </fieldset>     </form>

     <?php                      echo "
";          echo "
          ID	          Branch Name	          Express?	          Str.Address	          Area	         Manager	         Owner	         Tel	         Cell	         Email	         Edit	         delete
";           global $wpdb;     $myrows = $wpdb->get_results("SELECT * FROM wp_sbbranches");              // loop through results of database query, displaying them in the table           foreach ($myrows as $row) {                                echo "
";                  echo '' .$row->BrId. '	';                  echo '' .$row->BrName. '	';                  echo '' .$row->BrTel. '	';              echo '<button onclick="create-branch(' . $row->Id. ')">	';                 echo '<button onclick="fn_DeleteBranch(' . $row->Id. ')">	';                       echo "
";           }           // close table>          echo "
";     ?>      <button id="create-branch(' 0 ')" >Create new branch</button>


Plugin alternative to Normalize.CSS?

Hello Wordpress world! Since Normalize.CSS is not actually a wordpress plugin, could someone recommend me something close to it? Thanks!


To merge customized codes upon wordpress update

When using `update` feature (in `wp-admin/update-core.php` page), it seems to me that wp just replaces all the resources, and the changes that have been made in the working resources just get erased instead of getting merged. At least I've been experiencing with `wp-login.php` that gets replaced per every update and thus I have to reflect back the change from scratch (it's not easy often because the code in the file changes upon update). Am I right? If so, are there ways to merge the changes already made with the update?


Lightbox type effect to support a HTML/jQuery image map

I haven't used WP extensively before but I'm more experienced in HTML/jQuery and I'm helping a friend with their existing WP blog. I have designed an interactive map menu using the technique described here: tutorial and demo (essentially each region of the map has it's own image for both selected and non-selected states and an image map and jQuery is used to toggle the selection of each area) What I want to achieve is to have this pop up in a lightbox style box when you go to the blog homepage, and then the areas selected on the map dictate the categories of posts that are displayed. I had created this using plain HTML and jQuery (without a lightbox type plugin - just doing the fade manually) but now I need to integrate it with their website - although I imagine I may have to code this completely differently for WP. So my main questions are:   1. Is there a lightbox type WP plugin that supports all of the content I need (HTML image map and a few other buttons and options)?   2. Would the most appropriate plugin then support the jQuery method I have used from the tutorial above or is there a better way of achieving this?   3. How can I get this to automatically popup for the homepage of the blog? I hope I've included enough information, if you have any questions just let me know. Thanks a lot,


WordPress: Allowed Memory Size Exhausted - After Moving from Dev to Live

I keep getting this on my WordPress site after I moved it from my development server to the live site. It's happening in one file that is using a few functions which I think is causing it, but I don't know how to fix it. > Allowed memory size of 268435456 bytes exhausted (tried to allocate > 452314848 bytes) in **Unknown** on line **0** The code of the file that is causing the problem is here: custom.php I think it is one of these functions: `ob_flush()` or `ob_end_flush()`. How this started happening: I finished development of the site using WordPress MU (only 2 blogs in the network), originally I had it working with sub-directories. Once I moved it to the live server, I switched to sub-domains and got them working fine (both sites are showing) but I am getting that error in `custom.php`, causing some JavaScript to stop functioning. By the way, this **only happens about 85% of the time** , not every time the error shows. Let me add that I am customizing a theme called Repro, if it is of any relevance. Anyways, if anyone can help me troubleshoot on why this is happening, and what I can do to fix it, I would be very grateful, thanks! **Things I have tried:** Increasing the memory limit using `define('WP_MEMORY_LIMIT', '1024M');` in `wp-config.php`. - No luck Switching themes - The problem only persists on the Repro theme


How do I display the handle for all front-end enqueued scripts in plugin options page?

I use the following function in my plugin to display all the scripts handles in my plugin options page but it display only the handles of admin scripts:               function my_detected_scripts() {       global $wp_scripts;       foreach( $wp_scripts->queue as $handle ) :         echo $handle . ' <br /> ';       endforeach;     }      Then:               echo my_detected_scripts()      How can get the handles of all front-end enqueued scripts only? Thanks in advance!


Continuum Theme - Excerpt length

So I have been doing some digging and narrowed down the file that I believe is calling for the front page excerpts on all posts. No matter what I change it to, it doesn't seem to adjust.               //get excerpt for feed panels     function con_feed_excerpt() {     $excerpt = get_the_excerpt();            if (strlen($excerpt)>230) {         $excerpt = substr($excerpt, 0, 227) . "...";     }     echo $excerpt;     }      This looks to be where it is getting the excerpt length from the first character to the 227th char and then ending with a ... I've tried changing the 227 and re-uploading to my server and to no avail. Any clues what might be preventing it?


Load template inside a parent template

Inside of my current theme directory, I created a folder called "mobile" which contains a separate set of template files, all optimized for mobile. Now, say I setup a function that detects a mobile device, I would like wordpress to now load "mytheme/mobile/header.php" Instead of the themes root header.php and index files. Is there some way I can tell wordpress to look in a template subfolder for the template files? Many thanks


Different layout on search page depending on category post

I would like to display different layouts for post with different categories on the search page: I tried with this code:               <?php     if(isset($_GET['the_category'])) {         $type = $_GET['the_category'];         if($type == '1') {     ?>      But it doesn't work, could someone can point out a solution? Full code:               <?php get_header(); ?>

         <?php do_action( 'bp_before_blog_search' ); ?>
         <?php if (have_posts()) : ?>           <?php bp_dtheme_content_nav( 'nav-above' ); ?>           <?php while (have_posts()) : the_post(); ?>           <?php do_action( 'bp_before_blog_post' ); ?>                <?php           if(isset($_GET['the_category'])) {             $type = $_GET['the_category'];             if( $type == '1' ) {           ?>

               <a href="<?php the_permalink() ?>" rel="bookmark"                    title="Fixed link <?php the_title_attribute(); ?>">                 <?php the_title(); ?>
             <?php if ( has_post_thumbnail() ) { ?>
               <?php the_post_thumbnail('full'); ?>
             <?php               } else {                 // no thumbnail               }             ?>
             <?php             global $more;             $more = 0;             the_content( __('Read more','OneCommunity') );             ?>

                <?php                 } elseif( $type == '4' ) {           ?>                //Display layout for post marked with category 4           <?php             }           }           ?>                <?php do_action( 'bp_after_blog_post' ); ?>           <?php endwhile; ?>           <?php bp_dtheme_content_nav( 'nav-below' ); ?>         <?php else : ?>
             <?php _e( 'No posts found. Try a different search?', 'OneCommunity' ); ?>
         <?php endif; ?>
       <?php do_action( 'bp_after_blog_search' ); ?>

       <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('sidebar-blog')) : ?>       <?php endif; ?>       <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('sidebar-ad-blog')) : ?>       <?php endif; ?>
     <?php get_footer(); ?>


Modify a plugin function output from another plugin

I'm writing a plugin for a wordpress site using a page template using WP Types plugin. My plugin adds a shortcode tag. Shortcode tags inside 'the_content' get processed without problem. But this page template echoes `types_render_field(...)` WP Types function which gets and returns content containing shortcode tags retrieved from the database using `get_post_custom($postid)` wordpress core function call. I want to process these shortcode tags without modifying the template or WP Types plugin, just using my plugin code. Is that possible?


Get the More QuickTag button back

I can't work out how to add the WP quicktag button back into the editor, I have customized the editor as below:               function gimko_format_tiny_mce($in) {         $in['remove_linebreaks']=false;         $in['convert_newlines_to_brs']=false;         $in['keep_styles']=true;         $in['tabfocus_elements']='major-publishing-actions';         $in['paste_remove_styles']=false;         $in['paste_remove_spans']=false;         $in['paste_strip_class_attributes']='none';         $in['paste_text_use_dialog']=true;         $in['plugins']='inlinepopups,tabfocus,paste,media,fullscreen,wordpress,wpeditimage,wpgallery,wplink,wpdialogs,wpfullscreen';         $in['apply_source_formatting']=false;         $in['theme_advanced_buttons1']='formatselect,forecolor,|,bold,italic,underline,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,justifyfull,|,link,unlink,|,wp_fullscreen,wp_adv';         $in['theme_advanced_buttons2']='pastetext,pasteword,removeformat,|,charmap,|,outdent,indent,|,undo,redo';         $in['theme_advanced_buttons3']='';         $in['theme_advanced_buttons4']='';         $in['valid_children'] = '+div[p]';         return $in;     }      What do I need to add in to get it back showing?


Importing from XML is ignoring serialized custom field

I have been trying to import something into a custom field using the WordPress Import tool but it seems to be leaving the custom field empty in the database.               <wp:meta_value><![CDATA[a:19:{s:7:"address";s:50:"52, St. Michaels Rd,Sheffield,S359YN";s:11:"gpsLatitude";s:18:"";s:12:"gpsLongitude";s:18:"";s:18:"streetViewLatitude";s:9:"";s:19:"streetViewLongitude";s:18:"";s:17:"streetViewHeading";s:17:"";s:15:"streetViewPitch";s:18:"";s:14:"streetViewZoom";s:1:"0";s:9:"telephone";s:13:"01142570288";s:5:"email";s:19:"";s:3:"web";s:17:"";s:11:"hoursMonday";s:9:"";s:12:"hoursTuesday";s:9:"";s:14:"hoursWednesday";s:9:"";s:13:"hoursThursday";s:9:"";s:11:"hoursFriday";s:9:"";s:13:"hoursSaturday";s:6:"";s:11:"hoursSunday";s:6:"";s:18:"alternativeContent";s:0:"";}]]></wp:meta_value>      There doesn't seem to be anything massive sticking out with this, but when I use the importer tool it ignores this and leaves an empty space in the database. Any ideas of what's happening or if there's something blatantly obvious that's missing?


Getting A Link below footer - Want to remove it. How?

My blog http://MyTechFlow.Com showing a link in urdu language after footer(below footer). I had tried to remove it by looking up into footer.php But unable to find something... So guyz plz help me to fix it. Here is the Screenshot: http://share.pho.to/4RtoD/t1/original


How can I hide the sidebar from a specific post?

I'd like to hide the sidebar on a specific post (not page). How can I do this? For background, I've searched quite a bit both on Google and here. I'm finding lots of solutions for showing different sidebars on posts vs. pages, or for showing (or hiding) a specific sidebar on a specific _page_ , but nothing that's about hiding the sidebar from a single specific post.


Get null from POST

I have problem with my code. I don't know why all my $_Post have null at the end.This is my code:                   function ow_display_user() {         wp_enqueue_script('jquery-ui-datepicker');         wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');              global $wpdb;         $results = $wpdb->get_results ("SELECT adres FROM wp_ow_adres;");         ?>
Odczyt wodomierzy
     <form method="post" action="">

                     Adres zamieszkania	                     <select id="adres" name="adres">                             <option value="">Wybierz swój adres</option>                             <?php                              foreach ( $results as $result ) {             echo '<option>'.$result->adres.'</option>';         }         ?>                     </select>
                 <input type="submit" name="submit" value="Wybierz" />

     </form>     <?php      $adres = $_POST["adres"];     global $wpdb;     if (isset($_POST['submit'])){             $spr_liczbe_wodo = $wpdb->get_var("select liczba_wodomierzy from wp_ow_adres where adres='$adres'");             switch ($spr_liczbe_wodo) {                 case 1:                     ?>     <form name="adres_form" method="post" action="">

                     Adres zamieszkania:	                     <?php echo $adres;?>

                     Stan wodomierza:	                     <input type="text" name="stan_wodomierza" />

                     Data odczytu:	                     <input type="text" name="data_odczytu" id="datepicker" />

                     Kod lokalu:	                     <input type="text" name="kod_lokalu" />

                     	                     <input type="submit" name="submit" value="Zapisz" />

     </form>     <?php      break;     case 2:         ?>     <form name="adres_form" method="post" action="">

                     Adres zamieszkania:	                     <?php echo $adres;?>

                     Woda ciepła:	                     <input type="text" name="woda_ciepla" />

                     Woda zimna:	                     <input type="text" name="woda_zimna" />

                     Data odczytu:	                     <input type="text" name="data_odczytu" id="datepicker" />

                     Kod lokalu:	                     <input type="text" name="kod_lokalu" />

                     	                     <input type="submit" name="submit" value="Zapisz" />

     </form>     <?php     break;     case 4:         ?>     <form method="POST" action="">

                     Adres zamieszkania:	                     <?php echo $adres;?>

                     Woda ciepła (kuchnia):	                     <input type="text" name="woda_ciepla_kuchnia" />

                     Woda ciepła (łazienka):	                     <input type="text" name="woda_ciepla_lazienka" />

                     Woda zimna (kuchnia):	                     <input type="text" name="woda_zimna_kuchnia" />

                     Woda zimna (łazienka):	                     <input type="text" name="woda_zimna_lazienka" />

                     Data odczytu:	                     <input type="text" name="data_odczytu" id="datepicker" />

                     Kod lokalu:	                     <input type="text" name="kod_lokalu" />

                     	                     <input type="submit" name="submit" value="Zapisz" />

     </form>     <?php     if (isset($_POST['submit'])){         global $wpdb;         $kod_lokalu = $_POST['kod_lokalu'];         $spr_kod_lokalu = $wpdb->get_var("select kod_lokalu from wp_ow_adres where adres='. $adres .'");         if ($spr_kod_lokalu == $kod_lokalu) {                 $kod_lokalu = $_POST['data_odczytu'];                 $woda_ciepla_kuchnia = $_POST['woda_ciepla_kuchnia'];                 $woda_ciepla_lazienka = $_POST['woda_ciepla_lazienka'];                 $woda_zimna_kuchnia = $_POST['woda_zimna_kuchnia'];                 $woda_zimna_lazienka = $_POST['woda_zimna_lazienka'];                 $data_odczytu = '0000-00-00 00:00:00';                      $data = array(                         'id' => '',                         'adres' => $adres,                         'data_odczytu' => $data_odczytu,                         'woda_ciepla_kuchnia' => $woda_ciepla_kuchnia,                         'woda_ciepla_lazienka' => $woda_ciepla_lazienka,                         'woda_zimna_kuchnia' => $woda_zimna_kuchnia,                         'woda_zimna_lazienka' => $woda_zimna_lazienka,                 );                      $wpdb->insert(`wp_ow_odczyty`, $data);         }     }     break;     }              }     }


Why does publish_{custom-post-type} fire on update?

I'm trying to fire two different actions on both publish and update. Neither should ever fire at the same time. The problem is that `publish_pm_task` is getting fired on update and `save_post` is never getting fired? See anything wrong with this?               <?php     // Updated task notification     add_action( 'save_post', 'pm_updated_task_notification' );          // New task notification     add_action( 'publish_pm_task', 'pm_new_task_notification' );          function pm_new_task_notification() {              error_log('definitely a task');          }          function pm_updated_task_notification( $post_id ) {              $slug = 'pm_task';              /* check whether anything should be done */         $_POST += array("{$slug}_edit_nonce" => '');         if ($slug != $_POST['post_type']) {             return;         }         if (!current_user_can('edit_post', $post_id)) {             return;         }         if (!wp_verify_nonce($_POST["{$slug}_edit_nonce"], plugin_basename(__FILE__))) {             return;         }              error_log('updated a task');          }


Advanced Custom Fields if else issue

Ok, I think I have a simple fix here. I'm using ACF to link health reports to specific dogs on a breeder website. But, not all dogs have the same reports, and I don't want to show a dead link if no ACF value is available. So, I wanted to use an if statement but can't quite get it to work. Here's my code:               <?php                 $values = get_field('cardiac');                 if($values) {                 echo '<a rel="lightbox" href="'.<?php the_field('cardiac'); ?>.'">Cardiac';                 } else {                 echo '';                 }             ?>      Any help would be appreciated.


wp_tag_cloud inline CSS

I am using wp_tag_cloud but my problem is the inline CSS (for the font-size). I am doing RWD so I need full control of my markup/css. As I saw there is no property that will make it go away, so I guess I need to use another function, or the format=array. I tried using the array format but I couldn't make the tags appear. (not a php guy). Also please note tags need to be enclosed in elements, so no plaintext.. What are my solutions? Can I use wp_list_categories somehow? Thank you


Get_post_meta() won't return value

Ok guys... I'm sure this is going to be a really easy answer. I'm a complete noob at this. I have a custom field that is supposed to return a link. For some reason, it just redirects me back to my site homepage. I'm really new to Wordpress so I'm not sure what's going on but I've scoured Google and this is what I've got:                href="<?php get_post_meta(get_the_id(), 'ramco-videos-link', true);      Why won't it return the link in the custom field?


update a value in wordpress wp_options

I am trying to modify a plugin and in which i require to update a value in wp_options which has multiple values . My `option_name` is `ws_mem_options` and the `option_value` has values such as in format               s:20:"pro_sp_email_subject";s:36:"Thank You! (instructions for access)";s:20:"mem_email_message";s:309:"Thanks %%first_name%%!          %%item_name%%          Transaction ID: %%txn_id%%     Charges today: $%%amount%%          Your order can be retrieved here:     %%sp_access_url%%     ( link expires in %%sp_access_exp%% )          If you have any trouble, please feel free to contact us.          Best Regards,     Don't Just Watch TV, Participate!";s:120:"mem_coupon_codes";s:66:"CHRISTMAS-25|25%|01/01/2021     100%OFF|100%     SAVE-10|10%     dumpme|10%";s:15:"mem_default_tax";s:4:"0.0%";s:13:"mem_tax_rates";      how can i add more values to               s:120:"mem_coupon_codes";s:66:"wow-25|25%|01/01/2021         100%OFF|100%         now-10|10%         dumpme|10%";


database query with more than a couple meta hangs and doesn't complete

I have a development website with about 70 checkboxes for custom fields. The idea is the user selects one or more checkboxes, it queries the database for all posts that have a meta_key for the checkbox, and returns the results. My code below works great for 1-3 checkboxes at a time. 4 checkboxes or more results in a hosting error "Unable to Serve This Request", connection timed out message. The error is not dependent on the # of results returned. 4 checkboxes which should return around 20 results fails, while 2 checkboxes for 170 results is no problem. Here's how I have built my query - is there anything inheritly wrong with my logic?               $args=array(         'post_type' => array ( 'resources'),         'post_status' => 'publish',         'posts_per_page' => -1,         'orderby' => title,         'order' => ASC,              'meta_query' => array(                 'relation' => 'OR')                 );                   // Add filters        // I have an array above with the $name and value of the meta_key             array_push($args['meta_query'], array('key'=>$name, 'value'=> $value));               $my_query = null;         $my_query = new WP_Query($args);              if ( $my_query->have_posts() ) {              while ($my_query->have_posts()): $my_query->the_post();          // Show results         }


Styling the second sidebar

Ok so i added a second sidebar to my site, only problem is styling the widgets. here is the code i am using in my functions.php file               // Widgets plugin: intializes the plugin after the widgets above have passed snuff     function wpbx_widgets_init() {     if ( !function_exists('register_sidebars') ) {         return;     }     // Formats the theme widgets, adding readability-improving whitespace     $p = array(         'before_widget'  =>   '
',         'after_widget'   =>   "
\n",         'before_title'   =>   '
',         'after_title'    =>   "
\n"     );          register_sidebars( 2, $p );     }      I just don't know how to style the second sidebar widget, how do i do this? I want to use the same code but different class titles


Ordering posts by day (not time) AND meta value

I would like to have a list of posts that is first ordered by day, and then within that day ordered user votes (stored as a meta field). Would it be better to convert each timestamp to the day at the time of the query, or to create another meta field that stores the day? Or is there a better solution?


Looking for advice for a mail sending plugin

I would like to write a Wordpress plugin that sends one email every day for 7 days for newly registered users but I'm not sure how to start. My plan would be:   * hook the register function to send the first email after the user registers, send some users details to a custom table(for now the colums are just the user id and a counter with the number of emails sent)   * use a cron script that runs every 24h that would get data from that table and, if needed, send the emails and increment that counter Is there a better way to approach this?


Prevent searches less than 4 characters

When users search for 1,2 or 3 characters this puts a lot of strain on the database. A malicious user could search for 1,2 or 3 characters and bring my site down to its knees. I presume I could use some Jquery code to prevent users entering less than 4 characters when searching.                  <form method="get" id="searchform" action="<?php echo home_url(); ?>/">                                                              <input type="text" value="<?php _e( 'search', 'swagger' ); ?>" onfocus="if (this.value == '<?php _e( 'search', 'swagger' ); ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e( 'search', 'swagger' ); ?>';}" name="s" id="s" />                                       </form>       any suggestions?


need pages to display Title <plugin list category post>

My pages that are using the list category post do not have the title on them, and we would like that to happen. Is there some code that is telling the title not to display?


No line breaks in syntax highlighted code

I've installed Sunburst Code Prettify on my new blog. The prettifier uses Highlight.js to prettify code. I've placed the following Python code in a post:               [prettify class="python"]     >>> s=set(['a','b','c'])     >>> ''.join(s)     'acb'     [/prettify]      And got the following highlighting (with some paragraphs for context): ![enter image description here](http://i.stack.imgur.com/gA4RM.png) The line breaks are lost, some `>` were converted to `&#8221`, and there's an annoying gray background behind the rounded black code frame. I've tried another Highlight.js plugin, wp-highlight.js:               [code lang="python"]     >>> s=set(['a','b','c'])     >>> ''.join(s)     'acb'     [/code]      And got: ![enter image description here](http://i.stack.imgur.com/0oO5I.png) Same gray background, same loss of line breaks. I've tried switching themes (currently using Mosaic, switched to the standard Twenty-Ten), with no success. Any ideas what went wrong? **Update - what I've tried:** `<pre>`:               <pre>     [prettify class="python"]     >>> s=set(['a','b','c'])     >>> ''.join(s)     'acb'     [/prettify]     </pre>      Empty lines:               [prettify class="python"]     >>> s=set(['a','b','c'])          >>> ''.join(s)          'acb'     [/prettify]


meta_query works with single query but not multiple queries

This is very strange and I'm not sure why it is happening but this piece of code...                   $args = array(           'post_type' => 'property',               'sentance' => true,         'meta_query' => array(           array('key' => 'bhk','value' => $bhk,'compare' => 'LIKE'),         ));      or this, with a single meta_query work just fine, but                   $args = array(           'post_type' => 'property',               'sentance' => true,         'meta_query' => array(           array('key' => 'property_type','value' => $property_type,'compare' => 'IN'),         ));      when I add more queries in the array like below, it does not pull any results for my searches..                   $args = array(           'post_type' => 'property',               'sentance' => true,         'meta_query' => array(           array('key' => 'property_type','value' => $property_type,'compare' => 'IN'),         array('key' => 'city','value' => $city,'compare' => 'IN'),               array('key' => 'bhk','value' => $bhk,'compare' => 'LIKE'),         ));


post_categories array using variable

When using wp_insert_post can I do something like: `$categories = '1,2,3,4,5'` ...and then... `'post_category' => array($categories)`


How to get the image url in the input box from media library?

I have added a post meta to upload image using wordpress media uploader. Looks like it's a javascript work. I am no good in javascript. I took the js from here: Here is the js code:               jQuery(document).ready(function($){              // Instantiates the variable that holds the media library frame.         var meta_image_frame;              // Runs when the image button is clicked.         $('#meta-image-button').click(function(e){                  // Prevents the default action from occuring.             e.preventDefault();                  // If the frame already exists, re-open it.             if ( meta_image_frame ) {                 wp.media.editor.open();                 return;             }                  // Sets up the media library frame             meta_image_frame = wp.media.frames.meta_image_frame = wp.media({                 title: meta_image.title,                 button: { text:  meta_image.button },                 library: { type: 'image' }             });                  // Runs when an image is selected.             meta_image_frame.on('select', function(){                      //Grabs the attachment selection and creates a JSON representation of the model.                 var media_attachment = meta_image_frame.state().get('selection').first().toJSON();                      // Sends the attachment URL to our custom image input field.                 $('#meta-image').val(media_attachment.url);             });                  // Opens the media library frame.             wp.media.editor.open();         });     });      I have an input box with id `#meta-image`. But it does not return the img url there. Instead, it puts the image url inside the main post editor. Any idea how can I get this to work?


Inset image thumbnail from page into list

I currently have 10 child pages which each contain one main image and text. I then have the main parent page, which acts as a 'contents page'. I currently have this code on the main parent page...               <ul class="treatments-list h3">         <?php wp_list_pages('title_li=&child_of='.$post->ID=15); ?>     </ul>      This gets all the titles for these child pages and lists them, however, I would like to add an image thumbnail at the start of each of these lists, how can I do this? Thanks in advance.


How can i sort the categories by ID

Hi all I am newbie to wordpress I am using the wp_list_categories in the sidebar to display the categories . How can i display thus categories sort by id any one much appreciated...               <?php wp_list_categories('exclude=73');?>


function to show only featured image of the posts

The problem is whenever I display a post containing gallery, it shows them all on front page same as within post. I want a function for posts on front page to display only the clickable featured image with read more below for posts have predefined featured image. And if the post has some specific category eg. video, it should just display video and below some sharing buttons. This is what I achieved till now, being a newbie can't move further                function insertfeaturedimage($content) {     global $post;          if ( current_theme_supports( 'post-thumbnails' ) ) {              if (is_page() || is_single() || is_front_page()) {             $content = the_post_thumbnail('page-single');             $content .= $original_content;              }           }      return $content;     }          add_filter( 'the_content', 'InsertFeaturedImage' );       I want the above functionality to above function. Any help appreciated.


Use of antispambot with $curauth->email

This is probably pretty simple, but... I want to use the WP function **antispambot** not on **get_the_author_email** but on a value in a field I added to User Profile called **publicemail**. Everything I've tried throws a php error. This is the **antispambot** usage shown in the WP docs:               echo antispambot(get_the_author_email());      And this is the complete function I'd like to get to work with **antispambot** and have it encode **publicemail** :               <?php     if ( !empty( $curauth->publicemail )){     echo 'Email   publicemail.' ?subject=Webmail">     '; }     ?>


Alter BuddyPress member search to include search on added profile fields

I added a "company" field to member profiles via s2member plugin. However, this field is not included in the "member" search. For instance, when I search on the name of a company (when I know the company name I'm searching for is part of a member's profile info), the search displays "no results". How do I make added profile fields searchable?


Getting a peer review for my new plugin?

What is the best way to get an experienced WordPress developer take a look at my plugin and give constructive criticisms? I have written code to solve some of my questions on this site, and I think they could be useful to others too. However, since they would by my first public WordPress plugins, and I have seen many not-so-great examples in the public WordPress directory, I would like to know "where I stand", and how I can improve my plugins. I have read the list of best practices, and still need to apply some of them, but I would also like an answer to the more general question "Is this a good way to solve this problem?" I just re-read the related discussion on `wp-hackers` (I did not realize that the participants were also so involved in this site, and that the "best practices" question is a direct result of it). I'm not sure my needs would be covered by such a system, and I agree with Paul's concerns: > When I read the original comments on this thread last week I though the > purpose was to put together a peer review process where plugin developer can > offer advice to other plugin developers as review of their code. I > originally took this advice as something along the lines of "Well, your code > works but this set of routines you've written would be better served if you > just hooked into this WP filter and tried this technique (see xxx plugin as > an example)". The goal I thought was to share WP plugin development > knowledge and make any mediocre plugin developer a better developer. Like > myself. This would be a different scope than doing a point-by-point checklist review, it would be more of a "mentorship". It seems there are many people willing to do this, and (even better) many of them participate here on this site, so how can we transform all of that energy into something concrete? ~~My current example are three plugins I wrote tosolve my "image resize" problem. I wrote long introductory comments to each plugin, which (I hope) makes it easier to understand my intentions without reading the full code. Is there anything else I can do to make it easier for others to take a look at it?~~ _Please ignore my current concrete request. Not only is it too early for them, but I changed my mind and don't want to spoil the general discussion with my specific situation._


WP Query to get all posts (including in draft/pending review)

I currently have the following query:               $args = array(                   'post_type' => 'post',                   'orderby'   => 'title',                   'order'     => 'ASC',                   'posts_per_page' => 10,                 );          $my_query = new WP_Query($args);          while ($my_query->have_posts()) : $my_query->the_post(); ?>      This returns all the posts that are published. How can I alter it to show every post whether it's published, pending, or in draft?


How to save TinyMCE fields on Wordpress custom post type?

I have a custom post type "career_opportunities" with a "responsibilities" textarea box:
Responsibilities
                         <?php wp_editor(                                         "",                                          "responsibilities",                                          array(                                             'textarea_name' => 'responsibilities',                                             'tinymce'=>true                             )); ?>      The problem is, it is not saving when I call "save_post":               add_action( 'save_post', 'save_career_opportunity' );                   /* When the post is saved, saves our custom data */         function save_career_opportunity( $post_id ) {                  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )                return;                  if( !isset( $_POST['career_nonce'] ) || !wp_verify_nonce( $_POST['career_nonce'], 'my_meta_box_career_nonce' ) )                     return;                  if ( 'page' == $_POST['post_type'] )              {                 if ( !current_user_can( 'edit_page', $post_id ) )                     return;             } else {                 if ( !current_user_can( 'edit_post', $post_id ) )                     return;               }                      $responsibilities  = $_POST['responsibilities']; // longer description                 $qualifications    = $_POST['qualifications']; // longer description                 $career_level      = $_POST['career_level']; //                  $minimum_education = $_POST['minimum_education'];                 $job_status        = $_POST['job_status'];                      update_post_meta($post_id, 'responsibilities', $_POST['responsibilities']);                 update_post_meta($post_id, 'qualifications', $_POST['qualifications']);                 update_post_meta($post_id, 'career_level', $_POST['career_level']);                 update_post_meta($post_id, 'minimum_education', $_POST['minimum_education']);                 update_post_meta($post_id, 'job_status', $_POST['job_status']);              }


Multiple WordPress outside wordPress installation?

I have a main page where i want to show up the latest post content of two or more blogs.. for now I have this code :                   <?php         // Include WordPress Blog 1         define('WP_USE_THEMES', false);         require('./blog1/wp-load.php');         ?>           <?php query_posts('showposts=3');?>         <?php while (have_posts()): the_post(); ?>             some of my blog 1 stuff.. .         <?php endwhile; ?>         <?php wp_reset_query();?>              <?php         // Include WordPress Blog 2         define('WP_USE_THEMES', false);         require('./blog2/wp-load.php');         ?>           <?php query_posts('showposts=3');?>         <?php while (have_posts()): the_post(); ?>             some of my blog 2 stuff.. .         <?php endwhile; ?>         <?php wp_reset_query();?>      blog no. 1 is showing it's content but blog no. 2 doesn't show up the content.. .how can I reconstruct them both to work in one page which is my main page... are this possible to reconstruct?


Get the latest taxonomy/category?

I'm designing a custom magazine theme, where categories are used for different sections, and I created a custom "edition" taxonomy. The editor will create a new term in that taxonomy for each new edition published, i.e. the number of the issue. How can I query the latest "edition", so I can combine it with each category and then publish only the posts that belong to the newest edition? Something along the lines on: ?edition=34&cat=studies


Using shortcode in template file

this is shortcode in template:               function shortcode_frame_left( $atts, $content = null)     {             return ''. do_shortcode($content) . '';     }     add_shortcode('frame_left', 'shortcode_frame_left');      this is how using in post content:               [frame_left]  [/frame_left]      I am trying to use this shortcode in template file for displaying post thumbnails. What i try:               if (has_post_thumbnail()) {          apply_filters( 'the_content', "[frame_left]".the_post_thumbnail()."[/frame_left]");      }      and               if (has_post_thumbnail()) {          $thumbnail = '[frame_left]'. the_post_thumbnail() . '[/frame_left]';     echo do_shortcode("$thumbnail");          }      What am i doing wrong?


What is the best way to create a menu item that links to all posts with a certain tag?

I guess the title says it all. Short of creating a page with a custom template that links all the posts with a given tag (this is NOT a scalable solution, particularly if you want to let a customer do this), how would you add a menu item that takes you to a tag archive?


Is it possible to add classes to list items in wp_nav_menu()?

I am using               <?php     wp_nav_menu(         array(             'theme_location' => 'header-menu',             'menu_class' => 'nav-bar',             'container' => 'nav'         )     );     ?>      to output my navigation menu list. Currently they automatically get classes added to them like `page-item-8`, `page-item-6`. I work on a local machine and upload to my server. My problem is the `page-item` numbers are different and I can't select them properly. What I want to do is add a class `home`, `shop`, `services`, etc to the respective list item. Is there a better way to do this. Thanks in advance.


Create gallery doesn't show uploaded images

When you do Add Object in a page, for example, a screen is shown where you can see your uploaded images. But it doesn't work for me. No images are shown. What can it be due to? If I open the Multimedia Library the images are there. If I try to upload an image from this interface (add object) I get an error: There has been an error while uploading. Try again later (not literal, translated from spanish).


Hierarchy with users (manage other users)

Is there a way to assign users to a specific other user. For example, a user registers as a custom user role called manager. Then as a manager, I can assign other users to this manager and therefore be able to at some place (probably on the frontend and not in the dashboard) allow the manager to list users assigned to the manager. I was thinking to some point I can add something like a 'manager' field where users can choose who their manager is, and then create some functionality to read that field in the database and list users based on what user is logged in. I just didn't know if this is something that there is already a pre-built solution (don't want to reinvent the wheel) or if this is already built in WP to some extent.


Pass UserName and Password to WordPress wp-login.php from custom login template

i have a my custom login template where user enter his/her login details now i want like when user will click on button for Login user's details username and password i want to send to wp-login.php page to validate user and after that it will redirect to my home page. is this possible and if yes then how ??


How can I get some of a posts meta data whilst it is still inserting?

I'm trying to make a function where a child post of a certain post type inherits the same title and slug as its parent. I'm using WP Types to define my post types and their relationships. But I'm having trouble with the below code:               function copy_parent_post_title( $post_id ) {              $new_post = get_post($post_id);              if($new_post->post_type == 'carnews-adverts') {                  $parent_id = get_post_meta( $post_id, '_wpcf_belongs_carnews_id', true );             $parent_title = get_the_title($parent_id);             $post_slug = sanitize_title_with_dashes($parent_title);                  $post_update = array(                 'ID'           => $post_id,                 'post_title' => $parent_title,                 'post_name' => $post_slug             );                  remove_action( 'wp_insert_post', 'copy_parent_post_title' );             wp_update_post( $post_update );             add_action( 'wp_insert_post', 'copy_parent_post_title' );              }          }     add_action( 'wp_insert_post', 'copy_parent_post_title' );      The problem is this line:               $parent_id = get_post_meta( $post_id, '_wpcf_belongs_carnews_id', true );      I presume it is because at this point the post's meta data hasn't been inserted into the database yet? If so how can I achieve what I want by accessing the get_post_meta upon inserting a post? Thanks


Multisite features

I was thinking about creating a network of user-created blogs. I've read somewhere about wordpress multisite feature, and i was wondering if this is what i'l looking for... What i need to do is create a website where users register and create their onw blog. Does wordpress multisite offer this feature out of the box ? If not, would manually implementing this feature into wp be doable, or should i start from 0 or another platform ? Thank you!


Delete users from multisite after they have not logged in for a set amount of time?

I have added this to the users as they log into any of the sites on my multisite.               update_user_meta( $user_id, '_last_login', time() );      Now I want to delete all of the users that have not logged in for the past 6 months. I am looking for the sql version of this as I will then include it into a scheduled task to run once a week to clean the database.                       $time = strtotime('-1 hour');             $user_query = new WP_User_Query(array('meta_key' => '_last_login', 'meta_value' => $time, 'meta_compare' => '<=', 'fields' => 'ID'));                  if (!function_exists('wpmu_delete_user')) {                 include(ABSPATH . "wp-admin/includes/ms.php");             }                  if ($user_query->results) {                 foreach ($user_query->results as $old_user) {                     wpmu_delete_user($old_user);                 }             };


Hide comments column in WP backend

Is there a way to hide the comments column in the backend? When you look at the pages, there's a comments column even though I'v disabled them. I made WP into a cms and it may cause some confusion.


CMS - User confusion when creating new page and having to select template and save first to see correct fields

I've made WP into a cms and there's a few niggling things that cause confusion. The main one is that when you create a page, you have to first select a template then enter a title then save as draft for it to show the correct fields on the page (I'm using the advanced custom field plugin). Is there any way to get around this? A couple of users have now said "why aren't I seeing the correct fields to fill in?", this is down to not selecting the template and saving first.


How to disable style filtering in post?

I need to put HTML code directly in post. It works, except for some css attributes :   * background-image   * position Every time a "editor" or "admin" user try to type those attributes in a style properties :               <div style="position:absolute">      The whole style properties is removed. It works fine for the superadmin. I tried to put this in my function.php :               remove_filter('content_save_pre', 'wp_filter_post_kses');     remove_filter('content_filtered_save_pre', 'wp_filter_post_kses');      But it doesn't work. I tried to edit roles, but the "unfiltered_html" capabilities seems to be deprecated, and anyway, checked for both admin and editor by default. I know this filter is for security. But my site will be accessible to only one user, so I can't assume he won't try to hack his own site. Thank you very much EDIT : I found a page explaining the problem, but without the solution : http://shinephp.com/is-unfiltered_html-capability-deprecated/


Post thumbnail outside of loop

I'm trying to show a post thumbnail outside of the loop. The reason for this is that i want the featured image to show inside a custom page template, which will set the header image for the particular page for which the custom page template is set. I've tried the obvious `the_post_thumbnail();` and as expected, it didn't work. What's the best solution for using the featured image outside of the loop? The custom page template code i'm working with...

              <?php IMAGE WILL GO HERE ?>

             <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Home Top Content')) :          endif; ?>

                         <?php the_content(); ?>                         <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:', 'twentythirteen' ) . '', 'after' => '
', 'link_before' => '', 'link_after' => '' ) ); ?>
                                                   <?php edit_post_link( __( 'Edit', 'twentythirteen' ), '', '' ); ?>
                      <?php comments_template(); ?>


What is the "proper" way to generate a javascript variable depending on a custom field value?

On my site I have some posts with a custom field "Name". Now, in case the post has "Name" set, I want to generate this code:               <script type='text/javascript'>         var FG_DONATE_BUTTON_PARAMS = { attribution: 'honor',   attribution_name: Name}          </script>      where Name after attribution_name refers to the custom field value. For test purpose, I've used this code in the header               $nameAttribute= get_post_meta($post->ID, 'Name', true);      printf('<script type=\'text/javascript\'>     var FG_DONATE_BUTTON_PARAMS = {          attribution: \'honor\',          attribution_name: \'' . $nameAttribute .'\'     } </script>');      But I have two problems. One, the value of the $nameAttribute doesn't get passed through, and secondly, it's ugly :) I think I can manage the value problem, but I'm unsure what would be the "proper" way to output this.


Programatically add a page in Wordpress

I am trying to add a page to WordPress programatically. I am using this code:                function add_media_page(){     if(!(is_page('My New Post'))){          // Create post object       $my_post = array(          'post_title' => 'My new Post',          'post_content' => 'This is my post.',          'post_status' => 'publish',          'post_author' => 1,          'post_type' => ['page']       );          // Insert the post into the database       wp_insert_post( $my_post );     }     }     add_action( 'init', 'add_media_page' );       However when i use the last line in the array 'post_type' => ['page'] it causes the admin to crash and show a blank page. Does anyone know what's happening here


Auto create Nextgen Gallery on post creation

I was wondering if there is a way to create a nextgen gallery with a function, so that I can hook that into my front end post creation setup. The gallery could be completely empty or be created with the featured image of the created post.


Inserting custom fields into single.php

I am trying to get a custom field to show straight after the main body of text in single.php BUT before the Outbrain and Facebook Connect boxes. If I put the line to show the address above `<?php the_content('Read the rest of this entry »'); ?>` then it shows above the body text, if I place it below, it doesn't show at all. Is there any way to insert it into `'the_content'`? Thanks!


Configure Wordpress to connect to Mysql DB using SSH tunneling

Problem: Configure wordpress to use a remote mysql database only available using and SSH tunneling. Stage: I have a wordpress instance over an apache server on machine (called WP_server). WP_server, does not have Mysql server and has blocked port except 80 (http) and 22 (ssh). In other place is another machine (Mysql_server) which has a MySQL instance. This server can provide a database to WP_server. These two server have ssh access. How should I configure wordpress to use ssh tunneling?


Change custom post type GUID in RSS

So i got the RSS feed which output some custom post types, but the GUID looks bad to me, it's like:               ?post_type=mycustompost&p=124      The reason i want to change this is that I don't need people to know it's Wordpress or to see my custom post type name (this is very important in this project) Is there a filter or hook to rewrite this? Thanks


How to internationalize header image?

I have in the following code in the template:               <img src="<?php header_image(); ?>" />      However, I want to change this image according to the language selected (through GET parameter lang). The question is, how to change this function to look for different images according to the received GET parameter? I thought of:   1. Change this code on header.php to a fixed image path, so I could put an if and choose between the images I want.    2. Replace the result of the function get_header_image() and use it instead on header.php according to the received parameter, sort of replacing the string suffix .png to _en.png or .png to _es.png.   3. Change the header_image() function to behave the way I want. All these ways look ugly to me. Are there better ways?


How to modify the HTML formatting of an oEmbed link?

I am trying to add oEmbed DeviantArt integration to a custom theme. I found that first step is quite easy, I added               wp_oembed_add_provider( 'http://*.deviantart.com/#/d*', 'http://backend.deviantart.com/oembed' );         to theme's _functions.php_. Now, I would like to change the default HTML output to add more information, available in DeviantArt JSON response (DeviantART reference), like author_name, author_url, etc. If I have studied well the WP code that manage the output is inside function _data2html_ in _class-oembed.php_ , but I don't like change the code here. How can I add a function to my theme, to achieve the desired result?


Add custom template page programmatically

I'm trying to add template page from a plugin,and my template page is in this plugin folder.Is this posible?Here is my code:                global $user_ID;         $new_post = array(             'post_title' => 'Test Template Page',             'post_content' => 'Some text',             'post_status' => 'publish',             'post_date' => date('Y-m-d H:i:s'),             'post_author' => $user_ID,             'post_type' => 'page',             'post_category' => array(0)         );         $post_id = wp_insert_post($new_post);         if (!$post_id) {             wp_die('Error creating template page');         } else {             update_post_meta($post_id, '_wp_page_template', 'tp-file.php');         }      tp-file.php is my custom template page.When I put that file into the my-theme folder,it works fine,but I want to do this with file from plugin folder so I don't have to force users to copy that file from plugin folder to template folder. Is this possible?Any idea?


Change Page Order by Custom Field (Magic Fields)

My code lists the child pages ordered by post title, pulling through the first image attachment of the child post as the thumbnail. The child pages contain custom fields created using the Magic Fields plugin. Can anyone help me adjust my code so that I can have my pages listed in descending order of a custom field called 'price'? This is my code:                   <?php if (have_posts()) : while (have_posts()) : the_post(); ?>             <div class="page" id="post-<?php the_ID(); ?>">
                           <?php $child_pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = ".$post->ID." AND post_type = 'page' ORDER BY post_title", 'OBJECT');   ?>               <?php if ( $child_pages ) : foreach ( $child_pages as $pageChild ) : setup_postdata( $pageChild ); ?>
<a href="<?php echo  get_permalink($pageChild->ID); ?>" alt="<?php echo $pageChild->post_title; ?>" title="<?php echo $pageChild->post_title; ?>">     <?php $attachments = get_children( array(                     'post_parent'    => $pageChild->ID,                     'post_type'      => 'attachment',                     'numberposts'    => 1, // show all -1                     'post_status'    => 'inherit',                     'post_mime_type' => 'image',                     'order'          => 'ASC',                     'orderby'        => 'menu_order ASC'                     ) );     foreach ( $attachments as $attachment_id => $attachment ) {         echo wp_get_attachment_image( $attachment_id, 'medium' );     } ?>
<a href="<?php echo  get_permalink($pageChild->ID); ?>" title="<?php echo $pageChild->post_title; ?>"><?php echo $pageChild->post_title; ?>

          <?php endforeach; endif; ?>

                  <?php endwhile; endif; ?>      I would appreciate any help! Thank you.


I have two problems ( SEO )

how are you ? In my website I want to make the author's page and category(slug of it is country) to be in google reslut .. like this : http://rehlat-world.com/profile/saqaf , but when I search in google : site:rehlat-world.com , I didn't find authors page. how can include authors page in google result , this is my robort and this is my sitemap note: I change the slug of author ( http://rehlat-world.com/author/** from author to profile ( http://rehlat-world.com/profile/** ) .. how can include author page in google result ? ALSO , when I search in google (site:rehlat-world.com) some of posts repeated like this : http://rehlat- world.com/%D8%A7%D9%84%D9%8A%D9%85%D9%86-%D8%A7%D9%84%D8%B3%D8%B9%D9%8A%D8%AF-%D8%AC%D9%88%D9%84%D8%A9-%D8%B3%D9%8A%D8%A7%D8%AD%D9%8A%D8%A9-%D9%85%D8%B5%D9%88%D8%B1%D8%A9-%D8%AC2.html http://rehlat- world.com/%D8%A7%D9%84%D9%8A%D9%85%D9%86-%D8%A7%D9%84%D8%B3%D8%B9%D9%8A%D8%AF-%D8%AC%D9%88%D9%84%D8%A9-%D8%B3%D9%8A%D8%A7%D8%AD%D9%8A%D8%A9-%D9%85%D8%B5%D9%88%D8%B1%D8%A9-%D8%AC2.html?replytocom=37 same reslut but change in the last of like "?replaytocom=37" WHY?


Front end login and page restriction

I've read a few posts about this topic, but I haven't found any plugins that fit my need. What I want to achieve: User A and B both have a login. When user A logs in, he's redirected to www.somesite.com/ **a** / and when user B logs in, he's redirected to www.somesite.com/ **b** / Now, www.somesite.com/ **a** / should be private for user A, and user B or anyone else should not be able to access this page. I found this plugin that would allow a redirect after login: https://wordpress.org/plugins/redirect-after-login/screenshots/ But as you can see, this is only for the standard user roles. I will of course need some custom members/groups, since I could have many users that should only be able to see their own personal page (Right now my need is only around 7 users). It is very important that I, as an admin, can control the content on these pages. It shouldn't just be a simple "update profile page". So yeah, to sum up: I need each user to have a private page, that they are redirected to when they login. I hope that someone has tried this before, and has some ideas. I don't think there's one plugin that can do all I'm looking for, so I guess I need a couple of plugins that can talk well together. Please do tell if I need to provide more information.


Where are available Roles Defined in the wp_ database?

I got on the list to test a private beta of a plugin I'm using on a multisite network. The plugin authors have code in there to add a custom role. They have a bug that removes the ability to give a user any role except their one custom role. When I visit `../wp-admin/network/site-users.php`, the "Add User" role pulldowns only show the one role this plugin added. The change role pulldown menu shows all the WP default roles, plus a few extra roles this and other plugins have added. If I attempt to change a user to one of these roles, I get a "You can't give users that role" error page. I've been discussing this with the developer, and they seem baffled. I've been looking through my database and the codex, and I can't find where the valid roles are defined.


How to upload and add images to the existing post from the front-end with admin approval which is posted by other user

I want, by admin approval, that a logged in user can upload a image and add to the post which is posted by other user. He should add the image to the post from the Front-End.


Template file renders on local install, not on web

I've been building a website that involves a child theme of Twenty Twelve and a custom post type with associated custom taxonomy, "area". I've built a template file (cribbed from code found elsewhere) to render an taxonomy archive of this post type, `taxonomy-area.php`. I've been experimenting on my desktop MAMP install, and when I get things the way I like them, upload them to my web hosting service (Dreamhost, fwiw), or reproducing the configuration there. Not the most efficient way to do business, I admit, but I haven't had any success with any of the staging/production plugins. Anyhow, this taxonomy-area.php file works as expected on my desktop. But the "meat" of the template fails to render—that is, the PHP between `<? get_header(); ?>` and `<?php get_sidebar(); ?>` That code is as follows:

      <?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); ?>       <?php         $posts = query_posts($query_string . '&orderby=title&order=asc&posts_per_page=-1');       if (have_posts()) : ?>
Area Listing: <?php echo $term->name; ?>

         <?php while (have_posts()) : the_post(); ?>           <?php $url = get_post_meta($post->ID, 'honyaku_url', true); ?>           <?php $desc = get_post_meta($post->ID, 'honyaku_description', true); ?>             <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

               <a href="<?php echo $url; ?>" title="<?php the_title(); ?>" rel="bookmark">                 <?php the_title(); ?>

<?php echo $desc; ?>

         <?php endwhile; ?>
       <?php endif; ?>

            The output HTML is as follows:


Set authentication cookies to be shorter but then extend with every page load

I'm trying to get around the otherwise very insecure way of Wordpress handling authentication cookies. I mean, having the cookie expire in 2 weeks only if I build a membership site is obviously not ok, but at the same time, making it expire in 15 minutes while the user is logged in would be more than annoying. I have searched and tested extensively, and narrowed down the somewhat complicated code forest around this in Wordpress to the `pluggable.php` file under the `wp-includes` folder and found `wp_set_auth_cookie` function on line 652 (v 3.5.1). Now this does give me the possibility to change the times, however those are, as mentioned above, fixed to the login time, instead of to the user's last activity. I tried to add this function or the `wp_signon` function using this one to my header, but it didn't do the trick. Any plugin or hook or something that you can think of that would help me with this? Thanks a lot for your help in advance! **EDIT (June 6, 2013):** I tried with following code in the `functions.php` file of my template, but all it does it that it logs me out when I reload the page, it doesn't actually renew the auth cookies. The issue may be with the arguments (`$userinnow, $remember, $secure`) which, by the way, I don't need/use, except for `$userinnow`.               /* Renew cookie at every page load */     function renew_wp_cookie() {              global $current_user;         get_currentuserinfo();         $userinnow = $current_user->user_login;         if (is_user_logged_in()) {             wp_set_auth_cookie($userinnow, $remember, $secure);         }         else wp_clear_auth_cookie();          }          add_action('init', 'renew_wp_cookie');


Get only the path from a function like previous_post_link

I want to use something like `previous_post_link('%link','',TRUE )` and put the path into a javascript variable. So using something like `var previous = "<?php previous_post_link( '%link','',TRUE ); ?>";` outputs : `<a href="http://www.website.com/photo/1085" rel="prev"></a>` but instead I only want the path output in that variable. `http://www.website.com/photo/1085` I like this function because it allows you to remain in category so I am hoping for a solution where I still can easily have that as an option.


Handling front-end file uploads, considering safety and ease of use

I'm looking to adapt an existing forum-like plugin which has no facility for attaching media. The plugin works as a Custom Post Type, so it would be as "simple" as attaching an image to a post. I am only concerned about attaching images rather than any file type, but the plugin does use `wp_editor` and as such the solution should in some way integrate with that. I'm not overly fussed about creating a tinyMCE button, as long as the solution is capable of inserting a thumbnail of the image into the tinyMCE textarea. Please note, I am referring to the front-end of my website rather than the admin area. In an absolutely ideal situation, I would like this scenario to occur:   * User clicks "Ask a question"   * Use enters their post details   * User clicks a button on the tinyMCE interface which, similar to StackExchange, asks the user to upload a file.   * System then inserts the correctly-sized thumbnail into the tinyMCE textarea, having crunched the file into this thumbnail size   * Clicking this image should offer the same functionality as an image attachment in a Post   * User can then click again to insert a new image   * User can also delete the image from the tinyMCE textarea as needed However, I am happy for the tinyMCE button to be peripheral - if a "file upload" box is significantly easier, that's fine. I came across this link but I'm always apprehensive about reading WordPress articles on t'interwebs as I'm never too sure of how secure they are, nor am I a php security expert by any stretch of the imagination. Thanks in advance,


How to understand a specific bit of Wordpress syntax

I am changing a theme in Wordpress, and in an earlier theme, there was something like this that added a an email signup widget to the page:               [green_tick_1_list width="100%"]      But in the new theme that I installed, this just shows up as text. Is there any way to make it show up as the email signup form like it used to? And what is that syntax? Is that something I can create in WordPress per each theme I use?


Wrapping images in tags based on size

I am making a site for a client where all the thumbnails on a page need to be styled differently than regular sized images. Right now I have a snippet of code I found that allows me to wrap every image inserted into a post in a div, but I would like to only wrap the thumbnails. Code:               function filter_images($content){         return preg_replace('/\s*/iU', '

', $content);     }     add_filter('the_content', 'filter_images');      Is there a way I can do this?