How should I change the username of or delete the admin user?

I would like to either delete or change the username of the original administrator account created during the install of a WP 3.2 site. This is not possible via the admin interface (There is a message to say that usernames cannot be changed and the delete option is not available). I have a requirement to change the username or delete the account. Is there a safe way to do this by editing the DB directly e.g. just edit the admin user row in the users table directly and alter the username?


My posts show 2 comment forms

We have a Wordpress site, lifering.org, hosted on GoDaddy. We recently upgraded our virtual server's Linux operating system, which involved rebuilding the site from a backup. Now I our single posts are displaying TWO comment reply forms. I'm sure we only had one comment reply form per post before. I don't know how this happened - I took the backup myself - or how to fix it.


Should I use a Meta field or custom table?

From a performance only perspective, can anyone with more more experience of the WordPress core tell me if writing something like a post view counter to a separate table in MySQL would be quicker for read and writes compared to using a Custom Meta Field? I know most people will answer with Custom Meta Field solely on the reason that it's best to use the Wordpress API/functions. However my past 12 years has been building PHP applications that handle millions of users/high traffic and I know caching is the answer but I am interested in improving MySQL queries as well. Looking at a lot of other plugins, I have seen it done both ways (for the record I am not asking this question for use in a plugin it will be for personal use in a theme) Can anyone tell me any pros and cons of each method? For example when a page is loaded in WordPress, I have not looked at how it is pulling in the meta fields, if it pulls them all in 1 query, it might be faster to use a meta field vs making another query to a separate table.


Password form redirection to belonging post

My idea is that the visitor enters the password on a page and than the wordpress post with belonging password load if there is one. Here is the code: Form on page:               <form method="post" action="">       <input type="password" name="passwordfield">       <input type="hidden" name="homepagepassword" value="1">       <input type="submit" value="Submit">     </form>      Function.php:               function dopasswordstuff(){         if(isset($_POST['homepagepassword'])){         $post_password = $_POST['passwordfield'];         global $wpdb;         $post_id = $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_password = %s", $post_password) );         $q = new WP_Query( 'p=$post_id' );         if($q->have_posts()){             while($q->have_posts()){                 $q->the_post();                 wp_redirect( get_permalink ());                 die();             }         } else {             // oh dear, there isnt a post with this 'password', put a redirect to a fallback here             wp_redirect('http://www.google.com');             die();         }         wp_reset_query();         }     }     add_action('init','dopasswordstuff');      No matter what I do, and no matter what password I enter, the function just directs me to the first post on my blog. Can anybody shed some light on this?


sub menu in bootstrap is not displaying

this is my custom walker function.               class Bootstrap_Walker extends Walker_Nav_Menu     {         function start_lvl(&$output, $depth = 0, $args = array()) {       $output .= "\n
\n";      }               function start_el(&$output, $item, $depth, $args) {        $item_html = '';        parent::start_el($item_html, $item, $depth, $args);                  if ( $item->is_dropdown && $depth === 0 ) {                 $item_html = str_replace( '<a', '<a class="dropdown-toggle " data-toggle="dropdown"', $item_html );            $item_html = str_replace( '', ' ', $item_html );        }             $output .= $item_html;     }          function display_element($element, &$children_elements, $max_depth, $depth, $args, &$output) {         if ( $element->current )         $element->classes[] = 'active';             $element->is_dropdown = !empty( $children_elements[$element->ID] );     //$element->hasChildren = isset($children_elements[$element->ID]) && !empty($children_elements[$element->ID]);        if ( $element->is_dropdown ) {             if ( $element->has_children) {                 $element->classes[] = 'open';             } else{                      $element->classes[] = 'dropdown';             }         }            return parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output);         }            }      the "open" class is used for showing the submenu. please help me to find the errors.


Do I really need the div class entry?

I was wondering if it's really neccessary to keep the `<div class="entry">` in the page.php file (or any other template for that matter). I typically use a blank HTML5 wordpress theme and it doesn't have any declarations within the CSS file for that class. So I just wanted to get other opinions on it. Thanks!


How to Make a Category Always Selected?

I'm trying to write a function to make certain terms of default category always selected. When the user is writing a new post, the term checkbox should be checked and he shouldn't be able to unckeck it. Is it possible?


How to use the do_action () with parameter

I am trying to trigger an action in _functions.php_ with the `do_action()` function, but I appear to need an attribute. The following               do_action( 'really_simple_share button="facebook_like"');      does not work... Can you tell me the proper way to make it work (I have tried many other things that did not work either).


Extending the walker class to add a top level list item to the nav menu in a different order

I've seen functions to append to the beginning or the end of the menu, but how do I add this list item right after the first? So it would come second in the menu order. Is this possible? If so, how would I extend the walker class to do it?


Loading multiple post content in FancyBox

I have a custom post type being output as a list. I'm trying to output some of the inline content in each li via Fancybox. All works so far except it only shows the first li's content. I understand that the problem is I'm calling the same ID every time in the loop. I used the last post here to get each ID to be numbered, which works fine, I can now see each link ID is #content1, #content2, #content3 etc. But how do I change my javascript to work for all the #content numbers? The base script I have is:                   $('a[href="#content"]').fancybox({             autoSize : false,             width : 600,             wrapCSS : 'inline-content'         });      And here is my loop that adds numbers to each ID...                   <?php $args = array(                  'post_type' => 'otherwork',                 'posts_per_page' => -1,                 'orderby'=>'date',                 'order'=>'ASC'             );             $loop = new WP_Query( $args ); $i = 0; ?>

                      <?php while ( $loop->have_posts() ) : $loop->the_post(); $i++; ?>
                             <a href="#content<?php echo $i; ?>" ><?php the_post_thumbnail( 'otherwork-thumb' ); ?>                             <div id="content<?php echo $i; ?>" style="display:none">
<?php the_title(); ?>
                                 <?php the_post_thumbnail(); ?>                                 <?php the_content(); ?>

                     <?php endwhile; ?>

      HTML output for more info...

      Thanks for any help!


Fatal error: Call to undefined function the_ratings_results()

I was wondering if I rack your brains a bit on this one. I have a custom theme that has files in the theme folder but do not load as wp template files on the page settings. I also run EDD (easy digital downloads). I have installed WP-PostRatings and calling the function               <?php if(function_exists("kk_star_ratings")) : echo kk_star_ratings($pid); endif; ?>       works fine. As soon as I want to call another function code here               <?php echo the_ratings_results($post->ID) ?>      I get the Fatal error to undefined function. Googling about and asking the plugin author it seems I need to include the header in the template. I am using the header but seems I need to call wp- blog-header. I am currently on localhost, windows. I have tried to call the wp-blog-header in the template file it fails to call the function. I have also tried to call it with the absolute file path and the following.               <?php require ('C:\wamp\www\mysite\wp-blog-header.php'); ?>          <?php require ('./wp-blog-header.php'); ?>          <?php require ('../../../wp-blog-header.php'); ?>      None of which work and I still get the error! I then tried all these in my index.php in the theme folder. By default the file includes it anyways.               define('WP_USE_THEMES', true);          /** Loads the WordPress Environment and Template */     require('./wp-blog-header.php');      My question is how is this still failing to call the function?


Define page template in wp_insert_post

How can I set which page template this page, created using `wp_insert_post`, uses? I want it to use `template-blog.php` This is my current function;               add_action( 'admin_init', 'mytheme_admin_init' );     function mytheme_admin_init() {     if ( get_option( 'mytheme_installed' ) != true ) {         $new_page = array(             'slug' => 'blog',             'title' => 'Blog',             'content' => ""         );         $new_page_id = wp_insert_post( array(             'post_title' => $new_page['title'],             'post_type'     => 'page',             'post_name'  => $new_page['slug'],             'comment_status' => 'closed',             'ping_status' => 'closed',             'post_content' => $new_page['content'],             'post_status' => 'publish',             'post_author' => 1,             'menu_order' => 0         ));              update_option( 'mytheme_installed', true );     }     }


How to create sub menu with a URL parameter?

I would like to add parameter for the submenus, but when I click to the admin page I receive the following message: > You do not have sufficient permissions to access this page. **Code:**               add_submenu_page(       'sandbox',                       'Sandbox Options',               'Options',                       'administrator',                 'sandbox_options&tab=4',         'sandbox_options_display'     );       Without _& tab=4_ everything is okay.


Archive for custom fields?

Recently I've done a nice taxonomy system on my WordPress website. Created also the taxonomy archive template files, so wherever I'm listing the taxonomies I can click on them and will bring me on a results page filtered by the clicked taxonomy. I'm wondering if the same situation can be reproduced also with custom fields? I know custom fields are different by hierarchical tackle, but just wondering.


All In One Event Calendar show event category and post category in loop

I'm using time.ly's All-in-One-Event Calendar and I'm creating a theme where I'd like to display featured items from both ai1ec events and posts in the same loop. Here's what I've tried so far: 1) selected "Include event categories in post category lists" in calendar settings - this seems to do nothing. 2) put the code from here in my functions.php: http://wp.miragearts.com/allinone-event-calendar-events-blog-home-categories- tags/ And created categories with same name/slug/id in both events and posts. Here's the loop I've tried, but it's only showing the posts (I'd like to add event times, etc, but just testing the title for now):                               <?php $feature = new WP_Query( array(                     'post_type' => array('post', 'page', 'ai1ec_event'),                     'category_name' => 'sub-feature',                     'posts_per_page' => 4                     ) );                           while ( $feature->have_posts() ) : $feature->the_post(); ?>
<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?>
                     <?php endwhile;                         wp_reset_postdata();                      ?>      I know from using this plugin before that I can call events using               <?php $event = Ai1ec_Events_Helper::get_event($post->ID); ?>      but this doesn't work with the `category_name` in the query arguments. It seems others have done this, but I can't figure it out. Any help appreciated!


URL for images folder on Multisite

I am developing a theme locally on a local multisite installation and trying to change the default gravitar with the following function:               function custom_gravitar ($avatar_defaults) {       $myavatar = get_bloginfo('template_directory') . '/img/gravitar.gif';       $avatar_defaults[$myavatar] = "Custom gravitar";       return $avatar_defaults;     }          add_filter( 'avatar_defaults', 'custom_gravitar' );      The path that is output is `http://i0.wp.com/localhost/my-site-folder/wp- content/themes/my-theme/img/gravitar.gif` but my local url is `http://localhost/my-site-folder/` I tried defining the `WP_CONTENT_URL`constant but it doesn't seem to have any impact. I have also tried `$myavatar = get_site_url() . '/img/gravitar.gif';` and various other functions but all of them seem to include the prefix `i0.wp.com/` I have used the suggested htaccess change to set up a MultiSite so I don't see where this is coming from. How can I get the correct path to my images folder?


Remove current-menu-item for a specific link

bbPress uses a custom post type called forums. When I click on forums, both forums and the Blog menu items are highlighted as a current-menu-item. Is there a way to remove the current-menu-item from Blog when the post-type = forum?


Show specific content on parent custom post type and all children

I have 5 main posts within a custom post type. Some of these posts will have children. I have content that should only be displayed on the parent post and all children of that post. What's the best way to achieve this?


A/B testing of posts with unique URLs for each variant AND editing in custom fields

I'm wondering if anyone could offer advice on how to think about creating an A/B testing plugin for posts that: **A) lets me assign unique URLs for each variant post * _1)** and_* **B) is customizable on the frontend (i.e. new-post.php).** There seems to be two ways I could go about doing this:   1. The first way: Create three separate posts, use the Shrimptest plugin to test, and exclude two of the posts from single.php (This was basically the answer that Otto gave when I asked about it on Stackexchange. The **problem** with this solution, though, is that I would have to go into the files to edit the code every time I want to test a different batch of posts. And I can't figure out a way for it to meet requirement B.)   2. The alternate way: Create custom fields in new-post.php that would give an editor the option to write in alternate headlines and upload different Facebook images and FB text. This is my preferred option right now since everything would be customizable from new-post.php. The **problem** is that I'm not sure how to meet requirement A (a unique URL for each variant I test). Is it even possible to create a custom field in new-post.php that assigns sub-URLs on top of the default URL?  Any tips or suggestions on any part of the problems I described would be great! Thanks in advance! * * * _Note:_ **1)** The reason I need requirement A (unique URLs for each variant) is because I ultimately want to measure shareability of my posts on social networks. _For example:_ If I launch a post with Headline A, FB picture B upon sharing, and FB text B upon sharing, I want the number of clicks on that A/B/B variation to be tracked. Thus I need to assign a unique URL to that variation.


Edit box scrolls back to the top after updating post

I've been quite annoyed by this. On post edit page, once I edited something in the middle of the page and hit Update, the whole page reloads and the edit box starts from the top again and I have to scroll-and-search my last edited point. Is there any workaround, solution to this?


How do I eliminate header image from subpages in WordPress Twenty Eleven Theme?

I looked as best I could through the database, and couldn't find anything quite right. The question was answered some years ago, but the code has changed mightily since then, and the solution no longer works...or maybe it's operator failure. The closest I could find was Toscho's answer here: How to remove header images from all pages except the home page? skeleton theme but that code doesn't quite line up, either. My site, such as it is, is www.woodlandcomm.com, and I'm using the latest rev of the 2011 Theme. If it helps I'm happy to post the code the header currently is using...I do have a child theme set up, but I don't know much about coding at all. I appreciate any hand holding...and thank you once again.


From a developer's point of view what are the differences between pages and posts?

Whenever I am looking for information on how to handle pages, I always end up finding deprecated functions that link to the correct new functions. But those new functions are only documented in terms of how they work for manipulating posts. I have seen this page: http://en.support.wordpress.com/post-vs-page/ but it is not very helpful when I am looking for answers like to questions like:   * How should I get the content of a page?   * What exactly is the title of the page; is it 'about' or 'About'? Or something else?   * If I am using get_post how does it know if I am looking for a page or a post? Do pages and posts always have non-conflicting ids?   * Can the WP_Post object also represent a page? Answers to these questions would be helpful. A link to something that clearly illuminates this topic or an explanation would be even more helpful.


How can I get the user that publishes a post?

I have multiple users. Some are writers, others are editors. Is there a way to get the editor (id) that publish the post? I am able to get the author id but the not the editor's id that publish the article.


Store Foreach in user profile

I use a foreach to get visits / visitors per month with Analytics API. I need to store the results in the user profile the way it is displayed with an echo. I tried this but I don't get the right value (I get only one value) :               $fromDate = date('Y-m-d', strtotime('-365 days'));     $toDate = date('Y-m-d');        $ga->requestReportData($profileId,array('yearmonth'),array('visitors', 'visits'), '-yearmonth', null, $fromDate, $toDate);      $i = 1;     foreach($ga->getResults() as $result)           {            $my_graph = "{Visiteurs: '".$result->getVisitors()."',Visites: '".$result->getVisits()."',number: '".(-$i++)."',},\n";           }      update_usermeta( $user_id, 'my_great_graph',  $my_graph );      I would like to save in a single field (my_great_graph) something like :                 {Visiteurs: '8',Visites: '9',number: '-1',},       {Visiteurs: '72',Visites: '83',number: '-2',},       {Visiteurs: '96',Visites: '104',number: '-3',},       {Visiteurs: '93',Visites: '119',number: '-4',},       {Visiteurs: '72',Visites: '81',number: '-5',},       {Visiteurs: '32',Visites: '38',number: '-6',},       {Visiteurs: '0',Visites: '0',number: '-7',},       {Visiteurs: '0',Visites: '0',number: '-8',},       {Visiteurs: '0',Visites: '0',number: '-9',},       {Visiteurs: '0',Visites: '0',number: '-10',},       {Visiteurs: '0',Visites: '0',number: '-11',},       {Visiteurs: '0',Visites: '0',number: '-12',},       {Visiteurs: '0',Visites: '0',number: '-13',},      **EDIT 1** With the answer from s_ha_dum, I have this stored in my database : a:13:{i:0;a:3:{s:9:"Visiteurs";i:10;s:7:"Visites";i:11;s:6:"number";i:0;}i:1;a:3:{s:9:"Visiteurs";i:72;s:7:"Visites";i:83;s:6:"number";i:-1;}i:2;a:3:{s:9:"Visiteurs";i:96;s:7:"Visites";i:104;s:6:"number";i:-2;}i:3;a:3:{s:9:"Visiteurs";i:93;s:7:"Visites";i:119;s:6:"number";i:-3;}i:4;a:3:{s:9:"Visiteurs";i:72;s:7:"Visites";i:81;s:6:"number";i:-4;}i:5;a:3:{s:9:"Visiteurs";i:32;s:7:"Visites";i:38;s:6:"number";i:-5;}i:6;a:3:{s:9:"Visiteurs";i:0;s:7:"Visites";i:0;s:6:"number";i:-6;}i:7;a:3:{s:9:"Visiteurs";i:0;s:7:"Visites";i:0;s:6:"number";i:-7;}i:8;a:3:{s:9:"Visiteurs";i:0;s:7:"Visites";i:0;s:6:"number";i:-8;}i:9;a:3:{s:9:"Visiteurs";i:0;s:7:"Visites";i:0;s:6:"number";i:-9;}i:10;a:3:{s:9:"Visiteurs";i:0;s:7:"Visites";i:0;s:6:"number";i:-10;}i:11;a:3:{s:9:"Visiteurs";i:0;s:7:"Visites";i:0;s:6:"number";i:-11;}i:12;a:3:{s:9:"Visiteurs";i:0;s:7:"Visites";i:0;s:6:"number";i:-12;}} So now, I have to find a way to display it like above for example : {Visiteurs: '0',Visites: '0',number: '-13',},


Giving wp_list_categories the class of the category

I am using wp_list_categories to list my categories in my menu. When the menu is generated each category is listed as a `<li>`-element with "cat- item[number]" as class. Is there a way to also or instead give the `<li>`s the category name as the class? Just like the posts have the category name as the class.


custom taxonomy relationship

I'm customizing wordpress by creating several taxonomies for a website. Actually, I created 'Services' custom post type with several taxonomy in it. Then, I'm going to create 'Case History' custom post type where I'd like to re-use 'Service' posts. I can show them on the backend (Case History add new item) by using WP_Query, but I had problems in saving them. So i've this doubt: is it possible to create a relationship between two different taxonomies? Is it possible to do that? Maybe I'm wrong somewhere ... **update** : maybe it would be better if I explain this question this way. Can i use a custom post type ('Service') as a taxonomy inside another custom post type ('Custom post type') ? **update2** : thx guys. I did solve my problem by using this plugin (cpt onomies)


Auto get_header and get_footer on every template?

Is there a way to automatically run `get_header()` at the beginning of template and `get_footer()` at the end of it? Currently my code is too repetitive with those calls. I've been looking for a way to do this, but I can't find it in Google.


How do I stop out of stock items from appearing on my WooCommerce site when using the Layered Nav widget

WooCommerce includes a handy Layered Nav widget. This allows you to filter the catalog items based on attributes that you've set, including for variations of items (like different sizes.) However, if you select a variation that's out of stock, it is still returned. I've been trying to alter the widget code, but it's proving extremely complicated for my little brain. Here's the widget code: https://github.com/woothemes/woocommerce/blob/master/widgets/widget- layered_nav.php If anyone could provide any pointers, it would be much appreciated.


website is still in localhost

I upload my website to the server and I changed the website url and home from localhost to mysite url. But it still is in localhost if I turned off wampserver it won't show the website. Just show me when wamp server is on. What should i do? any help will be appreciated


Why this BootStrap main menu appear twice in my theme?

I am going crazy with the following WordPress custom theme that use **BootStrap** CSS framework: http://onofri.org/WP_BootStrap/ As you can see I have a problem with the horizontal main menu in my header. To create the WP dynamic main menu having the classic BootStra style I use the **wp-bootstrap-navwalker.php** class inserting it in my theme following its documentation that you can read it: https://github.com/twittem/wp-bootstrap- navwalker So, according to the previous documentation, I have perform the following operations: 1) I have put the ** wp_bootstrap_navwalker.php** class inside the root of my custom theme 2) I have require it in my **functions.php** file, putting in it the following code:               // Register Custom Navigation Walker     require_once('wp_bootstrap_navwalker.php');      3) In my **header.php** file I have insert the following code:

                              <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">                                                                                </button>                              <a class="navbar-brand" href="<?php echo home_url(); ?>">                             <?php bloginfo('name'); ?>
                          <?php                         wp_nav_menu(array(                             'menu' => 'primary',                              'theme_location' => 'primary',                              'depth' => 2,                             'container' => 'div',                              /*'container_class' => 'navbar navbar-default',*/                             'menu_class' => 'nav navbar-nav',                              'fallback_cb' => 'wp_bootstrap_navwalker::fallback',                              'walker' => new wp_bootstrap_navwalker())                         );                     ?>
                        4) And finnally I have register the nav menu in my theme putting this code into my **functions.php** file:               register_nav_menus(array(         'primary' => __('Primary Menu', 'THEMENAME'),     ) );      Ok, as you can see I can see the main menu but I see it twice: one is the correct visualization (the one with red background) but appear a second main menu upper and I can't understand why (I never declared it twice) Do you have some idea about this issue? How can I try to solve? Tnx Andrea


Is slug "type" reserved and can't be used in taxonomy rewrite?

I desperately need your help guys. I am trying to register custom post type and taxonomy the following way:               add_action( 'init', 'product_catalog' );     add_action( 'init', 'product_type', 0 );          function product_catalog() {         $labels = array(             'name'               => _x( 'Catalog', 'post type general name' ),                    'menu_name'          => 'Catalog'         );         $args = array(             'labels'        => $labels,             'description'   => 'Catalog',             'public'        => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,                    'capability_type' => 'post',             'hierarchical' => false,                    'menu_position' => 5,             'supports'      => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),             'has_archive'   => true,             "rewrite" => array(                        'with_front' => false,                                        'slug' => 'catalog'                        )         );         register_post_type( 'product_catalog', $args );          }               //taxonomy that wont work with first parent, all childs work just fine.          function product_type(){              register_taxonomy("product_type", array("product_catalog"), array(         "hierarchical" => true,         "label" => "Types",         "singular_label" => "Type",         "show_ui" => true,                'show_admin_column' => true,         'query_var' => true,         "rewrite" => array(                    'slug' => 'type',                        'with_front' => false,             "hierarchical" => true             )         ));                  }      It seems to show in the panel and I can add hierarchical taxonomies under the TYPE but the problem comes if I try to go to url like: **sitename.com/type/parent** it always returns 404 not found. At the same time I can go to childs of TYPE and it loads just fine like: **sitename.com/type/parent/child** If I change the **'slug' => 'type** ' to anything else like: **'types'** then it works 100%. I don't get it, why this is happening, is it reserved for something? I would appreciate your help. Thank you.


Inject code in the header of my template

I'd like to inject the name of the author of a post into the header of the page via the author tag. something like               <head>         <title>FAQs</title>         <meta name="author" content="My name">     </head>      However, I won't be able to find the author name before entering in the loop? So can I still make this change at that time or is too late? If so, what's the best way to inject code in the header? I gave a try with the do_action as explained in this article without success. Thanks Andrea


Theme Option's Save Button is not working

I'm currently working on making an options panel for a theme (theme- options.php) on my localhost. Every thing was going well until I tried testing the Save button. After clicking it, I got the message that the options were saved but nothing actually saved. Not sure if this matters, but theme- options.php is located in a folder named "options" in the theme's home directory. Here is the current function I'm using for saving:               //add options page     function fround_add_admin(){         global $themename, $shortname, $options;              if ( $_GET['page'] == basename(__FILE__) ){                  if ( 'save' == $_REQUEST['action'] ) {                 //protect against request forgery                 check_admin_referer('theme-save');                      //save the options                 foreach ($options as $value) {                     if( isset( $_REQUEST[ $value['id'] ] ) ) {                         update_option( $value['id'], $_REQUEST[ $value['id'] ] );                     } else {                         delete_option( $value['id'] );                     }                 }                      header("Location: themes.php?page=theme-options.php&saved=true");                 die;                  } else if ( 'reset' == $_REQUEST['action'] ) {                 //protect against request forgery                 check_admin_referer('theme-reset');                 //delete the options                 foreach ($option as $value) {                     delete_option( $value['id'] );                 }                      header("Location: themes.php?page=theme-options.php&reset=true");                 die;             }         }         add_theme_page($themename." Options", "$themename Options", 'edit_themes', basename(__FILE__), 'fround_admin');     }     add_action('admin_menu' , 'fround_add_admin');      I'm following a tutorial to make this panel (with a couple modifications to my needs) and everything looks the same as in the tutorial. Looking through it with the php knowledge I have, I see nothing wrong either. Here's the entire theme-options.php:               <?php          //theme vars     $themename = "f Round";     $shortname = "fround";     $options = array();          function theme_options(){         global $themename, $shortname, $options;              $options = array (                  array("name" => "General Settings",                 "type" => "section"),             array("type" => "open"),                  array("name" => "Type of Logo",                 "desc" => "Select your logo type ( Image or Text )",                 "id" => $shortname."_type_of_logo",                 "type" => "select",                 "options" => array("text", "logo"),                 "std" => "text"),                  array("name" => "Logo Upload",                 "desc" => "Upload images using the native media uploader, or define the URL directly",                 "id" => $shortname."_logo_upload",                 "type" => "imageupload",                 "std" => ""),                  array("name" => "Logo Text",                 "desc" => "Enter text for logo",                 "id" => $shortname."_logo_text",                 "type" => "text",                 "std" => ""),                  array("name" => "Logo Slogan",                 "desc" => "Enter text for logo slogan",                 "id" => $shortname."_logo_slogan",                 "type" => "text",                 "std" => ""),                  array("name" => "Custom Favicon",                 "desc" => "Upload a 16px x 16px Png/Gif image that will represent your website's favicon",                 "id" => $shortname."_favicon_upload",                 "type" => "imageupload",                 "std" => ""),                  array("type" => "close"),             array("name" => "Styling Options",                 "type" => "section"),             array("type" => "open"),                  array("name" => "Background Color",                 "desc" => "Pick a color for the background",                 "id" => $shortname."_background_color",                 "type" => "color",                 "std" => "#ffffff"),                  array("name" => "Body Color",                 "desc" => "Pick a color for the body",                 "id" => $shortname."_body_color",                 "type" => "color",                 "std" => "#ffffff"),                  array("type" => "close"),             array("name" => "Footer Options",                 "type" => "section"),             array("type" => "open"),                  array("name" => "Copyright Text",                 "desc" => "Enter text for copyright in footer (if empty it will be removed)",                 "id" => $shortname."_footer_text",                 "type" => "text",                 "std" => "Copyright TestSite.com"),                  array("type" => "close")              );     }     add_action('init', 'theme_options');          //add options page     function fround_add_admin(){         global $themename, $shortname, $options;              if ( $_GET['page'] == basename(__FILE__) ){                  if ( 'save' == $_REQUEST['action'] ) {                 //protect against request forgery                 check_admin_referer('theme-save');                      //save the options                 foreach ($options as $value) {                     if( isset( $_REQUEST[ $value['id'] ] ) ) {                         update_option( $value['id'], $_REQUEST[ $value['id'] ] );                     } else {                         delete_option( $value['id'] );                     }                 }                      header("Location: themes.php?page=theme-options.php&saved=true");                 die;                  } else if ( 'reset' == $_REQUEST['action'] ) {                 //protect against request forgery                 check_admin_referer('theme-reset');                 //delete the options                 foreach ($option as $value) {                     delete_option( $value['id'] );                 }                      header("Location: themes.php?page=theme-options.php&reset=true");                 die;             }         }         add_theme_page($themename." Options", "$themename Options", 'edit_themes', basename(__FILE__), 'fround_admin');     }     add_action('admin_menu' , 'fround_add_admin');          //main function     function fround_admin() {         global $themename, $shortname, $options;              //saved or reset messages         if ( $_REQUEST['saved'] ) echo '

'.$themename.' settings saved.

';         if ( $_REQUEST['reset'] ) echo '

'.$themename.' settings reset.

';              //form         ?>
<?php echo $themename; ?>

                 <?php                 foreach ($options as $value){                     switch ( $value['type'] ){                         case 'section':                             echo '
'.$value['name'].'
';                             break;                     }                 }                 ?>
                                    <form method="post">             <?php wp_nonce_field('theme-save'); ?>                               <?php                 foreach ($options as $value){                     switch ( $value['type'] ){                         case 'section':                             ?>                             <section name="<?php echo $value['name'];?>">
<?php echo $value['name'];?>
                             <?php                             break;                              case 'open':                             break;                              case 'close':                             ?>
                             <?php                             break;                              case 'select':                             ?>                             <div id="<?php echo $value['id']; ?>" class="option <?php echo $value['type']; ?>">                                 <select>                                     <?php                                     foreach ($value['options'] as $option){                                         echo '<option value="'.$option.'">'.$option.'</option>';                                     }                                     ?>                                 </select>
<?php echo $value['desc']; ?>

                             <?php                             break;                              case 'text':                             ?>                             <div id="<?php echo $value['id']; ?>" class="option <?php echo $value['type']; ?>">                                 <input type="text" value="<?php echo $value['std']; ?>">
<?php echo $value['desc']; ?>

                             <?php                             break;                              case 'imageupload':                             ?>                             <div id="<?php echo $value['id']; ?>" class="option <?php echo $value['type']; ?>">
<?php echo $value['desc']; ?>

                             <?php                             break;                              case 'color':                             ?>                             <div id="<?php echo $value['id']; ?>" class="option <?php echo $value['type']; ?>">
<?php echo $value['desc']; ?>

                             <?php                             break;                     }                 }             ?>
                 <input name="save" type="submit" value="Save changes" class="button-primary" />                 <input type="hidden" name="action" value="save" />
         </form>              <form method="post">             <?php wp_nonce_field('theme-reset'); ?>
                 <input name="reset" type="submit" value="Reset changes" />                 <input type="hidden" name="action" value="reset" />
         </form>         <?php     }     ?>      What exactly am I doing wrong for the save button not to work? Any help is greatly appreciated. EDIT: I changed the 'select' and 'text' cases to the following (which still isn't working for me):               case 'select':     ?>     <div id="<?php echo $value['id']; ?>" class="option <?php echo $value['type']; ?>">         <select>             <?php             foreach ($value['options'] as $key=>$option){                 if ($key == get_option($value['id'], $value['std']) ) {                     $selected = 'selected="selected"';                 } else{                     $selected = "";                 }             ?>             <option value="<?php echo $key; ?>" <?php echo $selected ?>><?php echo $option; ?></option>             <?php } ?>         </select>
<?php echo $value['desc']; ?>

     <?php     break;          case 'text':     ?>     <div id="<?php echo $value['id']; ?>" class="option <?php echo $value['type']; ?>">         <input type="text" value="<?php echo stripslashes( get_option($value['id'], $value['std']) ); ?>">
<?php echo $value['desc']; ?>

     <?php     break;      I'm going to continue working on this but some help would still be much appreciated.


How to get featured image thumbnail to open larger version in attachment page?

I have a thumbnail of the featured image, which is linked to a larger version of the file. At the moment the file just opens in a standard browser window, but I would like it to open in an attachment page, but I can't figure out how to do it! Here is what I have at the moment:               <?php if ( has_post_thumbnail()) : ?>

     <?php  $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large');     echo '';     the_post_thumbnail('thumbnail'); ?>
           <?php endif; ?>      I'm guessing I need to use a different function to pass a value to $large_image_url but can't work out which one.


Custom post not working on template page

I am using promotion-slider plugin. I am writing `<?php echo do_shortcode('[promoslider]') ?>` but it has been very inconsistent. As sometime posts are coming some time it does not. I am not able to rectify why this happening.


Removed and Reinstalled Wordpress, Redirect Broken now

I just removed and reinstalled wordpress, I think something messed up.. Now when I enter URL, such as "test123.com", nothing load.. The ".htaccess" file on root folder is empty. and content of "index.php" here:               <?php     /**      * Front to the WordPress application. This file doesn't do anything, but loads      * wp-blog-header.php which does and tells WordPress to load the theme.      *      * @package WordPress      */          /**      * Tells WordPress to load the WordPress theme and output it.      *      * @var bool      */     define('WP_USE_THEMES', true);          /** Loads the WordPress Environment and Template */     require('./wordpress/wp-blog-header.php');     ?>      Now wordpress is installed on "/wdps" folder. Also, here are their permission setting, is there something wrong?? /.htaccess: https://www.evernote.com/shard/s74/sh/9d3b8f33-b26d-4f19-b35c-958b1e9600ff/41b1d7015fee992c36b1cb66651e40f5 /index.php: https://www.evernote.com/shard/s74/sh/11010e56-f29c-4507-b131-ae06cf22e0bf/e859f5ad1f42919ddde25e5c27812ed5


Show related posts based on inputs given

I'm looking to create a custom feature on one of my site wherein users can find related articles based on the inputs provided. For example: I'm a male or female (drop down) and I like Football (drop down categories) after getting the inputs, I want to show related post categorized under Football.


I need a custom Login Registeration in WordPress can somebody guide me?

I want to customize the registeration and login in my WordPress site add a few fields and remove some. Can somebody guide me if i should write my own plugin if that is the case what steps i should follow. IF i can use some already written plugin please direct me to that?


force jQuery to load in the head

I've written a plugin which uses `wp_enqueue_script("jquery");` to load jQuery. I need to load jQuery in the head and not at the bottom of the body. However, I think that this command is overwritten by some theme which loads jQuery at the bottom of the body so preventing my plugin to work properly. How can I force WP to load jQuery in the head?


How to add a button to check the emails of my domain?

I am looking for a button in the main menu that I can click it and then can send me to ask my email and password and after I put it I can see my emails from my domain. Why? Because I have workers and I give some emails from my domain and they need to check it, and I don't want to use outlook or mail softwares. I will like to use online webmail. And will be cool that I can add a botton like "Check Mail" all this in my website so they can get inside the company website and then click check mail and they will ask for the mail login from my domain emails. How can I do this?


excerpt display same text

I start learning Wordpress from scratch then i decided to put the 5 latest post in sidebar, and the code is alright and when i decided to add description using `excerpt`, excerpt desplay same text can someone guide me what should i do, what should i improve,      any idea is appreciated thank's in advance!      ![thumbnail with excerpt](http://i.stack.imgur.com/CX5Rh.jpg) here is my current code:
     <?php     $IDOutsideLoop = $post->ID;     global $post;          $myposts = get_posts('showposts=5');     foreach($myposts as $post) :     ?>

           <?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?>
         <a href="<?php the_permalink(); ?>">           <?php the_title(); ?>                             <?php the_excerpt(); ?>
         <?php endforeach; ?>


How do I get the Wordpress post to display the content instead of an image?

I am working on migrating a Wordpress site to a test server. I imported all of the content & settings, and verified that every setting is the same as the old site. However, I'm having a problem that I can't find an answer to. The theme the site is using is "Simplicity", which has a "mini-features" section. I have the section set up on the home page, and in the back end it tells the page to link the mini feature to the URL of a blog post. Unfortunately, instead of showing the content of the blog post, it's only showing an image assigned to the mini-feature. I have checked Google, the Simplicity documentation, double checked every possible setting on the site, and I cannot find a solution. Can somebody PLEASE help me??? This is ONE page that the error is on... OLD (working) site: http://www.archkit.com/key/the-basics/ NEW (not-working) site: http://scottera.com/key/the-basics/


How to make custom bulk actions work on the media/upload page?

I'm adapting a script I found online to add custom bulk actions to the screen with the list of posts. It has this line:               add_action('load-edit.php', 'custom_bulk_action');      I'm trying to adapt it for the media library. I see that in place of `edit.php` I should use `upload.php`, which leads me to believe I need to find the media analog for `load-edit.php`. Sounds easy, but I can't even find `load-edit.php` in my WP install to see if by chance it might be what I'm looking for itself. I have found a few references online to `load-*.php` (e.g., Custom bulk_action), but nothing that tells me what values `*` can take. (I've tried `load-upload.php` but it's not working--though it could always be something else in my code that's gumming up the works.) So my questions are two:   1. What is the media analog of `load-edit.php`?   2. Where is `load-edit.php` (and the other `load-*.php` files), or what code handles these file requests? The first is my real question, but the second has gotten under my skin. Can any of you experts out there give me some guidance? I would very much appreciate it. # EDIT By "not working" I meant not that it crashes, but that it wasn't doing as it was supposed (changing a media attribute). The code I'm adapting can be downloaded at the bottom of the post "Add a WordPress Custom Bulk Action" by Justin Stern of Fox Run Software. Going back to verify each step of the code, I got the adapted version to work, but only if I comment out the conditional and the security check (both asterisked below). What are the media analogs I should use to replace these?                add_action('load-upload.php', array(&$this, 'custom_bulk_action'));               function custom_bulk_action() {          //  ***if($post_type == 'attachment') {  REPLACE WITH:         if ( !isset( $_REQUEST['detached'] ) ) {              // get the action         $wp_list_table = _get_list_table('WP_Media_List_Table');           $action = $wp_list_table->current_action();              echo "\naction = $action\n</pre>";              $allowed_actions = array("export");         if(!in_array($action, $allowed_actions)) return;              // security check     //  ***check_admin_referer('bulk-posts'); REPLACE WITH:         check_admin_referer('bulk-media');               // make sure ids are submitted.  depending on the resource type, this may be 'media' or 'ids'         if(isset($_REQUEST['media'])) {           $post_ids = array_map('intval', $_REQUEST['media']);         }              if(empty($post_ids)) return;              // this is based on wp-admin/edit.php         $sendback = remove_query_arg( array('exported', 'untrashed', 'deleted', 'ids'), wp_get_referer() );         if ( ! $sendback )           $sendback = admin_url( "upload.php?post_type=$post_type" );              $pagenum = $wp_list_table->get_pagenum();         $sendback = add_query_arg( 'paged', $pagenum, $sendback );              switch($action) {           case 'export':                  // if we set up user permissions/capabilities, the code might look like:             //if ( !current_user_can($post_type_object->cap->export_post, $post_id) )             //  wp_die( __('You are not allowed to export this post.') );                  $exported = 0;             foreach( $post_ids as $post_id ) {                    if ( !$this->perform_export($post_id) )                 wp_die( __('Error exporting post.') );               $exported++;             }                  $sendback = add_query_arg( array('exported' => $exported, 'ids' => join(',', $post_ids) ), $sendback );           break;                default: return;         }              $sendback = remove_query_arg( array('action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status',  'post', 'bulk_edit', 'post_view'), $sendback );              wp_redirect($sendback);         exit();       }     }      I appreciate your help. # EDIT 2 I modified the code above to reflect information from the accepted answer. Many thanks to Ralf912!


WPMU on MySQL limited to 1GB of space?

My MySQL databases are limited to 1024MB per 1 database but WPMU websites need to exceed that... Is there any way to make WPMU go and use `database_2` when `database_1` is already close to 1024MB? I can have:   * `database_1` 1024MB   * `database_2` 1024MB   * `database_3` 1024MB   * `database_4` 1024MB   * etc. I can't have:   * `database_1` 8192MB or more


One picture belonging different galleries?

How can one picture belongs different galleries? For example, there are two galleries. I want to avoid loading the image twice (in two galleries) but it shown (included) in the first and second gallery.


Showing Different Code on Pages With Different Layouts

I have pages and posts on a WordPress site. The pages have various layouts. Parent pages are following a 2-column (maincontent + right sidebar) layout while child pages have a one-column layout (no sidebar). I want to display a JavaScript code on one-column layout, and a different JavaScript code on 2-column layout. Must also add that one-colum has a custom field "one-col" and 2-column is the default layout. Not sure if it's possible to add codes based on custom fields. Theme: WooThemes, Canvas. Really appreciate your help.


Echo do shortcode with custom field not working

I'm using WP YouTube Lyte to show YouTube videos. I'm combining it with Advanced Custom Fields so that the user can just add the YouTube id to show the video. I'm using the WP YouTube Lyte short code but it is writing the code the wrong way round. Below is the code:               <?php if( get_field('video_file') ):      $video = the_field("video_file");     ?>     <?php echo do_shortcode('[lyte id="'. $video . '" /]'); ?>     <?php endif; ?>      Here is the result:               vTyDi22_SFohttpv://www.youtube.com/watch?v=      When I just add a YouTube id into the code it displays the video correctly.


Posts Loops To Display Specific Posts Inside Page Template?

I want to create a template for selecting 5 specific posts to be displayed on a WordPress page. Essentially I must be able to query 5 exact posts to be displayed on a Wordpress Page using a WP page template and a custom filed to choose the exact 5 post ids. EDIT: I have this code thanks to this site. But now I need to be able to add the page id array via custom field. Can this be done? EDIT 2: Actually the code is not displaying the posts in the array, but rather the latest posts on the homepage. Hmmm.               <?php     $post_id = array(483,454,376);      $posts = get_posts( $post_id);      foreach( $posts as $post ) :       setup_postdata($post);  ?>           // you can call use post data inside here like
<a href="<?php the_permalink() ?>"><?php the_title(); ?>
                                   <a class="thumb" href="<?php the_permalink(); ?>"><?php dp_attachment_image($post->ID, 'thumbnail', 'alt="' . $post->post_title . '" class="hthumb"'); ?><?php the_excerpt(45); ?><a href="<?php the_permalink(); ?>" class="more">Read More..

     <?php endforeach; ?>


WP_Cron doesn't do the job: Multisite stats

I already found out how to get the amount of networkwide posts in WPMS. Until now the function was called by a user who opens the website. So it was rebuild every 24 hours. I don't want to let a single user wait for half a minute until the process is done so I started to work with wp_cron. But there seems to be a problem because I can't see the result in the shortcode. It would be great if someone could take a look to the following lines:               register_activation_hook(__FILE__, 'wpms_stats_activation');     add_action('wpms_stats_daily_event', 'posts_count_func');     register_deactivation_hook(__FILE__, 'wpms_stats_deactivation');           // Start the cron on activation     function wpms_stats_activation() {     wp_schedule_event(time(), 'daily', 'wpms_stats_daily_event');     }          // Delete the cache and deactivate the cron     function my_deactivation() {         wp_clear_scheduled_hook('wpms_stats_daily_event');         delete_site_transient( 'total_posts_cache' );     }          // Count the posts of the whole network     function posts_count_func( $args ){              global $wpdb;         $blogs = $wpdb->get_results( $wpdb->prepare(                 "SELECT * FROM {$wpdb->blogs} WHERE  spam = '0'                  AND deleted = '0' AND archived = '0'                  ORDER BY registered DESC, 2", ARRAY_A ) );              $original_blog_id = get_current_blog_id();               $args = array(             'numberposts'     => -1,             'post_type'       => 'post',             'post_status'     => 'publish' );         $total_network = $draft_network = 0;         $total_sites = 0;              foreach ($blogs as $blog)         {             wp_cache_flush();             switch_to_blog( $blog->blog_id );             $args['post_status'] = 'publish';             if (count(get_posts($args))<2) { continue; }             $total_posts = count( get_posts( $args ) );             $total_network += $total_posts;             $total_sites += 1;                  $args['post_status'] = 'draft';                  }                  set_site_site_transient ( 'total_posts_cache', $total_network );                switch_to_blog( $original_blog_id );     }          //Make a shortcode which shows the amount of posts     function posts_shortcode_count_func( $atts ){         $post_count = get_site_transient( 'total_posts_cache' );         return $post_count;     }     add_shortcode( 'posts', 'posts_shortcode_count_func' );      Thanks a lot!


Filter the feed page post limit

WordPress has a setting for the number of items shown in syndication feeds. I want to bypass that setting in a plugin and return a different number of items. Here's what I am doing, but it's not working. Any idea why?               add_filter( 'init', 'rss_addfeed_add_feed' );          function rss_addfeed_add_feed() {         $general_settings = get_option( 'rss_settings_general', 'rss' );         if ( !empty( $general_settings ) && isset( $general_settings['custom_feed_url'] ) ) {             $url = $general_settings['custom_feed_url'];         }         else $url = 'rss';         add_feed( $url, 'rss_addfeed_do_feed' );         flush_rewrite_rules();     }                    function rss_addfeed_do_feed( $in ) {              // Prepare the post query         $rss_custom_feed_query = apply_filters(                             'rss_custom_feed_query',                 array(                 'post_type'   => 'rss_feed_item',                  'post_status' => 'publish',                 'posts_per_page' => 4,                 'cache_results' => false,   // disable caching             )               );              // Submit the query to get latest feed items         query_posts( $rss_custom_feed_query );              // Send content header and start ATOM output         header('Content-Type: application/atom+xml');         // Disabling caching         header('Cache-Control: no-cache, no-store, must-revalidate'); // HTTP 1.1.         header('Pragma: no-cache'); // HTTP 1.0.         header('Expires: 0'); // Proxies.         echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>';         ?>         <feed xmlns="http://www.w3.org/2005/Atom">             <title type="text">Latest imported feed items on <?php bloginfo_rss('name'); ?></title>             <?php             // Start the Loop             while ( have_posts() ) : the_post();             ?>             <entry>                 <title><![CDATA[<?php the_title_rss(); ?>]]></title>                 <link href="<?php the_permalink_rss(); ?>" />                 <published><?php echo get_post_time( 'Y-m-d\TH:i:s\Z' ); ?></published>                 <content type="html"><![CDATA[<?php the_content(); ?>]]></content>             </entry>             <?php             // End of the Loop             endwhile;             ?>         </feed>         <?php     }                   add_filter( 'post_limits', 'rss_custom_feed_limits' );          function rss_custom_feed_limits( $limit ) {         if ( is_feed( ) ) {              return 'LIMIT 0, 3';            }         return $limit;     }


multi-language WordPress site

I am making multi-language site powered by WordPress. WPML is not free and it makes too many extra sql queries to database so it is not good solution for my site. qTranslate saves all languages in one database row and it is very complicated to move to another multi-language plugin later.               <?php _e( '<!--:en-->english text<!--:--><!--:de-->german text<!--:-->' ); ?>      xLanguage hasn't been updated in over 2 years. Is there any other **plugin to manage multi-language site**? I have an idea to install WordPress as multisite **and each language will have its own site**. Is it good practice? ![enter image description here](http://i.stack.imgur.com/NG7e7.png)


How to convert WordPress comments to bbPress replies

I have a old blog that I would like to upgrade to a blog/website with bbPress forums and would like to convert the post to topics and the comments to replies. I already created my topics and now I only need to convert the comments into replies.   Do you know of a script that does that? Have you ever had to do that and how did you do it? Thanks in advance!


Change tooltip in tag cloud

How to change tag tooltip to tag Description? I tried and my code is mentioned below.               function title_text( $description ) {         return sprintf( _n('%s topic', '%s', $description), $description );     }          wp_tag_cloud( array( 'topic_count_text_callback' => 'title_text') );      This is not working. Can any one please check this code and find me a correct solution?


Add custom user capabilities before or after the custom user role has been added?

Should custom user capabilities be added before the custom user role has been added, or the other way around?   * `add_role()` asks for and array of `$capabilities` in the third parameter of the function.   * `add_cap()` asks for a `$role` to apply the capability to in the first parameter of the function. Both `add_role()` and `add_cap()` need to be fired on plugin activation or theme activation. I was thinking, create the custom user capabilities using `add_cap()` and store the list of capabilities in a class property array. Then, create each custom user role using `add_role()`, and add the newly created capabilities from the class property array into the `$capabilities` parameter of each `add_role()` function. OR I would add each custom user role using `add_role()` and set a class property array of each of the capabilities for the role to add. Then, for each of the capabilities for each custom user role, I would add the capability using `add_cap()`. The order of which to perform both `add_role()` and `add_cap()` in harmony puzzles me. Any insight on this particular situation is appreciated. Or should I just not even use `add_cap()`? Can I just setup an array of capabilities for each user role, and just pass them into the `$capabilities` parameter of the `add_role()` function?


Add a wordpress blog to my website having users

I have a php/mysql based site with users segregated into different groups... i want to add blogging system to it so that each group has its own blog which can be authored by users who are designated to administer that group and can be read by each user of that group... how can this be done?


How to set a default format for a custom post type?

I created a custom post type for my blog, to allow easier separation of content. This new post type supports different post formats, but most of them will be galleries.               register_post_type('atelier',         array(         'label' => 'L\'Atelier',         'public' => true,         'supports' => array('title', 'editor', 'post-formats')         )     );      I saw that it is possible in Settings -> Writing to set the default post format for posts, is it possible to do the same for my newly created post type?


To be able to login as different user

I have 2 kinds of users... Both uses custom form for registeration.... One is parent user and another is child users. Parent user can register and then login and create child users. I have also given interface in theme where parents can manage child users data created by them. Basically site is based on article for childs helping them in education and question answer.... What i want to do is when parent is login , i have list of his child users, want to give link like Login as child, on click of which parent gets logout and get logged in as child using child credential... Any tips/suggestion how to achive logout and login as different user using script...


Echo option page form field value

Here is my option page code containing a no of fields like logo, slider after filling all the information in option page form. I need two things   1. After submitting all the form details save information must retain there.   2. Using `get_option()` extract each input tag value and show that value in the front hand like slider image, slider heading, slider description  OPTION PAGE CODE:                   <?php         class MySettingsPage         {         /**              * Holds the values to be used in the fields callbacks              */             private $options;                   public function __construct()             {                 add_action( 'admin_menu', array( $this, 'bguru_register_options_page' ) );                 add_action( 'admin_init', array( $this, 'bguru_register_settings' ) );                       }                       public function bguru_register_options_page()             {                 // This page will be under "Settings"              add_theme_page('Business Guru Options',                              'Theme Customizer',                               'edit_theme_options',                               'bguru-options',                               array( $this, 'bguru_options_page')                 );             }              public function bguru_options_page()             {                 // Set class property                  $this->options = get_option( 'bguru_logo' );                  $this->options = get_option( 'bguru_vimeo' );                  $this->options = get_option( 'bguru_slide_one_image' );                  $this->options = get_option( 'bguru_slide_one_heading' );                  $this->options = get_option( 'bguru_slide_one_text' );                  $this->options = get_option( 'bguru_slogan_heading' );                  $this->options = get_option( 'bguru_slogan_description' );                           ?>
                     <?php screen_icon(); ?>
Business Guru Options
                           <form method="post" action="options.php">
                     <?php                         // This prints out all hidden setting fields                         settings_fields( 'defaultbg' );                            do_settings_sections( 'defaultbg' );                         submit_button();                      ?>
                     </form>
                 <?php             }               /**              * Register and add settings              */             public function bguru_register_settings()             {                 register_setting('defaultbg','bguru_logo',  array( $this, 'sanitize' ) );         register_setting('defaultbg', 'bguru_vimeo',  array( $this, 'sanitize' ));         register_setting('defaultbg', 'bguru_slide_one_image',  array( $this, 'sanitize' ));         register_setting('defaultbg', 'bguru_slide_one_heading',  array( $this, 'sanitize' ));         register_setting('defaultbg', 'bguru_slide_one_text',  array( $this, 'sanitize' ));         register_setting('defaultbg', 'bguru_slogan_heading',  array( $this, 'sanitize' ));         register_setting('defaultbg', 'bguru_slogan_description',  array( $this, 'sanitize' ));                add_settings_section(                     'setting_section_id', // ID                     '
General
',                      array( $this, 'print_section_info' ), // Callback                     'defaultbg' // Page                      );                        add_settings_field(                           'bguru_logo', // ID                     'Logo', // Title                      array($this,'logo_callback' ), // Callback                      'defaultbg', // Page                    'setting_section_id'// Section                             );                                 add_settings_field(                     'bguru_vimeo', // ID                     'Vimeo', // Vimeo                      array( $this, 'socialv_callback' ), // Callback                      'defaultbg', // Page                     'setting_section_id' // Section                            );                      add_settings_field(                     'bguru_slide_one_image', // ID                     'Slide 1 Image', // Slide 1 Image                      array( $this, 'slider1img_callback' ), // Callback                      'defaultbg', // Page                     'setting_section_id' // Section                            );                      add_settings_field(                     'bguru_slide_one_heading', // ID                     'Slide 1 Heading', // Slide 1 Heading                      array( $this, 'slider1head_callback' ), // Callback                      'defaultbg', // Page                     'setting_section_id' // Section                            );                      add_settings_field(                     'bguru_slide_one_text', // ID                     'Slide 1 Description', // Slide 1 Description                     array( $this, 'slider1text_callback' ), // Callback                      'defaultbg', // Page                     'setting_section_id' // Section                            );                      add_settings_field(                     'bguru_slogan_heading', // ID                     'Slogan Heading', // Slogan Heading                     array( $this, 'slogan_head_callback' ), // Callback                      'defaultbg', // Page                     'setting_section_id' // Section                            );                      add_settings_field(                     'bguru_slogan_description', // ID                     'Slogan Container', // Slogan Container                     array( $this, 'slogan_descr_callback' ), // Callback                      'defaultbg', // Page                     'setting_section_id' // Section                            );                  }                    public function sanitize( $input )             {                 $new_input = array();                               if( isset( $input['bguru_logo'] ) )                     $new_input['bguru_logo'] = sanitize_text_field( $input['bguru_logo'] );                           if( isset( $input['bguru_vimeo'] ) )                     $new_input['bguru_vimeo'] = sanitize_text_field( $input['bguru_vimeo'] );                           if( isset( $input['bguru_slide_one_image'] ) )                     $new_input['bguru_slide_one_image'] = sanitize_text_field( $input['bguru_slide_one_image'] );                           if( isset( $input['bguru_slide_one_heading'] ) )                     $new_input['bguru_slide_one_heading'] = sanitize_text_field( $input['bguru_slide_one_heading'] );                           if( isset( $input['bguru_slide_one_text'] ) )                     $new_input['bguru_slide_one_text'] = sanitize_text_field( $input['bguru_slide_one_text'] );                          if( isset( $input['bguru_slogan_heading'] ) )                     $new_input['bguru_slogan_heading'] = sanitize_text_field( $input['bguru_slogan_heading'] );                           if( isset( $input['bguru_slogan_description'] ) )                     $new_input['bguru_slogan_description'] = sanitize_text_field( $input['bguru_slogan_description'] );                           return $new_input;             }         public function print_section_info()             {                 print 'Enter your settings below:';             }              public function logo_callback()             {                      printf(                     '<input type="text" id="bguru_logo"  size="50" name="bguru_logo" value="%s" />',                     isset( $this->options['bguru_logo'] ) ? esc_attr( $this->options['bguru_logo']) : ''                 );             }              public function socialv_callback()             {                 printf(                     '<input type="text" id="bguru_vimeo"  size="50" name="bguru_vimeo" value="%s" />',                     isset( $this->options['bguru_vimeo'] ) ? esc_attr( $this->options['bguru_vimeo']) : ''                 );             }                       public function slider1img_callback()             {                 printf(                     '<input type="text" id="bguru_slide_one_image"  size="50" name="bguru_slide_one_image" value="%s" />',                     isset( $this->options['bguru_slide_one_image'] ) ? esc_attr( $this->options['bguru_slide_one_image']) : ''                 );             }             public function  slider1head_callback()             {                 printf(                     '<input type="text" id="bguru_slide_one_heading"  size="50" name="bguru_slide_one_heading" value="%s" />',                     isset( $this->options['bguru_slide_one_heading'] ) ? esc_attr( $this->options['bguru_slide_one_heading']) : ''                 );             }             public function slider1text_callback()             {                 printf(                     '<input type="text" id="bguru_slide_one_text"  size="50" name="bguru_slide_one_text" value="%s" />',                     isset( $this->options['bguru_slide_one_text'] ) ? esc_attr( $this->options['bguru_slide_one_text']) : ''                 );             }                       public function slogan_head_callback()             {                 printf(                     '<input type="text" id="bguru_slogan_heading"  size="50" name="bguru_slogan_heading" value="%s" />',                     isset( $this->options['bguru_slogan_heading'] ) ? esc_attr( $this->options['bguru_slogan_heading']) : ''                 );             }                  public function slogan_descr_callback()             {                 printf(                     '<input type="text" id="bguru_slogan_description"  size="50" name="bguru_slogan_description" value="%s" />',                     isset( $this->options['bguru_slogan_description'] ) ? esc_attr( $this->options['bguru_slogan_description']) : ''                 );             }              }         if( is_admin() )             $my_settings_page = new MySettingsPage();          here its my header.php code where i display all the information of  option form          <?php                    $bguru_logo_image = get_option('bguru_logo');              if (!empty($bguru_logo_image)) {                  echo '

';              } else {                  echo '

'. get_bloginfo('name') . '

';              }?>                         <?php              $bguru_social_vimeo = get_option('bguru_vimeo');     if (!empty($bguru_social_vimeo)) {                  echo '
Vimeo
';              }?>      Same as for slider image, slider heading, slider description. Please suggest some solutions


WordPress As A Shared Items Collection

I'm planning on using WordPress to create an arcive of my starred/shared/favourited items on a few services, such as:   * Twitter Favourites    * YouTube Favourites   * Google Reader Starred Items   * Stack Overflow Starred Questions   * etc. As the data for each type is different, eg video/article/short text what would be the best way of doing this? Would a custom post type or format for each type be the best way? Or does anyone have any suggestions for any themes or plugins which work in a similar way to save me doing all of this from scratch?


No error in debug mode, wordpress template can not be loaded

I am trying to solve this issue for days.. I consumed all options and therefore need some fresh ideas.. I have a page template for posting/editing 2 different custom post types from front end of wordpress. For the sake of simplicity, I will name these custom post types as post_type_x and post_type_y here. Names of the pages, at which these post types can be editted would be page_x and page_y respectively and both pages are assigned to use the same template. So, the code structure of the template page is below:               <?php     if (is_page('page_x')) {         $current_post_type = "post_type_x";              some if statements to determine the $action variable according to the $_POST variables                  switch ($action) {                 case "...":                                  .... break;                          case "update_save":                 .... break;             }          }  elseif (is_page('page_y')) {         $current_post_type = "post_type_y";              some if statements to determine the $action variable according to the $_POST variables                  switch ($action) {                 case "...":                                  .... break;                          case "update_save":                 .... break;             }          } else { ...     }     ....     get_header(); ?>     ....          <form action="<?php the_permalink(); ?>" method="post" name="post_adv_resp_form" enctype="multipart/form-data">     ....     <input type="file" name="file-attachment" id="file-attachment" />     ....     </form>     ....      Under the "update_save" case there is such a code:               case "update_save":     $post_id = update_post_of_custom_type($_POST['post_id'],$post_title,$post_content,'draft');     if ($post_id != false) {     $file_upload = upload_file_of_custom_type($_FILES['file-attachment'],$post_id,'file-attachment');        ...      } break;      The problem is: When I am testing on page_x, "update_save" case works perfectly. upload_file_of_custom_type function uploads the file, update the post meta. But, when I am on page_y, the script uploads the file and then breaks, does not update the post meta. And I have a white screen. Although the debug mode is on, no error shows on the screen. When I checked the apache logs, I found nothing..               function upload_file_of_custom_type($files,$post_id,$file_form_handler) {         require_once(ABSPATH . "wp-admin" . '/includes/file.php');         require_once(ABSPATH . "wp-admin" . '/includes/media.php');         ... some controls ...              $attach_id = media_handle_upload( $file_form_handler, $post_id, array( 'test_form' => false ) ); $notice = "attach_id: ".$attach_id."upload is OK";                                     if ($attach_id != false){                                                   $file_load = update_post_meta($post_id,'_wp_attached_file',$attach_id);                    if ($file_load == false) {             $notice = __('An error occured while setting the post meta for the uploaded file.', TDOMAIN);             } elseif ($file_load == true) {                 $notice = 'OK';             }         } else {             $notice = __('An error occured while uploading the file.', TDOMAIN);         }     return $notice;     }      One more information.. the post_type_y is posted as a sub page of post_type_y.. I don't know whether this makes any difference.. Are there any ideas about what the problem might be?


How to Validate Widget Input

I have been working with widgets and widgets API. I see that the widget form is rendered and processed through widget() function. I can write validation logic inside the widget() function. I will do a isset($_POST) check and write the form handling logic in it. Something like this:               function widget($args){          extract($args);          is isset(){$_POST['fieldname']          {  // form processing logic  }               // echo HTML Form          }      I would like to separate the form processing logic from the widget function. How can I achieve this? Is there a standard way for doing this?


Is it possible to print kb size of an image attached to a post?

Trying to find a way to print kb size of an image attached to a post. Has anyone an idea how to do this?


Replacing custom field with shortcode

I've been using custom fields for my wordpress theme, but i'd like to use shortcodes now for easier posting. so before, in my index.php i have this:               <?php echo get_post_meta($post->ID, "Thumbnail", true);?>      how do i replace it with custom fields? SUch that i can just insert:               [thumbnail]http://domain.com/image.jpg[/thumbnail]


Experiences with adding Nonces to the comment form

I was wondering about the impact nonces would have on the default comment form a theme has. Because Nonces are a built-in feature of WordPress I thought about giving it a try. _**Does somebody has already implemented nonces in the standard comment form?_** (can't imagine that I'm the first one who thinks about that... !) Can someone suggest an already existing plugin that does the job or provide a code snippet that integrates the WP Nonce Field into the themes comment form and checks for it when the form gets submitted?


W3 Total Cache Help - How to update DNS Zone for a static domain

I am running this site: www.thetechnofreaks.com on Wordpress. Recently I came through a plugin that claims to increase the page load efficiency of my site. the plugin details can be found here: http://wordpress.org/extend/plugins/w3-total-cache/installation/ Now the plugin mentions a self-hosted method for CDN which is known as pipelining. It states: > If you do not have a CDN provider, you can still improve your site's > performance using the "Self-hosted" method. On your own server, create a > subdomain and matching DNS Zone record; e.g. static.domain.com and configure > FTP options on the "Content Delivery Network" tab accordingly. Be sure to > FTP upload the appropriate files, using the available upload buttons. Now I have created a static.thetechnofreaks.com sub-domain but I don't know how to enter matching DNS Zone record and configure FTP options. Please guide me in this regard. I went to my cPanel -> Simple DNS Zone Editor. It contains: Add an A Record Name: Address: Add a CNAME Record Name: CNAME: What am I supposed to enter in this??


Output menu title

Is it possible to output the title of wp_nav_menu somehow? The closest I could find was http://codex.wordpress.org/Function_Reference/wp_nav_menu#Adding_a_Word_at_the_Beginning_of_the_Menu. For the sake of the client and the inclusion of Polylang, I figured it would be nice to enable the user to edit these titles directly under the menu settings in the dashboard.


Front-End Custom Taxonomy Tag Select

The theme I am currently using features a front-end dashboard with posting and post editing, but the pre-existing submission form currently lacks a field to select one or more custom taxonomy tags (taxonomy=ptags). What I would like to do is add either a required drop-down tag selection box to the existing form containing the available tags, or else require the contributor to choose tags using multiple check box fields. It would be ideal if the selection box, or check boxes, were able to call/fetch all the custom taxonomy tags created in the back-end administration area, and limit front-end selection to a maximum number of tags (e.g., 3) during the posting process. So, my questiion is how do I add a custom taxonomy tag selection field to the theme's existing front-end post submission form and make it required? The existing property form (propertyform) starts around line 925 of the following front-end submission page html. Thank you in advance to anyone who can help, or at least point me in the right direction.


wp_get_attachment_metadata returns false with add_action() 'add_attachment' hook

With the following code in functions.php - `wp_get_attachment_metadata()` returns false and or empty. Perhaps I am attempting to use `wp_get_attachment_metadata()` before it's ready? As some tests have shown when manually add a previously added `$attachement_ID` I get the desired information..               function my_custom_attachment($attachment_ID) {            $meta = wp_get_attachment_metadata($attachment_id); // returns false          }          add_action('add_attachment', 'my_custom_attachment');


Multiple custom post types using the same taxonomy = URL frustrations

I have two custom post types:   * Events   * Businesses I have a new taxonomy that both these CTP's share:   * Locations If I go to "domain.com/events/" I see an archive of all the events, and if I go to "domain.com/businesses/" I see an archive of all the businesses. So far, so good. If I go to "domain.com/locations/" I see an archive of all the events AND businesses, which is Ok. However, how do I view the event locations only? "domain.com/locations/events" or "domain.com/events/locations" doesn't work. Do I have to change the rewrite settings for either the locations taxonomy or the CPT? It seems I'm stuck!


Trying to change featured image from 180x180 to full width on home page

Right now my theme puts a 180x180 square image to the left of the title on the home page for each blog post. I'd like to change that to be full width of the content area and below the title. I'm using a child theme, any ideas on how this would be done? Thanks!


Update a custom theme with Subversion?

_Before I start: I'm not sure if this is feasible so any guidance, suggestions, criticisms are welcome._ I'm looking for an easy way to deploy my Wordpress theme code from my development environment (local computer running WAMP) to my staging and production environments (both are hosted servers). The ideal workflow I am looking for would utilize Apache Subversion as my source code repo and would look like this:   1. Make changes to my Wordpress theme in my local environment,   2. Commit code into a Subversion repository that is accessible by production and testing environments,   3. Then I log into my staging / production Wordpress control panel,   4. Go to the **Appearance | Themes** section,   5. Click **Update Theme** button on my theme's display panel that updates my theme from the trunk of the corresponding SVN repository. Nice to have:   * A way to roll changes back to a previous version,   * A notification telling the user that there is an update available,   * A way to commit code directly from within Wordpress (if you changed anything using the theme editor in Wordpress) If this doesn't exist, I'm thinking about developing a plug-in that will achieve the above. The key is that everything happens directly through the Wordpress Admin panel. Using the command line on each server is not an option for me.


Adding more fields to the add user page on dashboard

I'm working on a `Wordpress` site and would like to add a few extra fields to the dashboard `user-new.php` screen so the admin can easily add new users to the site. The fields would need to take in text data in relation to the users Address and a membership number. Currently I've managed to get extra fields displaying on the `user-edit.php` screen. below is the code:               function modify_contact_methods($profile_fields){         //Add New Fields         $profile_fields['name'] = 'Name';         $profile_fields['address_1'] = 'Address 1';         $profile_fields['address_2'] = 'Address 2';         $profile_fields['address_3'] = 'Address 3';         $profile_fields['address_4'] = 'Address 4';         $profile_fields['address_5'] = 'Address 5';         $profile_fields['address_6'] = 'Address 6';              return $profile_fields;     }          add_filter('user_contactmethods', 'modify_contact_methods');      Is there anyway I can do this to the add user form on dashboard? It's only the backend I'm concerned about as currently users do not register automatically for the sites services.


How to redirect from one WP site to another

I want to set it up so when you click on a tab on my one site it redirects you to my other site. I've tried every code I can think of and nothing seems to work. Please help.


oEmbed vimeo with add_query_arg parameters not inserted to HTML

I'm trying to add some parameters to oEmbeded Vimeo videos on my homepage template. I used the solution (with `add_query_arg`) that @splashingpixels suggested here: Add parameters vimeo videos using wordpress embeds `add_query_arg` adds the parameters to the URL ok, and `var_dump` is printing the URL text to the page confirming that the parameters are being added. The embedded video below the `var_dump` is not getting the parameter'd URL, only the normal Vimeo URL. I'm not getting any errors from `WP_DEBUG`. This is the testing site: http://thegallerymusic.com/test/ This is my loop code:               <?php $args = array( 'post_type' => 'films', 'posts_per_page' => 12 );               $the_query = new WP_Query( $args ); ?>              <?php if ( $the_query->have_posts() ) : ?>         <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>                      <?php /* Get the current post ID. */                         global $post;                         $post_id = $post->ID;                       /* If we have a post ID, proceed. */                         if ( !empty( $post_id ) ) { ?>
                                  <?php //
<?php the_title(); ?><?php //
 ?>                                  <?php $videourl = get_post_meta( $post_id, 'film_embed', true );                                   $videourl = add_query_arg(                                      array('title'    => '0',                                           'byline'   => '0',                                           'portrait' => '0',                                           'badge'    => '0',), $videourl );                                     var_dump($videourl);                                        if ( $videourl != '' ) {                                     echo wp_oembed_get( $videourl );                                    } ?>                                  <?php if ( get_post_meta( $post_id, 'film_textarea', true ) ) : ?>

<?php echo get_post_meta( $post_id, 'film_textarea', true ); ?>

                             <?php endif; ?>
                                  <?php wp_reset_postdata(); ?>                              <?php } else { ?>
<?php _e( 'Sorry, no posts matched your criteria.' ); ?>
                              <?php } ?>                  <?php wp_link_pages( array(                 'before' => '
' . __( 'Pages:', '_tk' ),                 'after'  => '
',             ) ); ?>              <?php endwhile; ?>         <?php endif; ?>


When to use Wordpress loop or Foreach loop?

Under what circumstances would you, (should you?) use a foreach loop, instead of the wordpress loop. I have no real coding need, but I'm curious. What's good practice here? Should I:                   $args=array(         'post_parent' => $pos_id,       );          $sublabels=get_posts($args);       foreach($sublabels as $sublabel) { // blabla something to do foreach}      Or:                   query_posts(array(         'post_parent' => $pos_id,     'cat' => 'label',              ));           while (have_posts()) : the_post() ?> // and then the blabla something for each      And why?


Get all images from posts with maximum number and without featured image

I recently asked a question on how to get all images from all posts - and I got a working answer, but unfortunately the code gets post-thumnbnails as well, and I didn't find a way to limit the number of queried images. My last question is here. Thanks.               <?php     $query = new WP_Query( array( 'post_type' => 'post', 'posts_per_page' => -1 ) );     if( $query->have_posts() ){     while($query->have_posts()){     $query->the_post();     $thumb_ID = get_post_thumbnail_id( $post->ID );     $image_query = new WP_Query( array( 'post_type' => 'attachment', 'exclude' => $thumbID, 'post_status' => 'inherit', 'post_mime_type' => 'image', 'posts_per_page' => -1, 'post_parent' => get_the_ID() ) );     while( $image_query->have_posts() ) {     $image_query->the_post();     echo '

', wp_get_attachment_image( get_the_ID() ) , '

';     }     }     }     ?>      Changing the number of the posts_per_page arg in the image_query has no effect, on the number of attachments displayed. I came up with the following, working code with the help of @Bainternet:               <?php     $image_count = 0;     $max_images = of_get_option('thumbs_number');     $Posts = new WP_Query();     $Posts->query('post_type=post&post_status=publish&posts_per_page=-1');         while ($Posts->have_posts()) : $Posts->the_post();             $args = array(         'post_type' => 'attachment',         'numberposts' => -1,         'post_status' => null,         'post_parent' => $post->ID,         'exclude' => get_post_thumbnail_id($id)         );          $attachments = get_posts( $args );         if ( $attachments ) {             foreach ( $attachments as $attachment ) {                 if ($image_count < $max_images){     echo '

';     echo wp_get_attachment_link( $attachment->ID, 'footer_thumbs' );     echo '

';     $image_count = $image_count + 1;             }         }     }     endwhile;?>


Find out who deleted a page or post?

Someone moved a very important page on my website into the trash, and I do not know who did it! It was not deleted permanently so I don't need to worry, in that sense. The revisions, when I restored it, show that someone edited it 3 days prior to today, so it could have been them, but I can't be sure. Does WP keep track of who clicks the trash button? If not, I presume I'd have to write a custom script to hook onto the trash button, when clicked.


Problem with parent page slug only in WordPress admin

I am using the permalink structure: /%category%/%postname%/ in order to show my blog posts under their category in my url. I have also installed WordPress SEO by yoast (if that helps) but I noticed that when I go to publish a page and selected a parent page the urls in the admin becomes: http://www.mysite.com/current-page/current-page/ instead of: http://www.mysite.com/parent-page/current-page/. However and I view the page from the website the url is correct. Only in the admin the problem occurs and it is pretty frustrating for the client. Has anybody experienced the same problem? I am desperate cause I am looking for so many days and I have not found any solution at all. If you want me to give any additional information I will be very happy to do so!! Thank you in advance!


Download Free Trial After Email Entered

For my Wordpress site, it would be useful if I could allow people access to a resource if they entered an email address. Ideally the user would enter an email address and then be given a link to download the resource. Note: I am not looking for support on third-party plugins. I am looking for useful suggestions on how this could be done with Wordpress. If there's a plugin that could do that, I would welcome the suggestion.


how to change default icon of custom plugin?

I made a custom plugin for **POLL** . When I activate it, default icon is coming there on sidebar. I want to change this default icon. Here is my code which I wrote in **init.php** file.               add_action('admin_menu', 'mt_add_pages');                    // action function for above hook     function mt_add_pages() {              // Add a new top-level menu (ill-advised):         add_menu_page(__('Poll','menu-test'), __('Poll','menu-test'), 'manage_options', 'manage-polls', 'poll_page' );              // Add a submenu to the custom top-level menu:         add_submenu_page('manage-polls', __('Add New Poll','menu-test'), __('Add New Poll','menu-test'), 'manage_options', 'add-poll', 'add_new_poll_page');               }                    // mt_toplevel_page() displays the page content for the custom Test Toplevel menu     function poll_page() {         if (!current_user_can('manage_options'))         {           wp_die( __('You do not have sufficient permissions to access this page.') );         }         echo "
";         echo "
";         echo '

';         echo "
";         echo "
" . __( 'Manage Polls', 'menu-test' ) . "
";              include_once 'manage-polls.php';     }          // mt_sublevel_page() displays the page content for the first submenu     // of the custom Test Toplevel menu     function add_new_poll_page() {         if (!current_user_can('manage_options'))         {           wp_die( __('You do not have sufficient permissions to access this page.') );         }         echo "
";         echo "
";         echo '

';         echo "
";         include_once 'poll_form.php';     }      I searched it but results are not coming for custom theme. :( so I am asking here. Thanks in advance!!!!!!


Remove Menu Page Giving Error

I have a snippet of code I've written in the functions.php file which is simply to remove menu pages if the user cannot activate plugins. It works as intended; however it is showing a PHP error in the admin area only if the logged in user is an administrator. Here's the code snippet:               <?php     /************ Remove admin menu items from anyone who isn't an admin ************/          if (!current_user_can('activate_plugins') ) {          function my_remove_menu_pages() {             remove_menu_page('link-manager.php');             remove_menu_page('tools.php');             remove_menu_page('edit-comments.php');         }     };          add_action( 'admin_menu', 'my_remove_menu_pages' );     ?>      Here's the error:               Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'my_remove_menu_pages' not found or invalid function name in /var/www/vhosts/mydomain.com/httpdocs/wp-includes/plugin.php on line 406      I've tried rewriting the snippet a couple different ways, and each time it basically does the same thing. Works as intended, removing admin menu pages for less than admins, but gives the same error in the WP backend when logged in as admin. Any suggestions or thoughts on this?


WordPress forks

Are there any forks of WordPress in existence? Optional subtopics:   * Why did they fork? Differing design goals? (e.g. HTML5 instead of XHTML-syntax per default)   * From which version / time did they departure from the WP codebase?   * Does it reuse any other projects code?   * Is it an active fork or discontinued / stale? WP itself was derived from b2/cafelog. So I guess there's more often an upside to forks. But obviously it depends on the functionality goals if it's a long- lived derivate project. Besides real forks, maybe plugin-enriched (or intensively core "modded") WP distributions are on-topic too. And it's mainly to see which choices exist, or where development might go.


Custom post-type's pagination not working in category.php

I have this code to the file category.php :               <?php get_header(); ?>

     <?php      $my_query = null;     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $my_query = new WP_Query(array('post_type'=>array('post','articulo'), 'paged' => $paged, 'category_name'=>single_cat_title('', false), 'posts_per_page' => 10));     if ( $my_query->have_posts() ) : while ( $my_query->have_posts() ) : $my_query->the_post();      if ($my_query->post->post_type == 'post') {?>

<a href="<?php the_permalink() ?>"><?php the_post_thumbnail( 'thumbnail', $attr ); ?>

     <?php foreach((get_the_category()) as $category) {      echo '
cat_name. '">term_id ).'">' . $category->cat_name . '
';}?>
     <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>">
<?php the_title(); ?>

Escrito por <?php the_author_posts_link(); ?> el <?php the_time('d/m/Y') ?> a las <?php the_time('G:i'); ?>

<?php comments_number('0 Comentarios', '1 Comentario', '% Comentarios' );?>

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

     <?php } if ($my_query->post->post_type == 'articulo') {?>

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

     Escrito por <?php the_author_posts_link(); ?> el <?php the_time('d/m/Y') ?> a las <?php the_time('G:i'); ?>
<?php comments_number('0 Comentarios', '1 Comentario', '% Comentarios' );?>

     <?php the_content(false); ?>
<a href="<?php the_permalink() ?>">Continuar

          <?php } else; endwhile;?>

<?php previous_posts_link( __( 'Anterior' ) ); ?>

<?php next_posts_link( __( 'Siguiente' ) ); ?>

     <?php endif; ?>     <?php get_sidebar(); get_footer(); ?>      But the pagination doesn't work in the categories where only there are custom post-type


Is it possible to Hook/Filters Attachment Creation?

Is it possible to hook or filter the attachment creation process? More specifically is it possible to hook into the attachment creation so that I may parse the attachment’s filename, populate the attachment’s Meta data (title) with a filtered version of its filename? If not, are hooks and filters planned for the media library with future updates to core?