title: enqueue the scripts

text: I have a template that has been hardcoded in the header and it needs to be Enqueued. I don't know what to do and the template provider is giving me the run around. JQueries won't work because of it. I installed the Q&A plugin it won't work properly because of this script. If I delete the script. Q&A works but my menu appearance is gone:               <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/cookie.js"></script>     <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/js.js"></script>     <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/PIE.js"></script>     <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/cusel-min-2.3.1.js"></script>     <script type="text/javascript">     var params = {             changedEl: "#zip, #zip1, #zip2, #zip3, #zip4, #zip5, #zip6, #zip7, #zip8, #zip9, #zip10, #zip11",             scrollArrows: true         }              cuSel(params);          $(document).ready(function(){         jQuery$('div.sel-data').last().css('margin-left','0');          });     </script>               <!-- superfish menu -->     <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/superfish.js"></script>     <script type="text/javascript">      $(document).ready(function(){                 jQuery('ul.sf-menu').superfish({                     animation:   {opacity:'show', height:'show'},                     speed:       'fast',                          // faster animation speed                      autoArrows:  false,                           // disable generation of arrow mark-up                      dropShadows: false                            // disable drop shadows                  });      });       </script>         <!-- /superfish menu -->     <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/cufon-yui.js"></script>     <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/Bebas_Neue_400.font.js"></script>      This is what dalton wrote from Q&A. > Your theme is hard-coding a link to the jQuery library in the header. You > will need to contact your theme developer and ask them to properly enqueue > the scripts instead or your site will have problems with any jQuery based > plugins. I don't know what to do or where to start. Any help would be wonderful My site is www.halseyschools.com


title: Why is my taxonomy template not shown?

text: I have created a custom taxonomy for my site called `projects` with a matching template called `taxonomy-projects.php`. The problem is that when I browse to `http://mysite.com/projects` the template is not triggered, `index.php` is, but when I browse to `http://mysite.com/projects/someterm` the template shows up just fine. How can have my template displayed when I browse to `http://mysite.com/projects`? Before you ask. Yes, I'm aware that I need to clear the rewrite rules before changes are made. I do this by saving the Permalink settings in the admin. This is how I've created my custom taxonomy:               $args = array(         'labels' => array(             'name' => "Categories",             'singular_name' => "Category",             'search_items' => "Search Categories",             'popular_items' => "Popular Categories",             'all_items' => "All Categories",             'parent_item' => "Parent Category",             'parent_item_colon' => "Parent Category:",             'edit_item' => "Edit Category",             'update_item' => "Update Category",             'add_new_item' => "Add New Category",             'new_item_name' => "New Category Name",         ),         'hierarchical' => TRUE,         'label' => 'Categories',         'query_var' => TRUE,         'rewrite' => array(                 'slug' => 'projects'         ),     );          register_taxonomy('projects', 'project', $args);      **UPDATE:** I've traced the output of `$wp_query->get_queried_object()` on each page and when I browse to a page with a term, such as `http://mysite.com/projects/commercial` I get the following output:               stdClass Object     (         [term_id] => 4         [name] => Commercial         [slug] => commercial         [term_group] => 0         [term_taxonomy_id] => 8         [taxonomy] => projects         [description] =>          [parent] => 0         [count] => 1     )      However, when I browse to `http://mysite.com/projects` the output is nothing. I'm failing to understand what I'm doing wrong. How can I make the `taxonomy- projects.php` shown when I browse to `http://mysite.com/projects`?


title: How we add new categories by wp_insert_post

text: I am using fornt end form submission now i want to add new category and before adding this category i want to check whether it exist or not, if yes then simple add to that category otherwise add new one. So the in codex they said if you have to add catogory just use the               wp_set_post_terms();      and there is one more function to add this which is               wp_set_object_terms();      and there is one more way of adding category is               wp_insert_category($cat_name);      so there is confussion in both how they work and which one i chose form them. I have name of category so can i use it now. There is code how to add them but they are not working for me.               //Check if category already exists     $cat_ID = get_cat_ID( $category );          //If it doesn't exist create new category     if($cat_ID == 0) {     $cat_name = array('cat_name' => $category);     wp_insert_category($cat_name);     }          //Get ID of category again incase a new one has been created     $new_cat_ID = get_cat_ID($category);          // Create post object     $new_post = array(     'post_title' => $headline,     'post_content' => $body,     'post_date' => $date,     'post_status' => 'publish',     'post_author' => 1,     'post_category' => array($new_cat_ID)     );      So any solution for that. Thanks


title: Banner in Wordpress

text: I'm trying to add an ad banner to my wordpress homepage (in the header) plus a separate ad banner for all other pages (in the header). I did get the banner up for just the homepage but I'm trying to figure the code to complete this issue. `<?php if ( is_home() ) { ?><div id="banner">my content</div><?php } ?>` How can I get another ad banner on all other pages/posts? Thanks.


title: plugin get value from admin panel page

text:
how to get values from a form(form is in admin panel page) and put that values in separate variables               <?php         /*             Plugin Name: calc plugin          */              add_action('admin_menu', 'my_plugin_menu');              function my_plugin_menu() {             add_options_page('My Plugin Options', 'My Plugin', 8, 'your-unique-identifier', 'my_plugin_options');         }              function my_plugin_options() {             echo '
';             echo '
Enter Two locations
                   <form action="#" name="mapform" id="mapform">                           Location A: <input type="text" name="A">
                           Location B: <input type="text" name="B">
                           <input type="submit" name="submit" value="Update">                   </form>';             echo '
';         }     ?>


title: How can I remove "Powered by Wordpress" pop-up disclaimer in wp-login.php?

text: In wp-login.php I added my corporate logo. However, when the mouse hovers on it, the disclaimer "Powered by Wordpress" appears. How can I remove it?


title: Add image attachment to post via coding?

text: I tried to add an image as Attachment image to a post. in `wp_postmeta` i added `_wp_attached_file` as `meta_key` and `value = productimages/Routers/v/CISCO1941.jpg` it not works and i could not see the image as attachment! but when i use add image button in wordpress's HTML editor, it add exactly this field to that table but with a different post ID! is there any dependency for that field? screenshot from db: http://i.stack.imgur.com/mVlse.png


title: database not responding on localhost

text: I'm trying to work on an existing WordPress site on my Mac using MAMP. I've setup a new database using phpMyAdmin and imported the tables from the backup of the online version. I pasted this into wp-config.php:               define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']);     define('WP_HOME',    'http://' . $_SERVER['HTTP_HOST']);      I used this command in SQL to change the URLs to localhost:               UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://www.oldsiteurl.com', 'http://www.newsiteurl.com');      When I go to `http://localhost` the site comes up fine; in the admin I get the dashboard and I can do things like upload and activate a theme, but I am unable to, say, upload new media (get a broken jpg image), or modify the theme – Ultimatum. When I try to go to local pages on the site from the front page, I get the "The requested URL /about was not found on this server." Any ideas?


title: Stylesheet is not loading on firefox and IE!

text: Hi I recently started to learn wordpress theme development and today I started my first worpress theme.For some reason my stylesheet get's loaded in chrome but not in firefox and IE the browsers I am using to test. Something else I noticed is that it seems wordpress adds some additional styles on its own.Here's what I found on the source page:               <style type="text/css" media="screen">     html { margin-top: 28px !important; }     * html body { margin-top: 28px !important; }      </style>      This are not styles I added. I have tryed to use `<?php echo get_stylesheet_uri() ?>`                                <?php bloginfo('stylesheet_url')      But none of theme seem to load the styles. Here is my entire header code:                  <!DOCTYPE html>        <html lang="en">        <head>        <meta charset="utf-8">        <title>            <?php if (is_home () ) { bloginfo('name'); }elseif ( is_category() ) { single_cat_title(); echo ' - ' ; bloginfo('name'); }                 elseif (is_single() ) { single_post_title();}                 elseif (is_page() ) { bloginfo('name'); echo ': '; single_post_title();}                 else { wp_title('',true); }             ?>        </title>        <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="<?php bloginfo('html_type') ?>" media="screen"/>        <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" type ="<?php bloginfo('html_type') ?>" />        <!--[if lt IE 9]>             <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>        <![endif]-->        <?php wp_head() ?>     </head>


title: Create "File-less" Page Template in Functions.php

text: (By "Page Template," I mean a theme file with the "Template Name" header that can be selected in the "Template" dropdown field on the page admin.) In multiple instances, I've built page templates that could have been accomplished by hooking to the_content or pre_get_posts or something similar. That's lead me to wonder whether there's a way to "register" a selectable theme template in `functions.php` or a plugin without creating the theme file itself. Reasons why I want to do this:   * In the scenarios I have in mind, I'm usually just copying page.php almost verbatim. That means any future change to page.php needs to get made twice. This is even more of a pain with updates to child themes.   * I like the "Template" field UI. It makes sense to my clients more than some of the alternatives (see below) that I can think of. In my case, I can think of some workarounds like using a custom meta box or a shortcode (to insert content that's otherwise held in a template). I might even be able to do this (which I just thought of but haven't tested yet):               /*     Template Name: My Template     */          get_template_part( 'page' );      But in the end, I keep coming back to this idea, so I'm curious whether anyone knows how to do it. If you think it's a horrible idea, I'm interested in that opinion too. ======= UPDATE: I should add that:   * I know that there's a `$templates` array for each theme from this support forums thread which is essentially doing the opposite of what I want to do.   * I know that there's a hidden custom field `_wp_page_template` from this WPSE thread. I guess I just need to understand how the templates array and custom fields work together (and I'm also fuzzy on how the hidden custom meta fields work). ======= UPDATE II: 10/8/12 The theme backend has been significantly reworked since this question was asked so the above $templates array no longer exists.


title: AZindex related help needed

text: I want to display list of post in category page using AZindex. So I've created a category template. Now I need help to display posts list by category there. For instance, when I'll go to domain.com/category/health, the page should display only post list from health category using azindex. Is it possible? I need your help.


title: Getting Links in Multiple Categories (intersection)

text: I am using `get_bookmarks()` to get bookmark links. I can get links posted in cat A **_or_** cat B, but I only want links in both A **_and_** B. **Example what I need:** I have three link categories `cat#1`, `cat#2`, `cat#3`. I need to get links in both `cat#1 AND cat#2` not `cat#1 OR cat#2` (intersection). **I am currently using:**               $links = get_bookmarks(array('category' => $term_ids));      Which doesn't work because of how `get_bookmarks()` works.                       $category_query = '';             $join = '';             if ( !empty($category) ) {                     $incategories = preg_split('/[\s,]+/',$category);                     if ( count($incategories) ) {                             foreach ( $incategories as $incat ) {                                     if (empty($category_query))                                             $category_query = ' AND ( tt.term_id = ' . intval($incat) . ' ';                                     else                                             $category_query .= ' OR tt.term_id = ' . intval($incat) . ' ';                             }                     }             }      Note from the Editor: Adding sample code for easier understanding - Bookmarks get queried with an `OR` clause by default. As they're retrieved via `$wpdb->get_result()`, there's no easy solution in filtering aside from the queried result. Any help or idea of different approach would be much appreciated. **UPDATE** I am trying to make a new function out of get_bookmarks() function. I changed the code that shown above to this below (changed OR to AND). But now nothing is returning. Perhaps i need to change the SQL to something else. So, I will need **advice on this.**               if ( !empty($category) ) {             $incategories = preg_split('/[\s,]+/',$category);             if ( count($incategories) ) {                 foreach ( $incategories as $incat ) {                     if (empty($category_query))                         $category_query = ' AND ( tt.term_id = ' . intval($incat) . ' ';                     else{                         // sisir                         $category_query .= ' AND tt.term_id = ' . intval($incat) . ' ';                     }                 }             }         }


title: jscrollpane problem with my child theme

text:
i am trying to use jscrollpane , but i tried everything , its still not working this is my function page               <?php     /**      * Custom Child Theme Functions      *      * This file's parent directory can be moved to the wp-content/themes directory       * to allow this Child theme to be activated in the Appearance - Themes section of the WP-Admin.      *      * Included are a set of constants that can be defined to customize aspects of Thematic's       * functionality, as well as a sample function that will add a home link to your menu.      * "Uncomment" or add more to cusomize the functionality of your Child Theme.      *      * More ideas can be found in the community documentation for Thematic      * @link http://docs.thematictheme.com      *      * @package ThematicSampleChildTheme      * @subpackage ThemeInit      */               // Unleash the power of Thematic's dynamic classes     //      // define('THEMATIC_COMPATIBLE_BODY_CLASS', true);     // define('THEMATIC_COMPATIBLE_POST_CLASS', true);          // Unleash the power of Thematic's comment form     //     // define('THEMATIC_COMPATIBLE_COMMENT_FORM', true);          // Unleash the power of Thematic's feed link functions     //          // define('THEMATIC_COMPATIBLE_FEEDLINKS', true);               // Adds a home link to your menu     // http://codex.wordpress.org/Template_Tags/wp_page_menu     //function childtheme_menu_args($args) {     //    $args = array(     //        'show_home' => 'Home',     //        'sort_column' => 'menu_order',     //        'menu_class' => 'menu',     //        'echo' => false     //    );     //  return $args;     //}     //add_filter('wp_page_menu_args','childtheme_menu_args');     ?>     <?php     include("custompost_functions.php");     /* ********************************************** */     /* Remove the standard Thematic menu */     /* ********************************************** */     function remove_menu() {     remove_action('thematic_header','thematic_access',9);     }     add_action('init', 'remove_menu');     // Moving the thematic menu above the header     add_action('thematic_header','thematic_access',6);               /* ********************************************** */     /* Register Menu */     /* ********************************************** */     function register_my_menus() {         register_nav_menus(             array(                 'primary-menu' => __( 'Primary Menu' ),                 'footer-menu' => __( 'Footer Menu' ),                 'side-menu' => __( 'Side Menu' ),                  )         );     }     add_action( 'init', 'register_my_menus' );     /* ********************************************** */     /* Footer Menu */     /* ********************************************** */     function footer_menu() {             if ( has_nav_menu( 'footer-menu' ) ) {         wp_nav_menu( array( 'theme_location' => 'footer-menu',                     'container_class'=>'footer-menu',                     'menu_class' => 'sf-menu', // we assign the sf-menu class to the menu ul so that superfish works on this menu too                     ) );              }     }          add_action('thematic_footer','footer_menu',41);     function side_menu() {             if ( has_nav_menu( 'side-menu' ) ) {         wp_nav_menu( array( 'theme_location' => 'side-menu',                     'container_class'=>'side-menu',                     'menu_class' => 'side-menu', // we assign the sf-menu class to the menu ul so that superfish works on this menu too                     ) );              }     }          add_action('thematic_abovemainasides','side-menu');     /* ********************************************** */     /* Footer Social Menu */     /* ********************************************** */     function social_menu(){ ?>

Follow Us

<img src="<?php bloginfo('stylesheet_directory'); ?>/images/Facebook.png" width="16" height="16" />

<img src="<?php bloginfo('stylesheet_directory'); ?>/images/Twitter.png" width="16" height="16" />

<img src="<?php bloginfo('stylesheet_directory'); ?>/images/Skype.png" width="16" height="16" />

     <?php }     add_action('thematic_footer','social_menu',44);     ?>     <?php     /* ********************************************** */     /* Intro Message */     /* ********************************************** */     if(!function_exists('getPageContent'))     {     function getPageContent($pageId,$max_char)     {     if(!is_numeric($pageId))     {     return;     }     global $wpdb;     $nsquery = 'SELECT DISTINCT * FROM ' . $wpdb->posts .     ' WHERE ' . $wpdb->posts . '.ID=' . $pageId;     $post_data = $wpdb->get_results($nsquery);     if(!empty($post_data))     {     foreach($post_data as $post)     {     $text_out=nl2br($post->post_content);     $text_out=str_replace(']]>', ']]>', $text_out);     $text_out = strip_tags($text_out);     return substr($text_out,0,$max_char);          }     }     }     }     /* ********************************************** */     /* REGISTER SCRIPTS */     /* ********************************************** */         function register_js() {             if (!is_admin()) {                 wp_deregister_script('jquery');                 wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js');                 wp_register_script('quicksand', get_template_directory_uri() . '/js/jquery.quicksand.js', 'jquery');                 wp_register_script('easing', get_template_directory_uri() . '/js/jquery.easing.1.3.js', 'jquery');                 wp_register_script('custom', get_template_directory_uri() . '/js/jquery.custom.js', 'jquery', '1.0', TRUE);                 wp_register_script('prettyPhoto', get_template_directory_uri() . '/js/jquery.prettyPhoto.js', 'jquery');                 wp_register_script('mousewheel', get_template_directory_uri() . '/js/jquery.mousewheel.js', 'jquery');                 wp_register_script('jscrollpane', get_template_directory_uri() . '/js/jquery.jscrollpane.js', 'jquery');                           wp_enqueue_script('jquery');                 wp_enqueue_script('quicksand');                 wp_enqueue_script('prettyPhoto');                 wp_enqueue_script('easing');                 wp_enqueue_script('custom');                 wp_enqueue_script('mousewheel');                 wp_enqueue_script('jscrollpane');             }         }              add_action('init', 'register_js');     /* ********************************************** */     /* REGISTER STYLES */     /* ********************************************** */         function register_styles()         {             if (!is_admin()) {                 wp_register_style('prettyPhoto', get_stylesheet_directory_uri() . '/prettyPhoto.css');                 wp_register_style('jscrollpane', get_stylesheet_directory_uri() . '/jquery.jscrollpane.css');                 wp_enqueue_style( 'prettyPhoto');                 wp_enqueue_style( 'jscrollpane');             }                }              add_action('init', 'register_styles');          /* ********************************************** */     /* Jscrollpane Menu */     /* ********************************************** */          function my_in_head(){  ?>                        <?php }     add_action('wp_head', 'my_in_head');     /* ********************************************** */     /* Exclude specific post */     /* ********************************************** */          function excludeposts() {     global $wp_query;              if (is_home()) {             $defaults = $wp_query->query_vars;             $exclude = array('category__not_in'=> array(5));             $args = wp_parse_args( $exclude, $defaults );             query_posts($args);         }     }     add_action('thematic_above_indexloop','excludeposts');     /* ********************************************** */     /* Change default content display on home page to excerpt */     /* ********************************************** */     function childtheme_content($content) {     if (is_home() || is_front_page()) {     $content= 'excerpt';}     return $content;     }     add_filter('thematic_content', 'childtheme_content');     /* ********************************************** */     /* Add read more Link  */     /* ********************************************** */     function new_excerpt_more($more) {            global $post;         return 'ID) . '">Read more...';     }     add_filter('excerpt_more', 'new_excerpt_more');     /* ********************************************** */     /* Dynamic sidebar for each page template  */     /* ********************************************** */     function is_pagetemplate_active($pagetemplate = '') {     global $wpdb;     $sql = "select meta_key from $wpdb->postmeta where meta_key like '_wp_page_template' and meta_value like '" . $pagetemplate . "'";     $result = $wpdb->query($sql);     if ($result) {     return TRUE;     } else {     return FALSE;     }     } // is_pagetemplate_active()          function test_template_widgets_init() {             if(is_pagetemplate_active('template-page-test.php')) {                  register_sidebar( array (                 'name' => 'Test Widget Area',                 'id' => 'test-widget-area',                 'before_widget' => '
',                 'after_widget' => "
",                 'before_title' => '
',                 'after_title' => '
',             ) );              } // end test for active template     } // test_template_widgets_init()     add_action ( 'init' , 'test_template_widgets_init' );?>      do i register jquery and scripts correctly ? or i miss something ? Thanks


title: How to create a custom category of wordpress admin

text: i was wondering how I would create a custom tab and page for wordpress admin screen, and save its data. I want a ticker on my main page, and the `<li>` data would change whenever I have new information available. Instead of editing code directly, I was thinking of creating a category for it, click save, store the data , then use that for the ticker via wp admin page. It'll be a lot easier to log in there to do it. If i could figure out how to save an input field, i could just use that, since i'll be the only one changing altering the list of the ticker. Any ideas?


title: Meta boxes only displayed when editing normal (default wp post_type) posts

text: I've multiple meta boxes for my main/default post types. I also have multiple post_types where this meta boxes make no sense. Can you hint me on if/else function I would use on displaying meta boxes only on default post_type?


title: Modify the .htaccess file

text: I have a very simple problem: I want to modify the .htaccess file. It seems I'm not the only person and I've seen the other questions and googled the issue. Nothing helps. Something keeps overwriting the file, sometimes causing it to throw an http 500 on the entire site. What I already know or tried:   * I should place the custom htaccess rules outside the Wordpress block (marked by `# BEGIN/END wordpress`)   * There is also another block from the caching plugin. My custom rules are outside this block too.   * Emptying the cache or en/disabling caching altogether does not trigger the problem.   * At first I put my custom rules between other `BEGIN` and `END` blocks that I gave a custom name, but I wasn't sure if Wordpress really looked for `# BEGIN wordpress` or just for `# BEGIN`, so I now use an entirely different name.   * Some sources suggested chmodding the file (`-w`) so that it can't be changed anymore. I tried this already, it doesn't work, it just gets recreated.   * There are no clear steps to reproducing the problem. Sometimes it'll last an entire evening without overwriting my code, another time all it takes is two minutes.   * When the file is overwritten, sometimes it retains part of my custom rules. Between one and two thirds usually, it seems pretty arbitrary. This regularly makes the entire site go HTTP 500 and I have to restore it over ssh (`git checkout .htaccess`).   * I've grepped/read through some Wordpress' source code and it all seems to be coded as it should. I indeed see it checking for the BEGIN and END blocks (though the code is uncommented and ugly).   * I've also added `fclose(fopen('htaccess-changed','w'));` to the Wordpress function that writes the .htaccess file, but to no avail. The htaccess file got broken again but the htaccess-changed file is never created.   * Even if I were to give up and just restore a working .htaccess version with every pageload, then still it wouldn't work because the damn thing throws http 500s from time to time. And having a cronjob run every minute is also... I mean come on, do I have to resort to such methods? Even if I did, it might be down randomly for a full minute. And nevermind it being bad practice on a shared webhost.   * My best guess at the moment is that a wordpress-cron triggers it, but it seems so random that I can't figure out which. It just happened three times in five minutes (finally thought it's reproducible, but nope it doesn't happen anymore now) and the most frequent cron is every quarter hour. So I've been on this bug for a few days but I'm starting to simply run out of things to try. The site can't go live when it randomly breaks of course. Any suggestions where to look for the code that overwrites the .htaccess file, and how to make it leave my modifications in place? Installed plugins: Cherry plugin, Contact form 7, Register Plus Redux, W3 Total Cache and WooCommerce. **Update:** The htaccess-changed file has been created, but in the wp-admin directory! I'm also saving the datetime and request-uri, and this shows that it can happen on any request. Mostly I see admin-ajax requests though, and those often happen at a very high rate, which would explain the htaccess file being completely broken (i.e. the requests interfere). Weird that nobody else experiences this though. But at least it's something in the admin panel... but what... Ideas?


title: PDF file upload issue

text: I am using a plugin **custom contact form** where i have kept a file upload field at the front end. But when i try to upload a pdf file then neither **tmp_name** nor **type** property of $_FILES is being set. However other files like jpg/gih are being uploaded. Need urgent help


title: Dashboard Whitescreen of Death?

text: I can login into the Dashboard and see the menu of the left, it shows that there are 7 plugin updates and a WordPress update required but on the right I have a blank screen, I can see the update to WordPress button along the top but when you click on it nothing happens. I have read several posts and update the config file to true to show debug, this is the result: * * * > **Notice:** wp_enqueue_style was called incorrectly. Scripts and styles > should not be registered or enqueued until the wp_enqueue_scripts, > admin_enqueue_scripts, or init hooks. Please see Debugging in WordPress for > more information. (This message was added in version 3.3.) in > /home/breinton/public_html/wp-includes/functions.php on line 3587 > > **Notice:** wp_enqueue_script was called incorrectly. Scripts and styles > should not be registered or enqueued until the wp_enqueue_scripts, > admin_enqueue_scripts, or init hooks. Please see Debugging in WordPress for > more information. (This message was added in version 3.3.) in > /home/breinton/public_html/wp-includes/functions.php on line 3587 > > **Notice:** register_sidebar_widget is deprecated since version 2.8! Use > wp_register_sidebar_widget() instead. in /home/breinton/public_html/wp- > includes/functions.php on line 3467 > > **Notice:** register_widget_control is deprecated since version 2.8! Use > wp_register_widget_control() instead. in /home/breinton/public_html/wp- > includes/functions.php on line 3467 * * * Any help or advice on how to fix this and update the Wordpress without loosing anything would be really appreciated.


title: Twenty Eleven Child theme error when attempting to use a rewritten function

text:
I attempted to make a minor change to a function in the Twenty Eleven theme (wordpress 3.4.2) I get this error message:               Fatal error: Cannot redeclare twentyeleven_widgets_init() (previously declared in /home/labfocus/public_html/wp-content/themes/twentyeleven-child/functions.php:10) in /home/labfocus/public_html/wp-content/themes/twentyeleven/functions.php on line 438      Here is the function that I am attempting to add in place of the original               <?php     if ( !function_exists('twentyeleven_widgets_init')) {     /**      * Register our sidebars and widgetized areas. Also register the default Ephemera widget.      *      * @since Twenty Eleven 1.0      */     function twentyeleven_widgets_init() {              register_widget( 'Twenty_Eleven_Ephemera_Widget' );              register_sidebar( array(             'name' => __( 'Main Sidebar', 'twentyeleven' ),             'id' => 'sidebar-1',             'before_widget' => '
%2$s
',             'after_widget' => "
",             'before_title' => '
',             'after_title' => '
',         ) );              register_sidebar( array(             'name' => __( 'Showcase Sidebar', 'twentyeleven' ),             'id' => 'sidebar-2',             'description' => __( 'The sidebar for the optional Showcase Template', 'twentyeleven' ),             'before_widget' => '',             'after_widget' => "",             'before_title' => '
',             'after_title' => '
',         ) );              register_sidebar( array(             'name' => __( 'Footer Area One', 'twentyeleven' ),             'id' => 'sidebar-3',             'description' => __( 'An optional widget area for your site footer', 'twentyeleven' ),             'before_widget' => '',             'after_widget' => "",             'before_title' => '
',             'after_title' => '
',         ) );              register_sidebar( array(             'name' => __( 'Footer Area Two', 'twentyeleven' ),             'id' => 'sidebar-4',             'description' => __( 'An optional widget area for your site footer', 'twentyeleven' ),             'before_widget' => '',             'after_widget' => "",             'before_title' => '
',             'after_title' => '
',         ) );              register_sidebar( array(             'name' => __( 'Footer Area Three', 'twentyeleven' ),             'id' => 'sidebar-5',             'description' => __( 'An optional widget area for your site footer', 'twentyeleven' ),             'before_widget' => '',             'after_widget' => "",             'before_title' => '
',             'after_title' => '
',         ) );         }     }      Can anyone see what's wrong with this function? **Update:** the question is really that I want to change how the `Main Sidebar` displays `before_widget` and `after_widget`. I've added a `<div>`


title: How to create custom php script page

text: I am a n00b to WP I am trying to execute a php script which is located in home directory of Wordpress. For example **run.php**               <?php echo 'i run'; ?>      I want to run this page in url `mysite.com/run.php` but it says 404 not found, even the `run.php` is located in that address. Any help would be appreciated. Thanks in advance.


title: Posts Not Paginating

text:
I am copying a clients site over, so I have exported and reinported the posts etc, and the theme into their new site. However, on the front page it has a pagination of the latest posts using a Widget Paginator plugin. It looks as if they have built this theme around the core Twenty Twelve theme, so it using the following code to paginate the posts:               <?php while ( have_posts() ) : the_post(); ?>         <?php if ( has_post_thumbnail() ) : ?>
                 <?php the_post_thumbnail(); ?>
         <?php endif; ?>              <?php get_template_part( 'content', 'page' ); ?>          <?php endwhile; // end of the loop. ?>      Can anyone advise why the posts wouldnt be paginating? Any advice is appreciated, as I've checked over the loop and it appears to be correct. **EDIT:** Here is the code I have               <?php     /**      * The default template for displaying content. Used for both single and index/archive/search.      *      * @package WordPress      * @subpackage Twenty_Twelve      * @since Twenty Twelve 1.0      */     ?>             <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>     <?php                             $category = get_the_category();     ?>                     <?php if ( !is_category() && !is_archive() ) : ?>
<?php echo $category[0]->cat_name;?>
                     <?php endif; // is_single() ?>                     <?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
                             <?php _e( 'Featured post', 'Cycle Zone' ); ?>
                     <?php endif; ?>                                                  <?php the_post_thumbnail(); ?>                             <?php if ( is_single() ) : ?>
<?php the_title(); ?>
                             <?php else : ?>
                                     <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'Cycle Zone' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?>
                             <?php endif; // is_single() ?>                             <?php echo get_the_date(); ?>                             <?php if ( comments_open() ) : ?>
                                             <?php comments_popup_link( '' . __( 'Leave a reply', 'Cycle Zone' ) . '', __( '1 Reply', 'Cycle Zone' ), __( '% Replies', 'Cycle Zone' ) ); ?>
                             <?php endif; // comments_open() ?>                                               <?php if ( is_search() ) : // Only display Excerpts for Search ?>
                             <?php the_excerpt(); ?>
                     <?php else : ?>
                             <?php the_content( __( 'Continue reading →', 'Cycle Zone' ) ); ?>                             <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:', 'Cycle Zone' ), 'after' => '
' ) ); ?>
                     <?php endif; ?>     <?php     /**      * The default template for displaying content. Used for both single and index/archive/search.      *      * @package WordPress      * @subpackage Twenty_Twelve      * @since Twenty Twelve 1.0      */     ?>             <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>     <?php                             $category = get_the_category();     ?>                     <?php if ( !is_category() && !is_archive() ) : ?>
<?php echo $category[0]->cat_name;?>
                     <?php endif; // is_single() ?>                     <?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
                             <?php _e( 'Featured post', 'twentytwelve' ); ?>
                     <?php endif; ?>                                                  <?php the_post_thumbnail(); ?>                             <?php if ( is_single() ) : ?>
<?php the_title(); ?>
                             <?php else : ?>
                                     <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?>
                             <?php endif; // is_single() ?>                             <?php echo get_the_date(); ?>                             <?php if ( comments_open() ) : ?>
                                             <?php comments_popup_link( '' . __( 'Leave a reply', 'twentytwelve' ) . '', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
                             <?php endif; // comments_open() ?>                                               <?php if ( is_search() ) : // Only display Excerpts for Search ?>
                             <?php the_excerpt(); ?>
                     <?php else : ?>
                             <?php the_content( __( 'Continue reading →', 'twentytwelve' ) ); ?>                             <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:', 'twentytwelve' ), 'after' => '
' ) ); ?>
                     <?php endif; ?>     <?php             /*                                                  <?php twentytwelve_entry_meta(); ?>                             <?php edit_post_link( __( 'Edit', 'twentytwelve' ), '', '' ); ?>                             <?php if ( is_singular() && get_the_author_meta( 'description' ) && is_multi_author() ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries. ?>

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

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

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

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

                             <?php endif; ?>                                  */     ?>
      I did this paste, now what i think is, because it says twentytwelve in the content, rather than the theme name, its not pulling through. Can you clarify?


title: How to show file type of featured image?

text: How to show file type of featured image in post on single.php? For example: Featured image type is: ".jpg" I can get mime-type, like "image/jpeg". It could be also some check of image mime-type first, for example if image mime-type is "image/jpeg" then echo ".jpg" if it is "image/gif" echo ".gif".


title: Tags not working with custom post type

text: I just made a custom post type. How do I display the Tag on the my site same as what the Post post type has? I try this function but not work :-                <?php the_tags(' ', ', ', ' '); ?>      In panel, i see the tags but in my site not display. Edit :- my code of post type :-               register_post_type( 'interviewdoctor',                     array(                       'labels' => array (                           'name' => 'InterView',                           'singular_name' => 'InterView',                           'add_new' => 'Add InterView',                           'add_new_item' => 'Add InterView',                           'edit' => 'Edit InterView',                           'edit_item' => 'Edit InterView',                           'new_item' => 'Add InterView',                           'view' => 'Edit InterView',                           'view_item' => 'Show InterView',                           'search_items' => 'Search',                           'not_found' => 'Not Found',                         ),                          '_builtin' => false,                                     'taxonomies' => array('interviewdoctor', 'post_tag'),                     'public' => true,                      'show_ui' => true,                     'show_in_nav_menus' => true,                     'menu_position' => 5 ,                     'hierarchical' => true,                     'has_archive' => true,                     'capability_type' => 'page',                     'menu_icon' => 'https://cdn1.iconfinder.com/data/icons/free-game-icons/32/Doctor.png',                     'rewrite' => array(                         'slug' => 'interviewdoctor',                         'with_front' => false,                         'pages' => true                     ),                          'supports'   => array(                                 'title',                                  'thumbnail',                                  'editor',                                  'date',                                   'excerpt',                                    'comments',                                     'custom-fields',                                     'tags')                         )                      );     }     add_action('init', 'interviewdoctor');


title: Adding ID to a Listing but not inside WP_Query while

text:
<?php $args = array(                 'post_type' => 'bedrijf',                 'posts_per_page' => -1,                 'orderby' => 'title',                 'order' => 'ASC'               );               $query = new WP_Query( $args );               if ( $query->have_posts()) :                 while ( $query->have_posts()) :  $query->the_post();                 $title = get_the_title();                 $beginletter = substr(strtoupper($title), 0,1); ?>                  <li id="list" data-filter="<?php foreach ($terms as $term){ echo $term->term_taxonomy_id; } ?>" data-letter="<?php echo $beginletter; ?>"><a href="<?php the_permalink(); ?>"><?php the_title(); ?>
            MAJOR EDIT: So I fixed a few issues and I have a new problem, what happens now is it shows the same ID as from the same result on ALL post types. I know it's because of the while but I don't know how to put data-filter inside the li but outside the while? Or any other solution to this perhaps?


title: Why is my rewrite rule refreshing the page and removing my variables?

text: For some reason, the catch-all page rewrite rule is capturing this rewrite, rather than my own rewrite rule. My rewrite rule is listed at the top when doing a var_dump of the rules, as well as when looking at it in the `Rewrite Rules Inspector` plugin.               function wp90210_add_duplicate_iquote_rewrite_rule( $rules ) {         $rule = array('portal/quote-request/([0-9]{1,2})/([0-9]{1,8})/?$' => 'index.php?pagename=quote-request&form_id=$matches[1]&lead_id=$matches[2]');         $rules = $rule + $rules;         return $rules;     }     add_action('rewrite_rules_array', 'wp90210_add_duplicate_iquote_rewrite_rule');          function wp90210_add_duplicate_query_vars( $query_vars ) {         $query_vars[] = 'form_id';         $query_vars[] = 'lead_id';         return $query_vars;     }     add_filter('query_vars', 'wp90210_add_duplicate_query_vars');      When I go to: `http://local.testing.com/portal/quote-request/5/1234/` it sends me instead to `http://local.testing.com/portal/quote-request/`, removing the variables from the URL. I keep going in circles on this one. What am I doing wrong here!? **UPDATE** I think I may be getting somewhere... finally. It seems to not like the fact that the page I am wanting it to go to has a parent page. If I remove the parent page setting from the quote-request page, it works, keeping the variables in the URL.


title: Writing a wordpress plugin and trying to include the Facebook PHP SDK

text: I'm writing a plugin for Wordpress that required the Facebook PHP SDK. I've run into what I think is a common problem judging from the number of results I've found dating back to over a year ago. Unfortunately, I have been unable to find a solution. I'm using Wordpress 3.8 and Facebook PHP SDK Master taken from github so this should be the latest version. I've actually run this same code outside of Wordpress and it successfully ran with no errors. So, i upload my plugin and activate it. I go to the panel I've built that asks for the appID and Secret key and also the username for the facebook account. All the plugin will do is grab the username me feed. So, when i try to run the primary function that loads the feed I get the following errors: > Warning: session_start() [function.session-start]: Cannot send session > cookie - headers already sent by (output started at {path}/wp- > admin/includes/template.php:1698) in {path}/wp- > content/plugins/{mypluginname}/facebook-php-sdk/src/facebook.php on line 48 > > Warning: session_start() [function.session-start]: Cannot send session cache > limiter - headers already sent (output started at {path}/wp- > admin/includes/template.php:1698) in {path}/wp- > content/plugins/{mypluginname}/facebook-php-sdk/src/facebook.php on line 48 **What I've tried** So, I've read in a few different posts that I should use ob_start() and ob_end_flush() php functions and that will fix the problem. As i understand the problem I am having I am sending things to the header where I shouldnt because the header has already been sent. I've tried ob_start / ob_end_flush at the top and bottom of my plugin and it made no different. I've tried downloading the Facebook wordpress plugin and using the modified Facebook PHP SDK that that plugin uses and that got rid of those errors but created a new error. > Fatal error: Access to undeclared static property: > WP_BaseFacebook::$CURL_OPTS in {path}/wp- > content/plugins/{pluginname}/facebook-php-sdk/src/base_facebook.php on line > 932 So, I read that this is because CURL is not enabled. I've checked my PHP INFO page and CURL is enabled. I use curl requests in another plugin. I do see certain things under the CURL features that are not enabled. Does anyone know which option I need to enable to get this modified version of the Facebook PHP SDK to work with my plugin? Does anyone know how to fix either the errors I am getting from the standard Facebook PHP SDK OR does someone know how to fix the errors I am getting from modified Facebook PHP SDK? Thanks in advance. I hope to get a solution to both worked and then finally put this issue to rest. We've been plagued with this same problem since 2011. In order to provide some more details, here is part of the code I have in my plugin.               require_once('facebook-php-sdk/src/facebook.php');          global $facebook; // read that i needed to add this line to my script; it didnt help.          // Create our Application instance (replace this with your appId and secret).     $fb_config = array(       'appId'  => $ijFaceFeedAppID,       'secret' => $ijFaceFeedSecretKey,       'fileUpload' => false,       'allowSignedRequest' => false     );          // get feed     $facebook = new WP_Facebook($fb_config); // am using the modified facebook sdk     $page_feed = $facebook->api(     '/'.$ijFaceFeedUser.'/feed',     'GET'     );


title: Displaying popular posts

text: I wanted to write a query to display, 3-4 top popular post, in my sidebar with a small thumbnail size image of the post. I tried looking at archives widget, but it only displayed links. (thought, i could copy the code from there), how do i get to have my desired result?


title: Adding a Filter to Sidbar Login Plugin to Change Login Button Lable

text: I'm a newbie and I have not been able to find an answer to my question.   I have installed the Sidebar Login plugin and I'm trying to change the form labels, specifically,the login button label.   I understand that I need to add a filter to my functions.php file in the child theme in order to modify the following piece of code:               $login_form_args = apply_filters( 'sidebar_login_widget_form_args', array(                 'echo'              => true,                 'redirect'          => esc_url( apply_filters( 'sidebar_login_widget_login_redirect', $redirect ) ),                 'label_username'    => __( 'Username', 'sidebar_login' ),                 'label_password'    => __( 'Password', 'sidebar_login' ),                 'label_remember'    => __( 'Remember Me', 'sidebar_login' ),                 'label_log_in'      => __( 'Login →', 'sidebar_login' ),                 'remember'          => true,                 'value_remember'    => true             ) );                  wp_login_form( $login_form_args );      The filter to change any of the arrays is: sidebar_login_widget_form_args I have spent an entire day trying to figure out how to properly code the filter without any success. I would greatly appreciate anyone's help.


title: 301 redirect not working through .htaccess

text: I found this little trick http://css- tricks.com/snippets/htaccess/301-redirects/ to redirect my old Wordpress domain to my new domain with the path included. I run a test on my local copy and everything works fine. When I log in to the cpanel of the old domain and try it though it gives me some bad results. Here is the code I used for both my local and live copy ...               # 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          Redirect 301 / http://newsite.com/      Here's what the results look like http://www.cuponsmercado.com.br/lojas/. It looks to be calling the new domain (based on the Google Chrome status at the bottom left) but it just shows the old domain with broken HTML/CSS. Any Ideas?


title: Register CPTs using Dashicons for admin menu icon in WP 3.8

text: WordPress 3.8 introduced in core the plugin MP6 that among other things use an iconic font called Dashicons to display fonts in the dashboard. Now, is well know that register_post_type has an argument `'menu_icon'` that allow to specify a custom icon for the CPT admin menu entry. In my plugins/themes I often use that argument with my custom icon images that normally are dark because before 3.8 admin menu had a light background. With the default dark menu background in WP 3.8 my icons become almost invisible. That aside, I think that use the new dashicons for my CPT will be cool. After some research, I know I can just use the CSS from dashicons, something like               #menu-posts-mycpt div.wp-menu-image:before { content: "\f226"; }      However using both `'menu_icon'` argument of `register_post_type` **and** previous css will print both icons in WP 3.8 and one icon + a strange char in WP 3.8-, and without use `'menu_icon'` argument, on older versions the default icon is used. I know I can conditionally add `'menu_icon'` in `register_post_type` for WP 3.8- versions and conditionally add previous css for WP 3.8+, but:   * that involves to add some code (2 conditional statements) for **every** CPT registered, so updating plugins/themes is quite an hard work   * it seems to me more a workaround than an elegant solution So, questions are: Is possible to use dashicons css for WP 3.8+ and use custom image set up via `'menu_icon'` param for previous versions in a "simpler" way that doesn't involve add 2 conditional for every CPT registered? And, if so, is possible do that in some _automagic_ way straight from `register_post_type` without any additional code?


title: Overview with latest edited posts and pages

text: I'm looking for an overview of all the latest user activities. But I don't want to see comments on this page, just the edits or creations of new posts or pages. Unfortunately I can't find such a page on our installation. Could you help me out?


title: Is there any Image size limit for wordpress xml-rpc

text: I'm creating a plugin using the xml-rpc to send images, Im able to send small images. those are less than 1 mb, But i cant send bigger images. they wont be uploaded using the wp.uploadFile. I thought maybe it was server restriction or server timeout, but no. max upload is 50mbs, and timout i set it to 15 mins just to try. Is there any restriction ?


title: DESC order not working when showing only child categories

text: I'm using this code below to print all my children categories with their parent name, but it only works with `ASC` order, if I change to `DESC` order, it shows an empty result. Is there anything I can do to revert this?               <?     $_cats = array();          $args = array(         'orderby' => 'id',         'order' => 'ASC',         'taxonomy' => 'album'     );          $categories = get_categories($args);     if (!empty($categories)) {         foreach ($categories as $category) {             if ($category->parent != 0) {                 if (!isset($_cats[$category->parent])) {                     $_cats[$category->parent] = array(                         'terms' => array()                     );                 }                      $_cats[$category->parent]['terms'][] = $category;                  } else {                 if (!isset($_cats[$category->term_id]))                     $_cats[$category->term_id] = array();                 $_cats[$category->term_id]['parent_name'] = $category->name;                 $_cats[$category->term_id]['terms']       = array();             }         }     }     if (!empty($_cats)) {         foreach ($_cats as $parentid => $children) {             if (!empty($children['terms'])) {                 foreach ($children['terms'] as $term) {     ?>     --- <?php echo $children['parent_name'] . ' - ' . $term->name; ?>     <?                 }             }         }     }     ?>       You can see the working version at http://lyricssoup.com/. Any help is much appreciated!


title: Extract url from next_image_link

text: Is there a way to extract the url from next_image_link? I want the image on the attachment page to link to the next image, but i didn't manage to figure out how to do it.


title: can't see live version of style.css - is it web server caching?

text: My website is loading style.css?ver=1.0 `style.css?ver=1.0` had different content to style.css, even after a hard refresh of `style.css?ver=1.0` Deleting the browser cache didn't fix the problem. Loading `style.css?ver=1.0` in a different browser did. Going back to the first browser showed `style.css?ver=1.0` now matched `style.css`. Here's the problem: I've updated `style.css` once more, and uploaded it. If I load this file in the browser, it shows the old version. If I do a hard refresh, it shows the old version. If I clear the browser cache, it shows the old version. If I load style.css in a different browser, it shows the old version. If I clear that different browser's cache, it shows the old version. In FileZilla, if I view/edit the remote style.css, it is showing the changes that won't show in the browser. If I wait 5 minutes, I see the new version of style.css in the browser. Is this caused by web server caching?


title: Remote upload file to server B

text: I'm aware this might be some of the hardest coding to do ever, but thought of giving it a try. Im basically trying to detect all (mp3) filetypes uploaded through the Wordpress media upload and send them offsite, thus have them uploaded to a different server through (ftp connection). Below is the code i started after hours of research and i think i'm stucked, honestly i don't even know if i'm at a good point. I hope someone who has much more knowledge with Wordpress/PHP can help me archive what i'm trying to do. I'm doing this to save the main server from been overloaded with big file sizes and limit it to images. I would want the structure uploaded to Server B is: serverB.com/music/Year/month/file.mp3 The year and month should inherit from wordpress post date( 'Y/m' ); After it is uploaded the link that appears in wordpress should be that of serverB.com url to the file. Thank you. Below is the code i started:               <?php     /*       * Change upload directory/server for mp3 files       * Only works in WordPress 3.3+      */          add_filter('wp_handle_upload_prefilter', 'music_pre_upload');     add_filter('wp_handle_upload', 'music_post_upload');          function music_pre_upload($file){     add_filter('upload_dir', 'music_remote_upload_dir');     return $file;     }          function music_post_upload($fileinfo){     remove_filter('upload_dir', 'music_remote_upload_dir');     return $fileinfo;     }          function music_remote_upload_dir($path){         $extension = substr(strrchr($_POST['name'],'.'),1);     if(!empty($path['error']) ||  $extension != 'mp3') { return $path; } // if other     filetype send to default uploads folder.              /**          * Change this to match your server          * You only need to change the those with (*)          * If marked with (-) its optional           */              $post_date = '/' . date( 'Y/m' );              $settings = array(                 'host'          =>        'host or IP',       // * the ftp-server hostname                 'user'          =>        'ftp-username',                // * ftp-user                 'pass'          =>        'ftp-pass',       // * ftp-password                 'cdn'           =>        'external-server.com',          // * This have to be a pointed domain or subdomain to the root of the uploads                 'path'          =>        '/music',                    // - ftp-path, default is root (/). Change here and add the dir on the ftp-server                 'date'          =>        $post_date          // Local post date         );              /**          * Host-connection          * Read about it here: http://php.net/manual/en/function.ftp-connect.php          */              if(function_exists('ftp_ssl_connect'))          {              $connection = ftp_ssl_connect( $settings['host'] );               }             else          {         $connection = ftp_connect( $settings['host'] );          }              /**          * Login to ftp          * Read about it here: http://php.net/manual/en/function.ftp-login.php          */              $login = ftp_login( $connection, $settings['user'], $settings['pass'] );              /**          * Check ftp-connection          */              if ( !$connection || !$login ) {             die('Connection attempt failed, Check your settings');         }             ftp_pasv($resource, true); // To avoid rectify warning             if( ftp_put( $connection, $settings['path'] . "/" . $settings['date'] . "/" . $file, FTP_BINARY ) ) {                echo "successfully uploaded $file\n";                  } else {                echo "There was a problem while uploading $file\n";           }                // close the connection            ftp_close($conn_id);                     } // End function


title: Conditional Javascript based on WP Version

text: How would I go about creating a conditional statement in PHP to load a javascript file dependent on the active version of the WP installation? i.e. if using Wordpress 3.8 load javascript file A, if using Wordpress 3.9 load javascript file B.


title: Extending core class in plugin

text: Hi I am writing a plugin and would like to extend a class in the wp-includes folder. I mean that literally like               class my_class extends wp_includes_class_x{ ... }      However when attempting this I get a `class x not found` error but I know the class is being used by Wordpress. So I try an `include_once(path_to_class)` within my plugin file and that gives me a `Cannot redeclare class` error. Should I be calling the `include` on a special action hook? What am I doing wrong? Thanks guys EDIT My plugin is OO and so I call `$my_plugin = new My_Plugin_Class();` in my plugin file. Inside this main class I try to instantiate an instance of the class that extends the wp_includes class that I don't wish to name so that I can keep my project a surprise               $my_plugin = new My_Plugin_Class();          class My_Plugin_Class{              public function __construct(){         $wp_include_class_extension = new WP_Class_Extension();         }          }          class WP_Class_Extension extends Some_Core_Class{         public function __construct(){         //blah blah         }     }     //CAUSES ERROR class Some_Core_Class not found      EDIT Found a solution - see comments below - thanks for the help guys


title: Resize Image without cropping

text: Currently I’m working on a WordPress plugin and as part of it users can upload Images. What I want to do is that these uploaded images of any size will be resized to 100px by 100px without cropping. Here’s the part of the code where the resizing is done. It works but, but not without cropping. I hope someone can help getting this work without cropping the images. It would be best if this would be possible by using the WordPress own functions only.               $editor = wp_get_image_editor( $avatar_full_path );     if ( ! is_wp_error( $editor ) ) {         $resized = $editor->resize( 100, 100, true );         if ( ! is_wp_error( $resized ) ) {             $dest_file = $editor->generate_filename();             $saved = $editor->save( $dest_file );             if ( ! is_wp_error( $saved ) )                 $local_avatars[$size] = str_replace( $upload_path['basedir'], $upload_path['baseurl'], $dest_file );         }     }


title: Dynamically generating an '<a name="">' reference with PHP

text:
I'm trying to dynamically generate a `<a name="">` link reference inside of a Wordpress plugin. The plugin will output this link reference inside of the posts it generates. The categories of posts that this plugin generates will always be changing, so when we link to those posts from a separate page, we still need to be able to identify each one individually somehow. My best guess was to just reference them by a single number (i.e. 1, 2, 3, 4, etc). The code is below.....please read the bottom of this post before examining the code.               <?php     /*     Plugin Name: Posts for Page Plugin     Plugin URI: http://www.mywebdeveloperblog.com/development/wordpress/posts-for-page-     wordpress-plugin     Description: This plugin allows for posts to be assigned to pages as snippets or     full posts. Posts can be selected by category slug, category id, tag slug, single     post id, author and ordered by date or title.     Version: 1.5     Author: Simon Hibbard     Author URI: http://www.mywebdeveloperblog.com/     License: GPL2     */     ?>     <?php          //tell wordpress to register the children-excerpt shortcode     add_shortcode("posts-for-page", "sc_posts_for_page");          function remove_images( $content ) {     $postOutput = preg_replace('/]+./','', $content);     return $postOutput;     }          //children excerpt shortcode worker function     function sc_posts_for_page($atts, $content = null){          if($atts['length'] > 0 ){     }else{         $atts['length'] = 50;     }     //echo $atts['read_more'];     if($atts['read_more'] != "" ){         $_opts['readMoreText'] = $atts['read_more'];     }else{         $_opts['readMoreText'] = "Read More »";     }          if($atts['prev_text'] != "" ){         $_opts['prevText'] = $atts['prev_text'];     }else{         $_opts['prevText'] = "« Newer Entries";     }          if($atts['next_text'] != "" ){         $_opts['nextText'] = $atts['next_text'];     }else{         $_opts['nextText'] = "Older Entries » ";     }          // set values from the shortcode     $_opts['cat_slug'] = $atts['cat_slug'];     $_opts['cat'] = $atts['cat'];     $_opts['tag_slug'] = $atts['tag_slug'];     $_opts['order_by'] = $atts['order_by'];     $_opts['post_id'] = $atts['post_id'];     $_opts['author'] = $atts['author'];     $_opts['num'] = $atts['num'];          $_opts['showFullPost'] = $atts['show_full_posts'];          // handle paging if limit on posts set     //if($_opts['num'] != "")     //{     //  $thispage = get_permalink();     //  $_opts['page_num'] = get_query_var('page');      //  if($_opts['page_num'] != "")     //  {     //      $prev = $_opts['page_num'] - 1;     //      $next = $_opts['page_num'] + 1;     //      if($prev == 0)     //      {     //          $prevLink = "Prev";     //      }     //      else     //      {     //          $prevLink = "Prev";     //      }     //      $nextLink = "Next";     //  }     //  else     //  {     //      $prevLink = "";     //      $nextLink = "Next";     //  }     //}     global $paged;     if (empty($paged)) {             $_opts['cur_page'] = 1;     }     else     {         $_opts['cur_page'] = $paged;     }          // these do not currently work - wp needs the image already saved to a size we just use wp thumbnails for now     //$_opts['imageH'] = $atts['thumb_h'];     //$_opts['imageW'] = $atts['thumb_w'];     $_opts['hide_images'] = $atts['hide_images'];          //get the id of the current article that is calling the shortcode     $parent_id = get_the_ID();          $output = "";          $i = 0;          $children  = pfp_get_posts($_opts);          if (is_array($children))     {         if(count($children) <= 0){             $out = "Items for Page: There are no posts that match the selection criteria.";             return $out;         }              foreach( $children as $child ) {             $title = $child->post_title;             $link = get_permalink($child->ID);                  if($_opts['showFullPost'] == "true")             {                $output .= "
";                $output .= "
$title
";                 $output .= $child->post_content;                 $output .= "

";                //$output .= "
";                              $output .= "
";                 }             else             {                      // remove all images from the post                 $child->post_content = remove_images($child->post_content);                      $args = array(                 'numberposts' => 1,                 'order'=> 'ASC',                 'post_mime_type' => 'image',                 'post_parent' => $child->ID ,                 'post_status' => null,                 'post_type' => 'attachment'                 );                      if($_opts['hide_images'] == 'true')                 {                     $imageSrc =  '';                 }                 else                 {                     //get the first image and resize it                      $attachments = get_children( $args );                     //echo "here" .$_opts['imageH'];                     if ($attachments) {                         foreach($attachments as $attachment) {                                  //if(($_opts['imageH'] > 0) && ($_opts['imageW'] > 0)){                             //  // get size based on params                             //  $size =  array($_opts['imageW'], $_opts['imageH']);                             //  echo "Here" . $size[0];                             //  $imageSrc = 'ID, $size).'" />';                             //}else{                                      $image_attributes = wp_get_attachment_image_src( $attachment->ID, 'thumbnail' )  ? wp_get_attachment_image_src( $attachment->ID, 'thumbnail' ) : wp_get_attachment_image_src( $attachment->ID, 'full' );                                 $imageSrc = 'ID ).'" />';                                  //}                              }                     }                        else                     {                         $imageSrc =  '';                     }                 }                      //split excerpt into array for processing                 $words = explode(' ', strip_tags($child->post_content));                      //chop off the excerpt based on the atts->lenth                 $words = array_slice($words, 0, $atts['length']);                      //merge the array of words for the excerpt back into sentances                 $child_excerpt = $imageSrc . implode(' ', $words);                                                                              $output .= "
";                                  $output .= "
";                                  $output .= "
";                                  $output .= "
";                                  $output .= "
";                                  $output .= "
";                                  $output .= "
";                                   $output .= "
";                                  $output .= "
";                                                       //original plugin display code starts here                 $output .= "
";                $output .= "
<a name='<?php echo $i++; ?>' style='color:#4a79a4; font-family:comic; font-size:1em' href='$link'>$title
";                 $output .= $child_excerpt ."...";                 $output .= "" . $_opts['readMoreText'] . "";                 $output .= "

";                //$output .= "
";                 $output .= "
";                //original plugin display code                           $output .= "

";                 $output .= "";                                 $output .= "
";                 $output .= "
";                 $output .= "
";                 $output .= "
";                 $output .= "
";                 $output .= "
";                 $output .= "
";                 $output .= "
";                 $output .= "
";                     $output .= "

";             }                    }     }          // output links     //if($_opts['num'] != "")     //{     //echo $wp_query->found_posts;     //  $output .= $prevLink;     //  if($wp_query->found_posts > ($_opts['num'] * $_opts['page_num']))     //  {     //      $output .= $nextLink;     //  }     //}          global $wp_query;     $page_links_total =  $wp_query->max_num_pages;          //echo "currentpage:" . $_opts['cur_page'];     //echo "totalpages:" . $page_links_total;          if($_opts['cur_page'] > 1)     {         // show prev         //previous_posts_link($_opts['prevText']);         $output .= "" . get_previous_posts_link($_opts['prevText']) . "";     }     if($_opts['cur_page'] <  $page_links_total)     {         // show next         //next_posts_link($_opts['nextText']);         $output .= "" . get_next_posts_link($_opts['nextText']) . "";     }               wp_reset_query();     return $output;          }          function pfp_get_posts($pfp_opts) {          $params = array();     if ($pfp_opts['post_id'] == '') { // for multiposts              if ($pfp_opts['tag_slug'] != ''){             $params['tag_slug__in'] = explode(",", $pfp_opts['tag_slug']);         }         if ($pfp_opts['cat'] != ''){             $params['category__in'] =  explode(",", $pfp_opts['cat']);         }         if ($pfp_opts['cat_slug'] != '') {             $params['category_name'] = $pfp_opts['cat_slug'];         }         if($pfp_opts['author'] != '') {             $params['author'] = $pfp_opts['author'];         }         if($pfp_opts['order_by'] != '') {             $params['order_by'] = $pfp_opts['order_by'];         }         if($pfp_opts['num'] != '') {             //$params['numberposts'] = $pfp_opts['num'];             $params['posts_per_page'] = $pfp_opts['num'];             $params['paged'] = $pfp_opts['cur_page'];             //if($pfp_opts['page_num'] != '') {                 // work out offset depending on page num                 //$offset = $pfp_opts['page_num'] * $pfp_opts['num'];                      //$params['offset'] = $offset;             //}         }         else         {             $params['posts_per_page'] =  -1; // gets them all         }         // apply whatever the case:         $params['suppress_filters'] = false;                   // get the posts         //$postslist = get_posts($params);         $postslist = query_posts($params);          }else{ // for single posts         $postslist[0] = wp_get_single_post($pfp_opts['post_id']);     }     return $postslist;     }               //add_action('admin_menu', 'my_plugin_menu');          //function my_plugin_menu() {     //add_options_page('Posts for Page Plugin Options', 'Posts for Page Plugin', 'manage_options', 'pfp-unique-identifier', 'my_plugin_options');     //}          function my_plugin_options() {     if (!current_user_can('manage_options'))  {         wp_die( __('You do not have sufficient permissions to access this page.') );     }     echo '
';     echo '
How to use: In your page (HTML view) add shortcode e.g. [posts-in-page cat_slug=\'asp-net-programming-2\']

This will get all posts with the category slug \'asp-net-programming-2\'
 ';     echo '
post_id - Gets a post by ID, tag_slug - gets posts by tag slug, cat - gets posts with a category ID, cat_slug - gets posts with this category slug, author - gets posts by author, order_by - date or title, num - number of posts to show
';     echo '
';     }          add_action('wp_head', 'get_pfp_css');          function get_pfp_css()     {     echo '<link type="text/css" rel="stylesheet" href="' . get_bloginfo('wpurl') . '/wp-content/plugins/posts-for-page/pfp.css" />' . "\n";     }     ?>      Below is the exact line of output I'm trying to modify in the code above (in the code above, about 2/3 down the page). Notice that I have tried to use an "increment" in order to add some type of identifier to the `<a name="">` reference. I don't care what the identifier name is, but I need it to generate automatically so that I can reference it in a link from another page.               $output .= "
<a name='<?php echo $i++; ?>' style='color:#4a79a4; font-family:comic; font-size:1em' href='$link'>$title
";


title: Wordpress crashes when I click add new plugin

text: I recently uninstalled the plugin SEO Facebook Comments Since then when I click on add new plugin I get this error, > Warning: require_once(D:\Dropbox\htdocs\bcu/wp-admin/includes/class-wp- > plugin-install-list-table.php): failed to open stream: No such file or > directory in D:\Dropbox\htdocs\bcu\wp-admin\includes\list-table.php on line > 42 > > Fatal error: require_once(): Failed opening required > 'D:\Dropbox\htdocs\bcu/wp-admin/includes/class-wp-plugin-install-list- > table.php' (include_path='D:\Dropbox\htdocs\bcu\wp-content\plugins\google- > analyticator\google-api-php-client\src;.;D:\xampp\php\PEAR') in > D:\Dropbox\htdocs\bcu\wp-admin\includes\list-table.php on line 42 I've looked for this error on google and this site although I cannot seem to find anyone else with this error? Can anyone suggest on how I can get past this?


title: ajax sends data to plugin

text: I'm trying to send datas via jquery ajax to my plugins class to update a filed in a table and I'm getting the following error Fatal error: Call to a member function query() my class looks like               class MyClass{              function __construct(){                  global $wpdb;             $this->db = $wpdb;             //add_filter('query_vars', 'parameter_queryvars' );         }          //Save ajax datas         public function save_tips($token, $tips){                 $this->db->query(                     $this->db->prepare(                         "UPDATE wp_competitors SET results= %s, update_time= %d",                         $tips ,$cur_date = date('Y-m-d H:i:s'),  "WHERE token = $token                     ") // $wpdb->prepare                 );               }     }      } when I send the datas with ajax the entry file is my plugin main file and I fire on with the following code               if ($_POST['results']){         $token = '393a9276ae329e00b3739d2e76e52f3b';         $tips = json_encode($_POST['results']);         $save = new Tipspiel();         $save->save_tips($token, $tips);              return 'OK';     }      it seems like all wordpress funtions are ignored updating the codes after the feedback from @toscho I was adding the following in my javascript               $j("form#tiepspiel").submit(function(e) {             e.preventDefault(); // this disables the submit button so the user stays on the page                         var str = $j(this).serialize();            //alert(decodeURIComponent(str));             if ($j('ul#sortables li').size() > 10){                      $j( "#dialog-modal" ).dialog({                         height: 140,                         modal: true                     });                 return;             }             var data = {                     action: 'TIPPS',                          tips: str,                         _ajax_nonce: "<?php echo wp_create_nonce( 'my_ajax_nonce' ); ?>"                      };                  $j.post(ajaxurl, data, function(response) {                 alert('Got this from the server: ' + response);                 //$j.cookie("tipspiel", "competitor", { expires: 1 });                $j('form#tiepspiel').fadeOut('slow', function() {                     // Animation complete.                   });             });                       });       and adding this in my plugins entry file               add_action('wp_ajax_nopriv_TIPPS', 'tipps_processing_function');                    function tipps_processing_function(){         check_ajax_referer('my_ajax_nonce');              if ($_POST['results']){             $token = '393a9276ae329e00b3739d2e76e52f3b';             $tips = json_encode($_POST['results']);             $save = new Tipspiel();             $save->save_tips($token, $tips);                  return 'OK';         }         //do stuff here     }      is not clear how to pass the recived variables to my class


title: Add custom image sizes to media uploader

text: I want to add custom image sizes to the media uploader: ![media uploader](http://i.stack.imgur.com/y9LXW.png) In order to do this, I use the following code (comments are there for convenience):               // this function adds the custom image sizes to the media uploader     function my_insert_custom_image_sizes( $sizes ) {         // get the custom image sizes         global $_wp_additional_image_sizes;         // if there are none, just return the built-in sizes         if ( empty( $_wp_additional_image_sizes ) )             return $sizes;              // add all the custom sizes to the built-in sizes         foreach ( $_wp_additional_image_sizes as $id => $data ) {             // take the size ID (e.g., 'my-name'), replace hyphens with spaces,             // and capitalise the first letter of each word             if ( !isset($sizes[$id]) )                 $sizes[$id] = ucfirst( str_replace( '-', ' ', $id ) );         }              return $sizes;     }          // define the init function next, which sets up all the necessary stuff     function custom_image_setup () {         add_theme_support( 'post-thumbnails' );         add_image_size( 'my-size1', 250, 250 );         add_image_size( 'my-size2', 350, 350 );         add_image_size( 'my-size3', 450, 450 );         add_filter( 'image_size_names_choose', 'my_insert_custom_image_sizes' );     }          // attach that init function to the 'after_setup_theme' hook     // so it runs on each page load once your theme's been loaded     add_action( 'after_setup_theme', 'custom_image_setup' );      This code works fine. Beside one issue: When uploading an image, if it is smaller than the dimensions of the smallest custom image size, then this error appears: `Invalid argument supplied for foreach()`. I presume the problem comes from the `my_insert_custom_image_sizes` function. So basically, when no custom image is made, the error appears. How can I fix this? I have a feeling the problem is something simple that I overlooked but I'm lost... If you want to replicate this error, just paste the above code in functions and upload an image that is **smaller** than 250x250 in pixels. **UPDATE** : After some further research, it appears that the error is related to the foreach in my JPEG compression function:               // Set JPEG compression quality     add_filter('jpeg_quality', create_function('$quality', 'return 100;'));     add_action('added_post_meta', 'ad_update_jpeg_quality', 10, 4);          function ad_update_jpeg_quality($meta_id, $attach_id, $meta_key, $attach_meta) {              if ($meta_key == '_wp_attachment_metadata') {                  $post = get_post($attach_id);                  if ($post->post_mime_type == 'image/jpeg') {                      $pathinfo = pathinfo($attach_meta['file']);                 $uploads = wp_upload_dir();                 $dir = $uploads['basedir'] . '/' . $pathinfo['dirname'];                      foreach ($attach_meta['sizes'] as $size => $value) {                          $image = $dir . '/' . $value['file'];                     $resource = imagecreatefromjpeg($image);                          if ($size == 'large') {                         // set the jpeg quality for 'large' size                         imagejpeg($resource, $image, 35);                     } elseif ($size == 'medium') {                         // set the jpeg quality for the 'medium' size                         imagejpeg($resource, $image, 35);                     } elseif ($size == 'small') {                         // set the jpeg quality for the 'small' size                         imagejpeg($resource, $image, 40);                     } else {                         // set the jpeg quality for the rest of sizes                         imagejpeg($resource, $image, 90);                     }                          imagedestroy($resource);                 }             }         }     }      Any ideas what is wrong with it?


title: audio streaming plugin but with no save option?

text: I need to publish a audio file that I want to make available to   * listen and   * not to download any idea how to do it? Is there any free WP plugin for that? Something where user cannot save the audo using any webbrowser plugin like DownloadHelper etc.


title: display posts from specific category on a page , in thematic child theme?

text:
i have a blog page template , i need to make it display posts from specific category called news this is the template , i use thematic framework child theme               <?php     /**     * Template Name: Blog     *     * This template allows you to display the latest posts on any page of the site.     *     */              // calling the header.php         get_header();              // action hook for placing content above #container         thematic_abovecontainer();          ?>
     <?php thematic_abovecontent(); ?>
     <?php     $wp_query = new WP_Query();     $wp_query->query( array( 'posts_per_page' => get_option( 'posts_per_page' ), 'paged' => $paged ) );     $more = 0;     ?>          <?php                       // create the navigation above the content                  thematic_navigation_above();                       // calling the widget area 'index-top'                  get_sidebar('index-top');                       // action hook for placing content above the index loop                  thematic_above_indexloop();                       // action hook creating the index loop                  thematic_indexloop();                       // action hook for placing content below the index loop                  thematic_below_indexloop();                       // calling the widget area 'index-bottom'                  get_sidebar('index-bottom');                       // create the navigation below the content                  thematic_navigation_below();                       ?>
     <?php thematic_belowcontent(); ?>
          <?php              // action hook for placing content below #container         thematic_belowcontainer();              // calling the standard sidebar         /*thematic_sidebar();*/              // calling footer.php         get_footer();          ?>


title: How to add custom menu item on plugin activation?

text: When my plugin is activated, I would like to add a new menu item. Here is my code:               class My_Plugin {       function __construct() {         register_activation_hook(__FILE__, array($this, 'install'));       }            function install() {         add_action('admin_menu', array($this, 'add_menu_item'));       }            public function add_menu_item() {         add_menu_page(...);       }     }          $my_plugin = new My_Plugin();      Unfortunately, it doesn't work. I notice that `install` is called, but `add_menu_item` isn't. What would be the proper way to do this?


title: Drag-and-drop "Panels"-style visual layout editor?

text: I'm a combination Drupal and WordPress developer and have recently started playing with Drupal's Panels module -- which allows you to create flexible layouts and drop content blocks (The Drupal equivalent of widgets) in place on either a per-layout or per-content item basis. I'm now working on a WordPress project that would really benefit from this kind of functionality — **is there a visual layout editor for WordPress that even slightly resembles Panels?** By "visual layout editor", I mean something that can have text and/or widgets added on an ad-hoc basis to regions created by either dragging column widths or click-and-dragging selections (Similar to Adobe InDesign). **Edit:** It's a year later, so I've created a wiki answer below. The original question has been updated to reflect this.


title: Post Submission from frontend with custom field isn't working

text:
I'm working with submitting posts from fronted which has some custom fields. I used shortcode API to use the form in any page/post. The code should be found bellow. But after submitting the form, nothing happened and the form returns. I need your kind help.               <?php     //Shortcode API     function apl_video(){     global $current_user;     get_currentuserinfo();     if (!isset($_POST['submit'])) {          ?>     <form name="new_post" method="post" action="">

Video Title	<input id="post_title" tabindex="1" type="text" name="post_title"/>

Video Width	<input id="vid_wid" tabindex="2" type="text" name="vid_wid"/>

Video Height	<input id="vid_hei" tabindex="3" type="text" name="vid_hei"/>

Autoplay	<select tabindex="4" name="vid_ply" id="vid_ply">             <option value="Yes">Yes</option>             <option value="No">No</option>             </select>

Skin	<select tabindex="5" name="vid_ski" id="vid_ski">             <option value="player1">Player 1</option>             <option value="player2">Player 2</option>             </select>

               Youtube Video Link	               <input id="vid_you" tabindex="6" type="text" name="vid_you"/>

               MP4 Video Link	               <input id="vid_mp4" tabindex="7" type="text" name="vid_mp4"/>

               OGG Video Link	               <input id="vid_hei" tabindex="8" type="text" name="vid_ogg"/>

               WEBM Video Link	               <input id="vid_hei" tabindex="9" type="text" name="vid_web"/>

               Poster Image Link	               <input id="vid_hei" tabindex="10" type="text" name="vid_pst"/>

                       	                      <?php wp_nonce_field( 'new-post' ); ?>                      <input type="submit" value="Generate" name="submit"/>

                    </form>          <?php }          else {         $title      =   esc_attr($_POST['post_title']);         $vid_wid    =   esc_attr($_POST['vid_wid']);         $vid_hei    =   esc_attr($_POST['vid_hei']);         $vid_ply    =   esc_attr($_POST['vid_ply']);         $vid_ski    =   esc_attr($_POST['vid_ski']);         $vid_you    =   esc_attr($_POST['vid_you']);         $vid_mp4    =   esc_attr($_POST['vid_mp4']);         $vid_web    =   esc_attr($_POST['vid_web']);         $vid_ogg    =   esc_attr($_POST['vid_ogg']);         $vid_pst    =   esc_attr($_POST['vid_pst']);                   global $user_ID;              $new_post = array(                 'post_title'    => $title,                 'post_status'   => 'publish',                 'post_type'     => 'video',                 'post_date'     => date('Y-m-d H:i:s'),                 'post_author'   => $user_ID,         );              //save the new post         $pid    =   wp_insert_post($new_post);              // Do the wp_insert_post action to insert it         do_action('wp_insert_post', 'wp_insert_post');               add_post_meta($pid, 'vid_wid', $vid_pst, true);         add_post_meta($pid, 'vid_hei', $vid_hei, true);         add_post_meta($pid, 'vid_ply', $vid_ply, true);         add_post_meta($pid, 'vid_ski', $vid_ski, true);         add_post_meta($pid, 'vid_you', $vid_you, true);         add_post_meta($pid, 'vid_ogg', $vid_ogg, true);         add_post_meta($pid, 'vid_web', $vid_web, true);         add_post_meta($pid, 'vid_mp4', $vid_mp4, true);         add_post_meta($pid, 'vid_pst', $vid_pst, true);                        //Result         echo 'Done';                            }     }               add_shortcode( 'wpvideogen', 'apl_video' );


title: br tags on backend not showing up on frontend

text: I was really searching here for a solution for this but I couldn't find anything. **Problem:** br and/or br / tags which I put into my content on the backend were just not showing up on the frontend. No matter what I did - enter+shift in the visual or insert the tags manually in the html editor - I tried several things but nothing worked. Interesting fact: on the page I am working have already been a few br's which are working without any problems, so I looked through the code if there was something but I still couldn't find anything. I found an **acceptable solution** for this: Simple Breaks. This plugin gives me the possibility to insert br tags by writing the shortcode "[br]". I'm kinda fine with that. Still I truely want to ask you if you have similiar problems or if there is any solution to this! It is known that WP has it's problems with br's and p's so I guess the users just have to go with it. Greetings from germany and pls don't be too hard on my bad english :) **More information:**   * I already unchecked "WordPress should correct invalidly nested XHTML automatically" in Admin > Settings > Writing. (thanks to PoseLab)   * I installed TinyMCE Advanced and checked "Stop removing the  and   tags when saving and show them in the HTML editor"


title: Is it possible to save more than one image to an option?

text: The following code allows you to upload multiple images but only one is saved to the option. Can multiple images be saved to the option as an array or would I have to create separate controls?               $wp_customize->add_section("slider",array(         'title'=>"Slider",         'description'=>"Choose the images for the slider",         'priority'=>'36'     ));          //images     $wp_customize->add_setting("slider[images]",array(         'default'=>"",         'type'=>"option"     ));     $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize,"slider[images]",array(         'label'=>__("Images","adaptive-framework"),         'section'=>"slider",         'settings'=>"slider[images]"     )));


title: Wp eCommerce meta information search

text: Out of the box, WP eCommerce does not support Meta search. This is a big problem if you are selling books online and need clients to be able to search by the most important Meta tag, Author! Can someone please tell me how I could go about including the meta information search or is there a better plugin that does not cost an arm and a leg to search for meta information too? Many thanks


title: Customizing Users in Admin Area

text: I know how to customize the users in the admin area of WordPress. I have done it many times. However, I would like to customize the user a bit differently as explained below. I would like to add a new labe and a new textbox associated with that label. Lets call them "Label 1" and "Textbox 1". I like to add those under the "Username" field set and before the "Role" field set. In other words, I like the admin area for the user to look like this after the customization"               Username: <TEXTBOX FOR USER NAME>     Label 1: <TEXTBOX 1>     Role: <DROPDOWN LIST FOR ROLES>      All examples I found describe adding the new fields at the bottom of the User page. How can I add them to the middle? Thanks.


title: get_the_author_meta

text: I am just wondering if `get_the_author_meta()` returns value after unserializing in case it is stored in database as a serialized array? Until today, on my script, this has been returning data in form of an array after unserializing it and array functions on returned data were working fine. But today array functions stopped working because it's no more returning unserialized array. It returns `a:1:{i:0;s:11:"test";}` which is making my script break... It was working fine... How is it possible?


title: selected menu item

text: The template I'm working on for a client has the following pages:   * Home : a custom static page that displays the content of a certain WP page, and the latest sticky posts. This is the front-page.php file.   * About us: a WP page   * Services : a WP page   * Events : a list of WP posts, in the Events category   * Blog : a list of WP in the Blog category I'd like to highlight the current section in the main menu in CSS, but the only idea I have is to make a big list of PHP conditionals depending on the current case. For example if we are seeing the Events category, then we must be in the Events section, and so on. Is there a more straightforward way of accomplishing this?


title: wp_head() - list hooked actions with priorities?

text: I'd like to add something to `wp_head()` but I'm aiming precise location (like after style.css but before rtl.css and before my other custom script). I'm wondering if it's possible to list everything that is attached to `wp_head()` in execution/display order anyhow? I know that I can pass priority/order parameter to `add_action` but I need to know what number will that be.               add_action( 'wp_head', 'my_function', 10 );      It all starts with `10` but somehow rtl.css seems to be always after style.css. Is it `11` maybe? How do I find that out?


title: Removing meta boxes: remove-meta_box() or unset()?

text: I've seen two ways to remove meta boxes: remove_meta_box() and unset().               function TEST_remove_dashboard_widgets(){         remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );     }     add_action('wp_dashboard_setup', 'bmc_remove_dashboard_widgets');      vs.               function TEST_remove_dashboard_widgets() {         global $wp_meta_boxes;         unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);     }     add_action('wp_dashboard_setup', 'bmc_remove_dashboard_widgets');      remove_meta_box seems better since it's clearly intended just for that, but I've also seen the unset formulation in several places. Why would I use one vs. the other?


title: Enable comments for post when comments meta box removed

text: I've hit the issue described in '11: "Enable comments for post with comments meta box removed" and I'd like to ask for your help to adapt the mentioned there code to the current wordpress version. I have a custom post type that must have comments enabled and _contributors_ must not be able to disable comments. I've enabled comments in Settings->Discussion and removed the `commentstatusdiv` meta box with `remove_meta_box()`. After that I've figured out that comments is unset when the meta box is disabled. I am looking for the way to enforce the comments now.


title: Display random posts, but omit the post it is on?

text: I am trying to have a section under a single post where it displays completely random posts. I got everything working, but every once in a while one of the random posts that get displayed is the actual post that it is on (the single). Here is my code:               <?php     $args = array( 'numberposts' => 3, 'orderby' => 'rand' );     $rand_posts = get_posts( $args );     foreach( $rand_posts as $post ) : ?>     <?php endforeach; ?>      Is there anyway to not have it ever display the post it is on? Thank you.


title: How to add HTML / Form to an Admin Bar Menu

text: I'd like to add a custom form to the admin bar in Wordpress. is there a way to accomplish this? So far all of the documentation seems to only allow the addition of simple text links.


title: Local version of jquery not working right

text: Developing a theme for someone else, nornally on sites I'd maintain I'd use google CDN to load jquery like so:               //don't use (deregister) WP's jQuery version     wp_deregister_script( 'jquery' );          //Use jQuery from Google Code     wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js');     wp_enqueue_script('jquery'););      But after deleting that WordPress's local version breaks my site, it's loading the same version just from wp-includes, jquery 1.11.1. When I use google CDN it's all fine. When I use the local version it just throws up errors in my JS like 'Uncaught TypeError: undefined is not a function' on the first line of my main.js file. Totally perplexed as to what would cause this issue.