Fatal Error: get_header();

> Fatal error: Call to undefined function get_header() I can't get this working. I am using twentythirteen default theme shipped with wordpress. I have created a custom template called `table.php` and I also used `<?php template name ?>`. This custom template simply shows up all records in a database. Its working just fine but header and footer are missing and when I try to add header and footer of the current theme by adding `get_header` and `get_footer`, it throws a fatal error. Here is the code: Just to mention, I used `index.php` that is inside twentythirteen folder, not from root folder where `wp-config` file or any other `index.php` for that matter.               <?php     /**      * The main template file      *      * This is the most generic template file in a WordPress theme and one of the      * two required files for a theme (the other being style.css).      * It is used to display a page when nothing more specific matches a query.      * For example, it puts together the home page when no home.php file exists.      *      * @link http://codex.wordpress.org/Template_Hierarchy      *      * @package WordPress      * @subpackage Twenty_Thirteen      * @since Twenty Thirteen 1.0      */          get_header(); ?>
                  <form method = "post"  action="<?php echo get_stylesheet_directory_uri(); ?>/dbentry.php">                 First Name: <input type="text" name = "first">*<?php echo $first_error;?>
                      Last Name: <input type="text" name = "last">*<?php echo $last_error; ?>
                      Email: &nbsp &nbsp &nbsp &nbsp    <input type="text" name = "email">
                 Telephone: <input type="number" name = "telephone">*<?php echo $tele_error; ?>
                      Gender:&nbsp &nbsp                  <input type="radio" name = "gender" value = "female">Female                 <input type="radio" name = "gender" value = "male">Male
                      <input type="submit" value ="submit" name="submit">
                       </form>
                      <form action="<?php echo get_stylesheet_directory_uri(); ?>/tab.php"     method="post">                 <input type="submit" name = 'submit2' value = 'http://localhost/wordpress/?page_id=11'>             </form>          <?php get_sidebar(); ?>     <?php get_footer(); ?>      **Here is the code where the call will go after pressing the "Show all records" button.**               <?php         /**          * The template for displaying all pages          *          * This is the template that displays all pages by default.          * Please note that this is the WordPress construct of pages and that other          * 'pages' on your WordPress site will use a different template.          *          * @package WordPress          * @subpackage Twenty_Thirteen          * @since Twenty Thirteen 1.0          */               /*           Template name: tab          */              get_header(); ?>

                 <?php                         require "db.php";                         if(isset($_POST['submit2'])){                         $query = "SELECT * FROM person";                         $result = mysqli_query($connection, $query);                         $row = '';                         $id = "";                         echo "
";                         echo "ID	";                         echo "FIRST	";                         echo "LAST	";                         echo "EMAIL	";                         echo "TELEPHONE	";                         echo "GENDER	";                         echo "EDIT	";                         echo "DELETE	";                         echo "
";                 echo "
this is working just fine
";                         while($row = mysqli_fetch_array($result)){                             $id = $row['ID'];                 echo $id ;                                  echo "
".$row['ID']."	".$row['First']."	".$row['Last']."	".$row['Email']."	".$row['Telephone'].                             "	".$row['Gender']."	"."<input type='button' class = 'edit' value = 'Edit'>"."	"."<input type='button' class = 'del' value='Delete'>"."
";                              }                              mysqli_close($connection);                         }                  ?>

jsdnsdjnsjd

                            <form action="form.php" method="post">             <input type="submit" name="new" value="New Entry" class = "new">             </form>                             <?php get_sidebar(); ?>         <?php get_footer(); ?>


Improving the Thesis built-in dropdown menu via javascript

The dropdown menu that Thesis creates is 99% fine, except that it's very unforgiving to users that don't master the use of mouse very easily - old people and people with average to bad vision. I would like to improve its usability using a bit of javascript, allowing the mouse to be a few pixels offside and still keep the submenu open. I tried this in my custom javascript file:               var hoverConfig = {                  over: function(e){                     e.preventDefault();                     $.log("launch menu");                     $('.sub-menu',$(this)).show();             },               timeout: 500, // number = milliseconds delay before onMouseOut                 out:  function(e){                     e.preventDefault();                     $.log("hide menu");                     $('.sub-menu',$(this)).hide();             }          };              $('.sub-menu').hide();         $("#menu-main-menu").hoverIntent( hoverConfig );      Firebug logging shows that it works - the show and hide functions are called, but the CSS behaviour still triggers and i don't manage to cancel it so that the javascript behaviour takes the full control. Any idea how i can do that?


Where are a theme's options stored and can I export them to be imported into freshly installed themes?

Imagine that a person has a few premium themes that they use for clients. In those premium themes are many different options that can be set. Is it possible to set the theme's options to the most common and preferred choices and then export those options for later importation into other fresh WordPress installs with the same theme? That way one is not merely pointing and clicking their way through the various options over and over again for each new install.


How to show full post?

I'm using this theme for my magazine website. I'm having trouble showing the full content on my blog side. I have tried changing in the php to `show_content` but it doesn't work. Any suggestions on how to solve this This is the page code:               <?php      /* Template Name: Home 5 */     ?>          <?php get_header(); ?>

                                    Recent Posts

                  <?php if ( have_posts() ) : ?>                                       <?php $wp_query = new WP_Query( array(                                                      "cat" => "",                                                      "posts_per_page" => "",                                                      "post_type" => "post",                                                     "paged" => get_query_var('paged') ? get_query_var('paged') : 1                                                     )                                                                                );                 while( $wp_query->have_posts() ) : $wp_query->the_post(); ?>                      <div <?php post_class(); ?>>
                             <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>">                                 <h1 class="tmpost-<?php the_ID(); ?>">                                 <?php $tit = the_title('','',FALSE); echo substr($tit, 0, 150); if (strlen($tit) > 150) echo " ..."; ?>

                         <div class="tmpost-<?php the_ID(); ?>-item">
                                                           <?php _e('By', 'tm_myid_text'); ?> <?php the_author(); ?>

                                                           In <?php $category = get_the_category(); echo $category[0]->cat_name; ?>

                                                          <?php the_time('M jS, Y') ?>

                                                           <?php comments_number(__('0 Comments', 'tm_myid_text'), __('1 Comment', 'tm_myid_text'), __( '% Comments', 'tm_myid_text') );?>

                                                           <?php echo tm_viewcounter_display(get_the_ID()); ?>

                     <?php if (has_post_thumbnail()) { ?>                         <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">                         <?php the_post_thumbnail( 'Full' ); ?>                                              <?php } else { ?>                     <?php } ?>

                         <?php echo excerpt(500); ?>

                                 <a href="<?php the_permalink() ?>">                                                                           <?php _e('Kommentera', 'tm_myid_text'); ?>

                      <?php endwhile; ?>

             <?php echo tm_pagination_nav(); ?>

                           <?php else : ?>             <?php endif; ?>
               <?php get_template_part( 'sidebar_left' ); ?>                    <?php get_footer(); ?>


Dot "." in option value foobars save options function

My theme options save routine is below. I'm finding that if the $value['id'] being passed from my options array has a period in it, the data does not get passed and the options appear to break at that point. Should I opt for another character or is there a workaround for using the period character in an option name? For example, this works fine:                "id" => "myTheme_color|sidebar",      but this does not (no data is passed for the value):                "id" => "myTheme_color.sidebar",      The save function is:               function mytheme_add_admin(){     global $themename, $shortname, $options;      if ( $_GET['page'] == basename(__FILE__) )     {         if ( 'save' == $_REQUEST['action'] )          {             foreach ($options as $value)              {                 update_option( $value['id'], stripslashes($_REQUEST[$value['id']]) );              }             foreach ($options as $value)              {                 if( isset( $_REQUEST[ $value['id'] ] ) )                  {                     update_option( $value['id'], stripslashes($_REQUEST[ $value['id'] ])  );                  echo $value['id'].": ".$_REQUEST[$value['id']]."
";                 echo $value['id'].": ".stripslashes($_REQUEST[$value['id']])."
";                 }              }         }     }


Passing Variables through locate_template

While I've typically used include or require on their own to save long term code maintenance I've started to use get_template_part and locate_template as using built in WordPress stuff is always best. My question is are you supposed to be able to pass variables through to the results of either get_template_part or locate_template?               <?php     $var = get_option( 'my-custom-option' );          get_template_part( 'custom-template-part' );     ?>      In the code above the $var would be printed inside the custom template but the variable doesn't seem to work. Am I missing something or is this expected behaviour? I've found that they don't pass in the instance above or when using locate_template               <?php     locate_template( 'custom-template-part.php', true );     ?>


Custom post type metabox array

I am trying to create a custom post type with custom metabox array. How can I create this kind a automatic populating post type? I think I have to use two dimension array. But how can I automatically populate my data array? And how can I save this kind array. Could some one point me to right direction? **Please take a look at the images.** ![Img1](http://i.stack.imgur.com/HQVYn.png) Second img ![enter image description here](http://i.stack.imgur.com/WLwbH.png) My code so far :               <?php     //add custom field - price     add_action("admin_init", "price");          function object_init(){       add_meta_box("price_meta", "Price fields :", "object", "price_meta", "normal", "low");          }               function price_meta(){      global $post;       $custom = get_post_custom($post->ID);       $price = $custom["price"][0];       ?>
Nr :
         <input type="text" name="priceNr" size="10" value="<?php echo $price; ?>"/>

Description :
         <input type="text" name="priceD" size="50" value="<?php echo $price; ?>"/>

Price :
         <input type="text" name="price" size="20" value="<?php echo $price; ?>"/>
            <?php     }     //Save product price     add_action('save_post', 'save_detailss');          function save_detailss(){      global $post;           $post_id = $post->ID;           // to prevent metadata or custom fields from disappearing...      if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )      return $post_id;           update_post_meta($post_id, "price", $_POST["price"]);           }             ?>


How to get a Jewish/English event calendar on a page in WordPress?

What I need is an event calendar to display both the english and Jewish dates, but have it be based on the hebrew date. With this people could input the date of an anniversary and have it reappear every year on the hebrew date and just show what date that would translate to in the english calendar. I've seen this calendar http://wordpress.org/extend/plugins/events-calendar/, which is perfect, only it doesn't have the Jewish dates. How would I go about doing this? Thank you very much in advance.


Why my meta boxes won't show in front post page?

I see it everywhere: in single post, in category archives etc, but in front page post not. I display the metaboxes in this way:               <?php if (get_post_meta($post->ID, 'test_1', true) != '' ) { ?><?php echo get_post_meta($post->ID, 'test_1', true);?><?php } ?>      What's wrong? What i'm doing wrong? Is possible to display the meta boxies in a different way? **Here is the code:**               add_action( 'init', 'create_xy_taxonomies', 0 );     function create_pc_db_taxonomies() {     register_taxonomy( 'genre', 'post', array( 'hierarchical' => false, 'label' => __('Tests', 'series'), 'query_var' => 'test', 'rewrite' => array( 'slug' => 'tests' ) ) );          $prefix = 'xy_meta_';               $meta_box = array(         'id' => 'xy-meta-box',         'title' => 'Xy tests',         'page' => 'post',         'context' => 'normal',         'priority' => 'high',         'fields' => array(             array(                 'name' => 'Test_1',                 'id' => 'test_1',                 'type' => 'text',                 'std' => ''             ),             array(                 'name' => 'Test_2',                 'id' => 'test_2',                 'type' => 'select',                 'options' => array('','1'),                 'std' => ''             ),         )     );          add_action('admin_menu', 'mytheme_add_box');          function mytheme_add_box() {         global $meta_box;              add_meta_box($meta_box['id'], $meta_box['title'], 'mytheme_show_box', $meta_box['page'], $meta_box['context'], $meta_box['priority']);     }          function mytheme_show_box() {         global $meta_box, $post;                   echo '<input type="hidden" name="mytheme_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';              echo '
';              foreach ($meta_box['fields'] as $field) {                  $meta = get_post_meta($post->ID, $field['id'], true);                  echo '
',                     '', $field['name'], '	',                     '';             switch ($field['type']) {                 case 'text':                     echo '<input type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : $field['std'], '" size="30" style="width:97%" />',                         '
', $field['desc'];                     break;                 case 'textarea':                     echo '<textarea name="', $field['id'], '" id="', $field['id'], '" cols="60" rows="4" style="width:97%">', $meta ? $meta : $field['std'], '</textarea>',                         '
', $field['desc'];                     break;                 case 'select':                     echo '<select name="', $field['id'], '" id="', $field['id'], '">';                     foreach ($field['options'] as $option) {                         echo '<option', $meta == $option ? ' selected="selected"' : '', '>', $option, '</option>';                     }                     echo '</select>';                     break;                 case 'radio':                     foreach ($field['options'] as $option) {                         echo '<input type="radio" name="', $field['id'], '" value="', $option['value'], '"', $meta == $option['value'] ? ' checked="checked"' : '', ' />', $option['name'];                     }                     break;                 case 'checkbox':                     echo '<input type="checkbox" name="', $field['id'], '" id="', $field['id'], '"', $meta ? ' checked="checked"' : '', ' />';                     break;             }             echo    '',                 '
';         }              echo '
';     }          add_action('save_post', 'mytheme_save_data');               function mytheme_save_data($post_id) {         global $meta_box;         if (!wp_verify_nonce($_POST['mytheme_meta_box_nonce'], basename(__FILE__))) {             return $post_id;         }         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {             return $post_id;         }         if ('page' == $_POST['post_type']) {             if (!current_user_can('edit_page', $post_id)) {                 return $post_id;             }         } elseif (!current_user_can('edit_post', $post_id)) {             return $post_id;         }         foreach ($meta_box['fields'] as $field) {             $old = get_post_meta($post_id, $field['id'], true);             $new = $_POST[$field['id']];                  if ($new && $new != $old) {                 update_post_meta($post_id, $field['id'], $new);             } elseif ('' == $new && $old) {                 delete_post_meta($post_id, $field['id'], $old);             }         }     }


Gallery Image Numbers?

Is there a way, in an image gallery, to display what number the image is in the gallery in the image.php template? I'd like to incorporate this into my next / previous button area. For example, if I'm on the first image out of twenty it would say "1 of 20".


Custom Post Type - Main page for certain posts

I've successfully added a custom post type.               register_post_type('case',             array(                 'labels' => array(                     'name' => __('Cases'),                     'singular_name' => __('Case')                 ),                 'public' => true,                 'has_archive' => true,                 'supports' => array('title', 'editor', 'thumbnail','custom-fields', 'page-attributes')             )              );      And I've created a page called "case" and I have my permalinks configured like this:               /%postname%      The problem I'm having now is that when I try to access url.com/case I don't get my page "case" but instead I'm looking at the custom post type "case". I think? Every "case" has its own url --> url.com/case/xxx. I don't want to change this but instead be able to change the layout for the custom page "main" page that represents all the cases instead of a "page" called case. Can this be done and how?


WP Supersized: Insert zero in front of one digit slider numbers

I hope there is a WP Supersized champ out who know the answer to this one: I would like to turn the one digit slide numbers in WP Superslider into two digit numbers. So 1/15 would be 01/15, 3/5 would be 03/05, and so on. Can somebody help me, please? :) Plugin: http://wordpress.org/support/plugin/wp-supersized **So far I have tried this script** - but it only works until it goes to next slide:               $(".number").text(function(i, val){         return $.trim(val).length === 1 ? '0' + val : val;     });      **Also I think this PHP could work.** (But I can not figure out where to put it, because it is not clear to me where in the plugin the numbers are printed):               $number_padded = sprintf("%02s", $number);     echo $number_padded;


How to check if a certain theme option settings has already been set

I am using the following lines to check if the theme setting already exist or set but it's not working:               if (get_theme_mod('mysetting')==FALSE) {      Aside from get_theme_mod, how to really check if the theme setting is already set? Thanks.


Class for Selected Menu using wp_nav_menu

I create Widget for Vertical menu Now I am trying to get selected or current menu using **wp_nav_menu** Any one know how to Add current class when selected in **wp_nav_menu**


Different development environments (Mac & Windows)

I am trying to synchronize development between a Windows user (WAMP) and a Mac user (Regular Apache). **Windows User (me)** Since I use IIS I need my port 80 so I have changed the ports on WAMP to :666. So the url to the Wordpress is http://localhost:666/projectname/ **Mac user** He has the site on a non-alias, just the path the the project So the url is http://localhost/foldername/wordpress/ * * * In wp-config.php I have the following code               if (file_exists('local_settings.php')) {     include('local_settings.php');     } else {     $debug_on = true;     }      And in the local_settings.php               define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/projectname/');     define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/projectname/');      But this code doesn't seem to actually override the damn stupid database siteurl because when he tries to login, it still heads to localhost:666 (which is the value in the database). Or is it impossible to sync different developers? How do you guys do it? And please don't ask me to change my port to :80 :)


Symbolic Links for themes - linking one theme to many wordpress installs

This discussion relateds to plugins: Symbolic Links on dev box with plugins and stylesheets I was wondering if the same problem exists for symlinking a theme to many different wordpress installs. **Example structure:** > domain/footheme/ <- theme resides here **The following domains symlinks created here:** > domain/myfoo.com/wp-content/theme/(footheme) > > domain/myfoo2.com/wp-content/theme/(footheme) > > domain/myfoo3.com/wp-content/theme/(footheme) **Example Symlink Creation** `ln -s domain/footheme domain/myfoo.com/wp-content/theme/footheme`


Should I use "Categories " or "Pages" for a WordPress Static Site (A non blog site)?

I want to use WordPress for a Company Site which is not a blog; that will have regular pages, such as "About Us", "our Products", "Our Services", etc. What is the best way to use WordPress for this project ? Should I use "Pages" to define individual pages, or Should I use "Categories" to define pages ? I'm planing to use some free WordPress Themes to design/customize and deploy the site, what should I be aware of if I'm to use WordPress for a non-blog site ... Thank you for your advices ... Fawaz


Sites network with sub-folders

I want to create sites network. I was following with this tutorial: http://codex.wordpress.org/Create_A_Network Unfortunately it doesn't works. I the admin panel I do not have any links to manage the sites like 'Network admin': http://codex.wordpress.org/images/7/78/network-admin-link.png My wordpress is here: k-state|dot|zxq|dot|net Thanks in advance!


WP_Query based on multiple metadata comparisons

I have created a custom post type with custom fields and I need to filter them based on several meta data values.               $args = array(            'post_type' => 'match_report',            'post_status' => 'publish',            'meta_key' => 'report_type',            'meta_value' => 'cup',            'meta_query' => array(                'relation' => 'OR',                   array(                      'key' => 'report_home-select',                      'value' => $team_id,                      'compare' => '=',                   ),                   array(                      'key' => 'report_away-select',                      'value' => $team_id,                      'compare' => '='                   )            )                                            );              $reports = new WP_Query($args);      Basically I want to create a meta query that has a relation of OR and AND. So in English I want the all the match reports with the `report_type` 'cup' that have either the `report_home-select` key with the value of a specific team_id OR the `report_away-select` key with the same value. I hope that makes sense. In essence I want a double relation.


how to override menu widget?

I would like to customize the menu widget in sense to add some classes which would make it responsive. How do I override the default widget for menus? I use a custom template which supports bootstrap 3. I set a menu as widget and I make the presence in my sidebar. the mark-up should look like
                 <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">                                                                                </button>

Sidebar22

Link

Link

Link

Link

                Can I override the menu widget generation in my functions.php?!


Plugin options with googlemap iframe

I have put google map in text option of plugin.The text input value is
View Larger Map      while displaying the field value server response with page not found error.To display I have used               $options = get_option('googlemap_options');     echo html_entity_decode($options['map_url']);      what is the correct way to display google map?


How to rewrite rules for WP-security in Nginx?

I have a WordPress website on a VPS running nginx. I have installed the WP Security plugin to improve the security of my site. After changing all the settings to my liking, a pop-up notifies me that I need rewrite the rules to save my changes. Part of it said "See the Better WP Security Dashboard for a list of the rewrite rules you will need." The list of rewrite rules can be found here:               # BEGIN Better WP Security         # Begin HackRepair.com Blacklist             if ($http_user_agent ~* "^BlackWidow"){ return 403; }             if ($http_user_agent ~ "^Bolt"){ return 403; }             if ($http_user_agent ~* "CazoodleBot"){ return 403; }             if ($http_user_agent ~* "^ChinaClaw"){ return 403; }             if ($http_user_agent ~* "^Custo"){ return 403; }             if ($http_user_agent ~ "^Default"){ return 403; }             if ($http_user_agent ~* "^DIIbot"){ return 403; }             if ($http_user_agent ~* "^DISCo"){ return 403; }             if ($http_user_agent ~* "discobot"){ return 403; }             if ($http_user_agent ~* "^eCatch"){ return 403; }             if ($http_user_agent ~* "ecxi"){ return 403; }             if ($http_user_agent ~* "^EirGrabber"){ return 403; }             if ($http_user_agent ~* "^EmailCollector"){ return 403; }             if ($http_user_agent ~* "^EmailSiphon"){ return 403; }             if ($http_user_agent ~* "^EmailWolf"){ return 403; }             if ($http_user_agent ~* "^ExtractorPro"){ return 403; }             if ($http_user_agent ~* "^EyeNetIE"){ return 403; }             if ($http_user_agent ~* "^FlashGet"){ return 403; }             if ($http_user_agent ~* "^GetRight"){ return 403; }             if ($http_user_agent ~* "^GetWeb!"){ return 403; }             if ($http_user_agent ~* "^Go!Zilla"){ return 403; }             if ($http_user_agent ~* "^Go-Ahead-Got-It"){ return 403; }             if ($http_user_agent ~* "^GrabNet"){ return 403; }             if ($http_user_agent ~* "^Grafula"){ return 403; }             if ($http_user_agent ~* "GT::WWW"){ return 403; }             if ($http_user_agent ~* "heritrix"){ return 403; }             if ($http_user_agent ~* "^HMView"){ return 403; }             if ($http_user_agent ~* "HTTP::Lite"){ return 403; }             if ($http_user_agent ~* "HTTrack"){ return 403; }             if ($http_user_agent ~* "ia_archiver"){ return 403; }             if ($http_user_agent ~* "IDBot"){ return 403; }             if ($http_user_agent ~* "id-search"){ return 403; }             if ($http_user_agent ~* "id-search.org"){ return 403; }             if ($http_user_agent ~* "^InterGET"){ return 403; }             if ($http_user_agent ~* "^InternetSeer.com"){ return 403; }             if ($http_user_agent ~* "IRLbot"){ return 403; }             if ($http_user_agent ~* "^Java"){ return 403; }             if ($http_user_agent ~* "^JetCar"){ return 403; }             if ($http_user_agent ~* "^larbin"){ return 403; }             if ($http_user_agent ~* "^LeechFTP"){ return 403; }             if ($http_user_agent ~* "libwww"){ return 403; }             if ($http_user_agent ~* "libwww-perl"){ return 403; }             if ($http_user_agent ~* "^Link"){ return 403; }             if ($http_user_agent ~* "LinksManager.com_bot"){ return 403; }             if ($http_user_agent ~* "linkwalker"){ return 403; }             if ($http_user_agent ~* "lwp-trivial"){ return 403; }             if ($http_user_agent ~* "^Maxthon$"){ return 403; }             if ($http_user_agent ~* "MFC_Tear_Sample"){ return 403; }             if ($http_user_agent ~* "^microsoft.url"){ return 403; }             if ($http_user_agent ~ "Microsoft"){ return 403; }             if ($http_user_agent ~* "^Mozilla.*Indy"){ return 403; }             if ($http_user_agent ~* "^Mozilla.*NEWT"){ return 403; }             if ($http_user_agent ~* "^MSFrontPage"){ return 403; }             if ($http_user_agent ~* "^Navroad"){ return 403; }             if ($http_user_agent ~* "^NearSite"){ return 403; }             if ($http_user_agent ~* "^NetAnts"){ return 403; }             if ($http_user_agent ~* "^NetSpider"){ return 403; }             if ($http_user_agent ~* "^NetZIP"){ return 403; }             if ($http_user_agent ~* "^Nutch"){ return 403; }             if ($http_user_agent ~* "^Octopus"){ return 403; }             if ($http_user_agent ~* "^PageGrabber"){ return 403; }             if ($http_user_agent ~* "panscient.com"){ return 403; }             if ($http_user_agent ~* "^pavuk"){ return 403; }             if ($http_user_agent ~* "PECL::HTTP"){ return 403; }             if ($http_user_agent ~* "^PeoplePal"){ return 403; }             if ($http_user_agent ~* "^pcBrowser"){ return 403; }             if ($http_user_agent ~* "PHPCrawl"){ return 403; }             if ($http_user_agent ~* "PleaseCrawl"){ return 403; }             if ($http_user_agent ~* "^psbot"){ return 403; }             if ($http_user_agent ~* "^RealDownload"){ return 403; }             if ($http_user_agent ~* "^ReGet"){ return 403; }             if ($http_user_agent ~ "^Rippers"){ return 403; }             if ($http_user_agent ~* "SBIder"){ return 403; }             if ($http_user_agent ~* "^SeaMonkey$"){ return 403; }             if ($http_user_agent ~* "^sitecheck.internetseer.com"){ return 403; }             if ($http_user_agent ~* "^SiteSnagger"){ return 403; }             if ($http_user_agent ~* "^SmartDownload"){ return 403; }             if ($http_user_agent ~* "Snoopy"){ return 403; }             if ($http_user_agent ~* "Steeler"){ return 403; }             if ($http_user_agent ~* "^SuperBot"){ return 403; }             if ($http_user_agent ~* "^SuperHTTP"){ return 403; }             if ($http_user_agent ~* "^Surfbot"){ return 403; }             if ($http_user_agent ~* "^tAkeOut"){ return 403; }             if ($http_user_agent ~ "^Teleport"){ return 403; }             if ($http_user_agent ~ "^Toata"){ return 403; }             if ($http_user_agent ~* "URI::Fetch"){ return 403; }             if ($http_user_agent ~* "urllib"){ return 403; }             if ($http_user_agent ~* "User-Agent"){ return 403; }             if ($http_user_agent ~* "^VoidEYE"){ return 403; }             if ($http_user_agent ~* "webalta"){ return 403; }             if ($http_user_agent ~* "^WebAuto"){ return 403; }             if ($http_user_agent ~* "^[Ww]eb[Bb]andit"){ return 403; }             if ($http_user_agent ~* "WebCollage"){ return 403; }             if ($http_user_agent ~* "^WebCopier"){ return 403; }             if ($http_user_agent ~* "^WebFetch"){ return 403; }             if ($http_user_agent ~* "^WebLeacher"){ return 403; }             if ($http_user_agent ~* "^WebReaper"){ return 403; }             if ($http_user_agent ~* "^WebSauger"){ return 403; }             if ($http_user_agent ~* "^WebStripper"){ return 403; }             if ($http_user_agent ~* "^WebWhacker"){ return 403; }             if ($http_user_agent ~* "^WebZIP"){ return 403; }             if ($http_user_agent ~* "^Wget"){ return 403; }             if ($http_user_agent ~* "^Widow"){ return 403; }             if ($http_user_agent ~* "^WWW-Mechanize"){ return 403; }             if ($http_user_agent ~* "^WWWOFFLE"){ return 403; }             if ($http_user_agent ~* "zermelo"){ return 403; }             if ($http_user_agent ~* "^Zeus"){ return 403; }             if ($http_user_agent ~* "^Zeus.*Webster"){ return 403; }             if ($http_user_agent ~* "ZyBorg"){ return 403; }         # End HackRepair.com Blacklist              location ~ /\.ht { deny all; }         location ~ wp-config.php { deny all; }         location ~ readme.html { deny all; }         location ~ readme.txt { deny all; }         location ~ /install.php { deny all; }         set $susquery 0;         set $rule_2 0;         set $rule_3 0;         rewrite ^wp-includes/(.*).php /not_found last;         rewrite ^/wp-admin/includes(.*)$ /not_found last;         if ($request_method ~* "^(TRACE|DELETE|TRACK)"){ return 403; }         if ($args ~* "\.\./") { set $susquery 1; }         if ($args ~* ".(bash|git|hg|log|svn|swp|cvs)") { set $susquery 1; }         if ($args ~* "etc/passwd") { set $susquery 1; }         if ($args ~* "boot.ini") { set $susquery 1; }         if ($args ~* "ftp:") { set $susquery 1; }         if ($args ~* "http:") { set $susquery 1; }         if ($args ~* "https:") { set $susquery 1; }         if ($args ~* "(<|%3C).*script.*(>|%3E)") { set $susquery 1; }         if ($args ~* "mosConfig_[a-zA-Z_]{1,21}(=|%3D)") { set $susquery 1; }         if ($args ~* "base64_encode") { set $susquery 1; }         if ($args ~* "(%24&x)") { set $susquery 1; }         if ($args ~* "(\[|\]|\(|\)|<|>|ê|\"|;|\?|\*|=$)"){ set $susquery 1; }         if ($args ~* "("|'|<|>|\|{|||%24&x)"){ set $susquery 1; }         if ($args ~* "(127.0)") { set $susquery 1; }         if ($args ~* "(%0|%A|%B|%C|%D|%E|%F)") { set $susquery 1; }         if ($args ~* "(globals|encode|localhost|loopback)") { set $susquery 1; }         if ($args ~* "(request|select|insert|concat|union|declare)") { set $susquery 1; }         if ($http_cookie !~* "wordpress_logged_in_" ) {             set $susquery 2$susquery;             set $rule_2 1;             set $rule_3 1;         }         if ($args !~ "^loggedout=true") { set $susquery 3$susquery; }         if ($susquery = 4321) { return 403; }         rewrite ^/login/?$ /wp-login.php?nw61e1jrijsnetr1xokgx redirect;         if ($rule_2 = 1) { rewrite ^/totalaccess/?$ /wp-login.php?nw61e1jrijsnetr1xokgx&redirect_to=/wp-admin/ redirect; }         if ($rule_2 = 0) { rewrite ^/totalaccess/?$ /wp-admin/?nw61e1jrijsnetr1xokgx redirect; }         rewrite ^/register/?$ /wp-login.php?nw61e1jrijsnetr1xokgx&action=register redirect;         if ($uri !~ "^(.*)admin-ajax.php") { set $rule_3 2$rule_3; }         if ($http_referer !~* wp-admin ) { set $rule_3 3$rule_3; }         if ($http_referer !~* wp-login.php ) { set $rule_3 4$rule_3; }         if ($http_referer !~* login ) { set $rule_3 5$rule_3; }         if ($http_referer !~* totalaccess ) { set $rule_3 6$rule_3; }         if ($http_referer !~* register ) { set $rule_3 7$rule_3; }         if ($args !~ "^action=logout") { set $rule_3 8$rule_3; }         if ($args !~ "^nw61e1jrijsnetr1xokgx") { set $rule_3 9$rule_3; }         if ($args !~ "^action=rp") { set $rule_3 0$rule_3; }         if ($args !~ "^action=register") { set $rule_3 a$rule_3; }         if ($args !~ "^action=postpass") { set $rule_3 b$rule_3; }         if ($rule_3 = ba0987654321) {             rewrite ^(.*/)?wp-login.php /not_found redirect;             rewrite ^/wp-admin(.*)$ /not_found redirect;         }     # END Better WP Security      I'm not actually sure whether the changes from the plugin have really taken effect since I have modified any file myself with these rules. I asked and did some Googling, but I could not find an answer. So I'm just wondering how I can "rewrite" this rules to make sure the security is properly in place.


Pre populate gravity form with admin only drop down of WP users

I am building a directory with GF + Directory addon (lovely) However, one glitch: I am creating the user accounts and the form entires to begin with - so a user that logs into their account later to edit their entry will not see their entry (when using the directory addon shortcode) because their user account did not create the entry. I need the user account I create to be associated with an entry I create - I dont want to have to login as each user to create the entries. I want to create them as Admin and assin them to a user account. The best way I can think to do this is to have an Admin only field in the form that allows me to select a WP user to be the creator/owner of the entry. I imagine using a dropdown pre-populated with the WP users. How to do this ? Will it actually work ? Is there a better way to achieve what I am trying to do ? thanks a lot Joe


Wordpress custom archive page

I am trying to build up a custom archive page. However, I would like this archive page to skip the first 5 posts. I've been able to accomplish this with the offset property. However, the pagination seems to break. Here's my code before the while:                <?php      $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;      $wp_query = new WP_Query();      $wp_query->query('posts_per_page='.get_option('posts_per_page').'&paged=' . $paged);      ?>      And this is the code I'm using for the pagination:               <?php wp_reset_postdata(); ?>
<?php next_posts_link(__('« Entradas anteriores', '')) ?>

<?php previous_posts_link(__('Entradas recientes »', '')) ?>
      Any help is deeply appreciated. Johann


Cannot stop wpautop from messing up my plug-in output

I have a plug-in that embeds some javascript. I've tried using remove_filter() to stop wpautop in every way recommend and still can't get wordpress to stop wrapping my `<script></script>` tags with with `<p>` tags like this `<p><script></script></p>` I tried adding the following to both the short code php and also in the functions.php               remove_filter( 'the_content', 'wpautop' );     remove_filter( 'the_excerpt',     'wpautop' );


Buddypress: Edit activity when new blog post

I am trying to edit the activity on Buddypress (1.7 and running latest Wordpress) for when a new blog post is created. By default it displays the excerpt and shows any attached images, it also strips any code (I think). What I'm trying to achieve is to show the full blog post, including things like galleries. Doing some searches through the internet and the docs led me to: `bp_activity_content_body() and bp_create_excerpt` Help from the online community has led me to: `bp_activity_truncate_entry in bp-activity-filters.php` But I can't seem to figure out how to work the filters (apply / add). I tried the following (for bp_activity_truncate_entry), but no succes so far:               apply_filters ('bp_activity_excerpt_length', 500);       And the following for bp_create_excerpt:               remove_filter( 'bp_create_excerpt', $length, $options );      function pnb_excerpt(){     $lenght = 500;       $options = array(       'ending' => __( ' […]', 'buddypress' ),      'exact'             => false,       'html'              => false,       'filter_shortcodes' => $filter_shortcodes_default); }      add_filter( 'bp_create_excerpt', 'pnb_excerpt', $length, $options );      (Also tried apply instead of add) Neither of them seem to work. But again I am not sure how to work these filters. Can anybody point me in the right direction?


Shared Content but "Updatable" Through the Main Site

I have been doing quite a lot of research the past week, and have not been able to find a solid answer that fixes my problem. So, I decided to come here to ask to see if anyone knows of how to help with my problem. I'm going to working on a project using WordPress Multisite that will allow users to register for a site and be able to re-brand the content that we will be giving them as their own (ie: the company I will be working with has a slew of realtor information that they want to give away - for a fee - to other realtors and allow them to brand it with their logo and contact info). So, it would be easy to create a template site with all the content already pre-loaded. When MS creates a new site, it grabs the template and creates the new site using the template. However, I need to be able to modify this content across all sites. We will have approximately 50 pages that need to be "shared" throughout all these sites, and if I need to make a change, I need to change across the board. I have tried using this               <?php switch_to_blog(1); ?>     Some code that displays the menu of the Main Blog     <?php restore_current_blog(); ?>      But that will link everything to the main site (which defeats the purpose of paying to have the content branded as your own). I have found plugins that allow you to broadcast posts to all your sites, but this is content that will be preloaded. With all of that said, I am hoping someone around here has done this before and is willing to share some expertise on the matter. Thanks for taking a look at this! * * * ## **EDIT #1** I've done my research through the WordPress support forums as well as here at StackExchange. Is there a way to share content amongst wordpress sites :: This option doesn't really work for me - I have to be able to charge for users to set up their new sites as well as give them the option to add their domain name to their site, which is why Multisite is the way I believe I need to go. Re-Blogging - WP MS Support Forum :: This is what I have found the most of - ways to re-blog content across all platforms. If I needed to shoot out posts to everyone, that would be great. However, this is not what I would like to accomplish. Exactly what I am looking for :: But sadly there isn't an answer. I did a search through WordPress Answers of variations of "multisite content share" and found nothing (other than #3) that pertained to my topic (or what I am looking for in general) * * * ## **EDIT #2** So, after doing some more research yesterday, I found ThreeWP Broadcast. It happens to do quite a lot of what is actually needed, but hid itself during my first few days of research. It allows you to broadcast pages throughout all subsites as well as send out updates to those pages as well. Awesome! So, a new question arises. My client doesn't want the end users editing their content (copyright and legal reasons). So, I wrote some code that automatically appends some JS to the top of the Edit Page in the backend:               function hidePublishingNow() {     global $blog_id, $wpdb;     $prefix = "ssr_";               if(is_super_admin()) {}     else {                        $page = $_GET['post'];         $pageFound = false;                   if($page > 0 && isset($blog_id)) {             $sql = "SELECT * FROM ssr__3wp_broadcast_broadcastdata WHERE blog_id = $blog_id";             $results = $wpdb->get_results($sql, "ARRAY_A");                  foreach($results as $r) {                 if($r['post_id'] == $page) { $pageFound = true; }                 else {}             }                  if($pageFound == true) {                 wp_enqueue_script(                     'hide-publishing',                     get_template_directory_uri() . '/js/removePublishing.js',                     array('jquery')                 );             }         } else {}     }      } add_action('admin_head', 'hidePublishingNow'); Basically, when the **post.php** is loaded within the admin panel, it checks to see if the current page being edited is a page that has been connected via Broadcasting. If it has been connected, the JS is loaded and removes all elements to that page and replaces it with a warning. The end user will never see the content in the editor or be able to Update the page. That is working well. If this is what I have to go off of, that's great - it's the best solution I have found yet. What I would **love** to do would be to take control of the main **wp-admin/edit.php?post_type=page** page (this is where the admin panel lists out all the pages available for editing). It would be great to intercept a WP action when it is making that list and strip out specific pages while it is creating that list. Still doing research on it to see if that is even possible. I just wanted to update my progress on here in case anyone has a word of advice, or down the road if someone else is running into this same issue. * * *


How to add Custom Fields to Settings in Widget Options for all Registered Widgets?

I want to add input box in the custom form when we click for Widget Settings. Really like to have this additional text box in all widgets be Custom Made or the default ones. I'll be needing help in adding new configurable inputbox in Wordpress widget for all widget registered with Theme. Your inputs/suggestions awaited, Thanks.


Applying filters to the_content() to separate content if any `add_shortcode()` is found?

I don't even know if this possible, with `array_map` or `str_replace`, but the idea is the follow: This function gets the content and before is sent out, `clean_custom_content`, there is where i cant figure out how to procede.. so lets assume that we have all the content, this content it will be wrapped in a `section` but each time there is a short code`[]` this needs to be close and when the content of the short code has been outputted. them open a new `section` and continue with the content from that page. make sense? any ideas or help it will be great .. thanks               function get_custom_content( $more_link_text = null, $strip_teaser = false) {         $content = get_the_content( $more_link_text, $strip_teaser );         $content = apply_filters( 'the_content', $content );         $content = str_replace( ']]>', ']]>', $content );         $final_cotent = clean_custom_content($content);         echo $final_cotent;     }      **clean_custom_content()::**               function clean_custom_content($content){         if(do_clean_shorcode('someshorty')){              $content = "<section>".$content.'</section>';          return $content;         }         return null;     }


How to make a WP_Query search with custom post types?

I've registered a custom post type called "node". When I create a basic WP_Query to get posts of that type, it works just fine. Example:               $args = array(       'post_status' => 'publish',     'post_type' => 'node');          $query = new WP_Query($args);             This will get all published posts of type "node". However, as soon as I combine this with a search, nothing is returned. Example:               $args = array(       'post_status' => 'publish',     'post_type' => 'node',     's' => 'My search term');          $query = new WP_Query($args);      This will get nothing, although it should get several posts of type 'node' that contain 'My search term'. As far as I can see, the post types are automatically set to "post" and "page" as soon as I include the "s" parameter in $args. If I print out a var_dump of $query, it shows the following: Without "s":               object(WP_Query)       public 'query' =>          array (size=2)           'post_status' => string 'publish' (length=7)           'post_type' => string 'node' (length=4)       public 'query_vars' =>          array (size=63)           'post_status' => string 'publish' (length=7)           'post_type' => string 'node' (length=4)     ...      With "s":               object(WP_Query)       public 'query' =>          array (size=2)           'post_status' => string 'publish' (length=7)           's' => string 'My search term' (length=14)           'post_type' => string 'node' (length=4)       public 'query_vars' =>          array (size=66)           'post_status' => string 'publish' (length=7)           's' => string 'My search term' (length=14)           'post_type' =>              array (size=2)               0 => string 'post' (length=4)               1 => string 'page' (length=4)     ...      So Wordpress seems to override the post types as soon as a search is involved. How can I fix that?


Thumbnail with different sizes

I want make all my blog thumbs the size of 227x133. I need images width have 100% (for responsive design). Some images have width greater than the other and vice versa. I'm using this code to show the thumbs of my blog:               / / Post thumbnails sizes     add_theme_support ('post-thumbnails');     add_image_size ('blog-page', 9999, 545, true);      The problem is that the images are not the same size as each other: How is: http://img834.imageshack.us/img834/1856/77751386.png How I want: http://img17.imageshack.us/img17/5461/68767097.png What's wrong?


Importing csv file

I'm using the CSV Importer plugin developed by dvkob. It works fine, may be because I upload only few posts each time (about 50). What I need to know now, is how to add the meta data meta_value and meta_key. They should be inserted in the postmeta table. I'm a newbie in coding. When importing directly via php-myadmin, I get a syntax error message. I suppose it depends on wrong sequence of fields. Anyway, before wasting time shuffling fields and columns, can anybody help me? Which tool do I need? How do I format the csv file correctly? Thanks, Patrick


If search matches taxonomy

Is it possible to redirect the user to the taxonomy page IF the search input matches the taxonomy name exactly? For instance i have a taxonomy called "Actors". If someone put into the search field "Tom Hanks" instead of going to the regular search page, it would redirect them to the taxonomy page for Tom hanks.


Multi-site, different dashboard

I'm looking into using Wordpress Multi-site to have a three separate wordpress sites on one installation of Wordpress. I have the Mulit-site set up and I can add sites but I have one admin log in to the multi site Dashboard showing all the sites. Is it possible to have separate logins that login into the separate sites. So if I have a cars website it would have it's own dashboard that the cars- admin could log into but wouldn't be able to see the multi-site dashboard.


Migrating Wordpress users into Disqus

I'm thinking of migrating my comment system from Wordpress to Disqus. I'm pretty satisfied with options it offers, but I have one problem: I have few hundred registrated users on my Wordpress instalation, those accounts were used for commenting. Can I import my Wordpress users so they don't have to go through registration once again? But still retain Disqus login options for those who have account there? edit: So, basically, can user just log into his WP account and post on Disqus comment system?


Can you make a custom metabox field be required to save a new post?

I am working on a custom post type, I have removed all the standard wordpress form items and started from scratch with custom meta boxes, except the title field. In my situation, it is really important that some of the custom meta dropdown selections be selected. Is there an easy solution to make it where they must select some items before they can post the item? I assume javascript would be the easiaest solution but it would be nice to let the user know what is going on, like highlight the box if they try to post and it isn't selected yet, another issue is with a drop down menu, there is by default a value selected already even if they did not pick one


How can i put "posted x minutes ago on my posts?

wordpress by default writes the the date on posts, but how can I transform it to : "x" time ago ?? like 3 days ago, or 5 minutes ago ??


How to use wp_enqueue_style() and wp_enqueue_script() only when needed?

My plugin uses wp_enqueue_style() and wp_enqueue_script() to load resources, but I have kept in mind not to degrade the performance for the user and only load these when the current set of posts contain the shortcode for my plugin. I do this by using:               add_filter('the_posts', 'CrayonWP::the_posts');      the_posts is called before wp_head, but it is also called a few times afterwards (probably for recent posts in the widgets etc). The problem here is that when I am searching the post contents for my shortcode and signalling the enqueuing process, there are times when:   * the_post is called before wp_head (what I want)   * but that set of posts does not have my shortcode and I don't enqueue.   * later on, another call to the_posts tries to enqueue but it's too late. Is there a definite way to check what will appear on a page before wp_head is called so that I can be confident that I will enqueue only when needed but not miss the opportunity? **EDIT:** Great article: http://beerpla.net/2010/01/13/wordpress-plugin-development-how- to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/ But it doesn't take into account multiple calls to the_posts in a single page request :( **EDIT 2:** What I've tried is to use:               add_action('wp', 'CrayonWP::queue');      Since the `wp` action is only used once right after the request is finalised. And inside this function:               global $wp_query;     $posts = $wp_query->posts;      I'm not sure how the $wp_query variable changes over the loop however. If the_posts filter is being called again and again, would it imply the original query may be changing as the widgets send across their own requests? Obviously I don't really want to check for shortcodes in the posts of "recent posts", since they may not be displaying on the page at the moment. So will using the `wp` action hook instead of `the_posts` filter contain the posts requested for that given page, whether it were a single or the home page?


Using 'jQuery menu aim' for WordPress (Genesis) drop down menu

For this site I want to build a better drop down menu – under 'Data' on the top left – to access the site's content. The website is built using the Genesis theme. I would like to use Ben Kamens 'jQuery menu aim' for that. It is explained nicely in an article by him. And it is all stored on his Github account. On jqueryscript net you find an example of how the menu looks like. And Mike Voermans showed how to use it in the online IDE codepen here: http://codepen.io/mikevoermans/pen/EtKxp Can someone point me in the right direction and show me how to use Ben Kamens (or Mike Voermans) code to use that for my website?


Error in php code

I was following the Book building wordpress theme from scratch. An options page is created through this method in the wordpress admin panel . There is an error present due to which nothing appears inside it. Firstly this is added to the **functions.php** of WordPress:               <?php require_once('theme-options.php'); ?>      Secondly **theme-options.php** is created which contains this:               <?php      // create custom plugin settings menu      add_action('admin_menu', 'director_create_menu');      function director_create_menu() {           //create new submenu      add_submenu_page( 'themes.php', 'Director Theme Options',       'Director Options', 'administrator', __FILE__,       'wptuts_landing_settings_page');           //call register settings function      add_action( 'admin_init', 'director_register_settings' );      }       function director_register_settings() {       //register our settings       register_setting( 'director-settings-group', 'director_facebook' );       register_setting( 'director-settings-group', 'director_twitter' );       register_setting( 'director-settings-group', 'director_rss' );       register_setting( 'director-settings-group', 'director_logo' );       register_setting( 'director-settings-group', 'director_analytics' );       }       function director_settings_page() {       ?>

Director Theme Settings
            <form id="landingOptions" method="post" action="options.php">       <?php settings_fields( 'director-settings-group' ); ?>

       Logo:	                  <input type="text" name="director_logo" value="<?php print get_option('director_logo'); ?>"      />

       Facebook Link:	                <input type="text" name="director_facebook"        value="<?php print get_option('director_facebook');        ?>" />

        Twitter Link:	                    <input type="text" name="director_twitter" value="<?php print get_option('director_twitter'); ?>" />

         Display RSS Icon:	                    <input type="checkbox" name="director_rss" <?php        if(get_option('director_rss') == true){ print         "checked"; } ?> />

         Google Analytics Code:	                    <textarea name="director_analytics"><?php print        get_option('director_analytics'); ?></textarea>

        <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
           </form>
      The director options page is created however there is nothing inside it. The page should show up like this:![enter image description here](http://i.stack.imgur.com/r56XW.png) However the page is like this : ![enter image description here](http://i.stack.imgur.com/Dxh9u.png) Could you please tell me the problem and a fix to it?


Assign parent category to all posts that are already assigned to child category

All my website's posts are assigned to subcategories, but not to their parent categories too: ![enter image description here](http://i.stack.imgur.com/DbcCB.jpg) Is there someway that I could massively assign posts to their parent categories too? ![enter image description here](http://i.stack.imgur.com/DRDdk.jpg) My website has more than 3k posts, so I need to find a quick way to do this. I didn't find any plugin that could help me. Any suggestions please?


TinyMCE buttons not appearing in Widget

I have a widget which uses Black Studio TinyMCE. When I click Visual I don't get any menu items. Looking at the Firebug console I have a jQuery error:               tinyMCE.get(...) is null      However, replacing the theme and disabling all plugins does not fix the problem. Any suggestions?


Get custom field from other post in carousel

Im using a plugin called wp carousel to display custom post types in a carousel in the footer in the singular view of posts. By default the plugin gets the featured image and the title of the post, but i want to add a custom field (plain text) I've added to the custom post type through ACF. I've tried adding this to `plugins/wp-carousel/themes/default/theme- jcarousel.php`               <?php global $post;     $sidans_id = $post->post_id;     $hamta_kund = get_field('kund');     echo $hamta_kund;     ?>      on line 192 (right after the code that gets the `title`. What this does is get the currently viewed posts' custom field, I want to get the custom field that is associated with each post in the carousel. So every item in the carousel gets the same value (the value from the one im currently viewing). Do anyone know what im doing wrong? This is some documentation from the plugin-author. http://sumolari.com/proyecto/wp-carousel/wp-carousel-documentacion-docs/ I've tried the support forum but no answer and im running out of time with the client.


Add CPT values to Database

I am not sure if this is something easy. I have a plugin with all the functionality needed for a custom post type: Filters, navegation... I need to create a lot of posts (with taxonomies) of this CPT (a lot of work is needed to create it properly). So I would like to add this custom posts only once and not each time I want to take advantage of my plugin in other websites... What is the best way to achieve this? Am I supposed to make some sort of exportation-importation each time? Should I take advantage of wp_insert_post and hardcode the content of the posts? Apologies for my english, I do not know if I have explained myself... Thanks¡¡


my index does not show the slider in start

My slider is not show in the start, but when we go to other pages and return it starts working? and other pages are normal. Also in all browser my nav menue works but in mobiles browsers is not inline. and is asking for attribute "alt" in valdity.                                  <div class="dwuserEasyRotator" style="width: 968px; height: 250px; position:relative; text-align: left;" data-erconfig="{autoplayEnabled:true, lpp:'102-105-108-101-58-47-47-47-67-58-47-85-115-101-114-115-47-72-37-50-54-77-47-68-111-99-117-109-101-110-116-115-47-69-97-115-121-82-111-116-97-116-111-114-80-114-101-118-105-101-119-47-112-114-101-118-105-101-119-95-115-119-102-115-47', wv:1, autoplayDelay:3000, autoplayStopOnInteraction:false, autoplayPauseOnHover:false}" data-ername="NMO" data-ertid="{yjk5r3ym537786896430731}">

 This jQuery slider was created with the free EasyRotator software from DWUser.com.

              Use WordPress? The free EasyRotator for WordPress plugin lets you create beautiful WordPress sliders in seconds.

              OK
                          Rotator powered by EasyRotator, a free and easy jQuery slider builder from DWUser.com.  Please enable JavaScript to view.

              Thanks, Ray


How to connect rating to individual comments?

I have managed to make my own custom comment rating system - that was working fine until now. I got an idea: why not add star rating to individual comments? I thought it would be easy as I have already added a custom rating field in comment - through filter that is ..               add_action( 'comment_form_logged_in_after', 'additional_fields' );     add_action( 'comment_form_after_fields', 'additional_fields' );          function additional_fields ($below) {         $ratsec = '
'.         ''. __('Rating') . '*         ';                  //Current rating scale is 1 to 5. If you want the scale to be 1 to 10, then set the value of $i to 10.             for( $i=1; $i <= 5; $i++ )             $ratsec .= '<input type="radio" name="rating" id="rating" value="'. $i .'"/>'. $i .'';              $ratsec .= '
';     $below = $below .$ratsec;     return $below;     }      But when I change things and add this filter               add_filter( 'comment_text', 'additional_fields' );      it starts showing the radio button in every comment just below the user text - but how to submit them? As along with comment you have submit button ? My first Question is: How I can make the rating submit ? My Second Question is: If I vote 3 star for "comment number one" will it affect all the comments or just the one I voted? I am confused how to make connection between them. I was using comment meta data to save the data that was ...                    add_action( 'comment_post', 'save_comment_meta_data' );          function save_comment_meta_data( $comment_id ) {        if ( ( isset( $_POST['rating'] ) ) && ( $_POST['rating'] != '') )        $rating = wp_filter_nohtml_kses($_POST['rating']);        add_comment_meta( $comment_id, 'rating', $rating );          }      Now the Code is completely changed How will I save the data in comment meta data to make it show on the front end ? What Modifications are required in the above action ? Plus now using the perfect method explained below by @s_ha_dum -- How will I store this data according to comment id ?


Why my theme option not working?

I am looking for the bugs about an hour but i can't find anything. Can you look and say why my theme option is not working? **Problem:** The theme option not saving. Even the default option is also blank. I checked the value via php my admin. Check the code in pastebin. And also how i can debug this kinds of problem? http://pastebin.com/TPV5YvD9 Thanks in advance.


Where to call my pagination function?

I have just been following this tutorial - http://www.lateralcode.com/wordpress-pagination/ I have written that function in my functions.php file and taken numerous notes on how it works. The problem now is I just don't know what to do with it to get it working. I want it running on my search results and my in a loop on my blog page. Any ideas? I'm trying to learn this rather that use a plugin.... This is my code from my loop over ride file - loop-search.php
Results for: "<?php echo get_search_query(); ?>"
     <?php if(have_posts()) { while(have_posts()) { the_post();?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
     <?php the_excerpt(); ?>     <?php }}?>      Thanks.


WordPress Plugin as 'Library' From Abstract Application?

Here is my thought, and I could be digging myself a huge hole. That's why I'm here ;) I am looking to develop a complex application but I want this application to run both as a standalone script as a wordpress plugin. Later I may develop into a Joomla plugin and so on. My thought is I develop an abstract custom framework and then implement the custom functionality via extending this framework. Does that make sense? So say `WP_Plugin` extends `My_Engine`, and then that plugin class will act as factory to manage the custom functionality in the WordPress `/lib/wordpress/` directory. I really don't want to have to repeat myself and I would definitely be producing multiple versions of the app. Any thoughts?


Custom Admin CSS styles to style media uploader?

Hopefully a simple answer to this. Using the wp custom header feature, the media upload screen shows an extra field: "set as header". I'm trying to make this text bigger as it can easily be missed. Firebug says it has a class of "a.wp-set-header". I can change the font size within firebug and it works, but adding this in my css doesn't do anything - any ideas? Thanks               a.wp-set-header{     font-size:22px !important;     font-weight:bold !important;     }


wp_remote_get vs. fetch_feed ? which is the better for performance?

I m trying **to share my web site contents** for other web sites using by external loop file or rss file. when i asked some questions about `wp_remote_get` function ; @Serkan suggest to me , using `fecth_feed` methot / function etc. (check the question here.)= I really confused , which one i should, which one is better way for high performance, could anyone explain it why ? Thanks.


Loop that displays PARENT PAGE & CHILD PAGE & outputs GRANDCHILD PAGE title and content

I've never posted here, but I'm tired of slapping code together. That said, I would be most appreciative if someone could help me with this. I need a page template that:   1. outputs the PARENT PAGEs,    2. the CHILDREN PAGES of that PARENT PAGE,   3. and finally output the titles and content of the GRANDCHILDREN PAGES so I can insert them into a tabbed layout. Here's a diagram The idea is that visitors should be able to get to the content on the GRANDCHILDREN PAGES in two clicks. For the PARENT PAGES, I'm using wp_nav_menu. For the CHILD PAGES, I'm using:                   <?php if ( is_page() ) { ?>         <?php         if($post->post_parent)         $children = wp_list_pages('title_li=&child_of='.$post->post_parent.'&echo=0'); else         $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');         if ($children) { ?>
         <?php echo $children; ?>
         <?php } } ?>      And to output the GRANDCHILDREN PAGES title and content, I'm using some code from the codex: GRANDCHILDREN PAGES
     <?php     $pages = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=desc');     $count = 0;     foreach($pages as $page)     {         $content = $page->post_content;         if(!$content)             continue;         if($count >= 100)             break;         $count++;         $content = apply_filters('the_content', $content);     ?>
     <a data-toggle="tab" href="#<?php echo $count ?>"><?php echo $page->post_title ?>
          <?php } ?>
      GRANDCHILDREN CONTENT
          <?php         $pages = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=desc');         $count = 0;         foreach($pages as $page)         {             $content = $page->post_content;             if(!$content)                 continue;             if($count >= 100)                 break;             $count++;             $content = apply_filters('the_content', $content);         ?>               <div class="tab-pane" id="<?php echo $count ?>">     <?php echo $content ?>
          <?php } ?>
      I am certain there is a more efficient way to do without a gazillion loops and queries. Anyone have any ideas? I'm want to learn, and put code an elegant solution. Thanks.


Function Error after WP Upgrade to 3.9.1

Following the update to WP 3.9.1 and MySQL I am getting the following error on a site: > Strict Standards: call_user_func_array() expects parameter 1 to be a valid > callback, non-static method dc_jqverticalmegamenu::header() should not be > called statically in /home/xyzsite/public_html/wp-includes/plugin.php on > line 470 The reference is to this plugin. A quick search shows about 82 pages out there with the same error, but no reference to a solution. I would appreciate some guidance on resolving this.


How to add a javascript snippet to the footer that requires jQuery

I know I can add a script file to the footer of wordpress that requires jquery using this code:               <?php     function my_scripts_method() {        // register your script location, dependencies and version        wp_register_script('custom_script',            get_template_directory_uri() . '/js/custom_script.js',            array('jquery'),            '1.0',            true);        // enqueue the script        wp_enqueue_script('custom_script');     }     add_action('wp_enqueue_scripts', 'my_scripts_method');     ?>      But what if I want to add just a normal snippet of jquery inline, not a file. How can this be done. # Edit I know I can use this script to add something to the footer:               <?php     function myscript() {     ?>     <script type="text/javascript">      // This depends on jquery     </script>     <?php     }     add_action('wp_footer', 'myscript');      But how do I specify the script that is used **requires jquery** to run.


How to change the layout of a product page

I'm using WP-ECommerce with the genesis framework. I can set the layout of the Products page to single column, but when I select a single product it uses the default layout and not the products layout. I'm not sure where to even begin. Is this a configuration issue with WP-EC or with the genesis framework.


Allowing users to Sign-up > Login > Post articles that need approval

I need your advice! I have a small hobby website, it's a small music magazine, with all the content published by me. It's setup with an open source Wordpress Theme with my custom graphics and CSS. I want to turn it into something else now, and allow users to have the ability to be able to sign-up > login > and post articles and any pretty much any post content they'd like. But I'd like it to be sent to my email or something for me to have to 'approve it' before it's published? Whats a good approach of taking a standard Wordpress small magazine site, and creating allowing these functionalities? Is this a page or two of gluing PHP snippets together from around the web, could this be handled with a good plugin or two - or is it something deeper? Thanks as always!


Multiple custom post type queries causing wrong post types to be grabbed in taxonomy + single templates?

Ok, this may be a bit confusing but here goes... Im working with several custom queries on the same page throughout my site. Some queries are grabbing regular post data, others are fetching CPTs depending on what page your on, namely the store section for example... I had everything working perfect until I decided to try and make things easier for the client by converting an existing image gallery fader/slider into an "additional CPT" so that they could just add the images on their own when they want without having to continue requesting updates for this. So in order, let me explain whats going on in the site (I'll also include a simple graphic to outline my situation):   * I have a newly added CPT called featimggal to allow my clients to post their own images to the slider at the top of every page.   * I have a CPT for my store section called product. I use a couple custom queries to grab different products based on a custom taxonomy slug and list them out on the landing page for the store.    * I use a taxonomy template to show all product CPTs in an archive format when viewing items via taxonomy from links in the sidebar.   * Lastly, I use a single-product.php template to display products by themselves.  ............. After adding a new CPT called featimggal with a custom query that comes before the product CPT's on the page everything still functions as expected when visiting the store.php page, however once you click an individual product to view it from the single-product.php template the cpt product does not appear there anymore and instead "all" the CPTs for the image gallery show up instead, its the strangest thing. ## Examples: **Store Page - Featured Image Gallery CPT - featured_images.php**               <?php $wp_query = new WP_Query(array('post_type' => 'featimggal')); ?>     <?php while ($wp_query->have_posts() ) : $wp_query->the_post(); ?>          <?php the_post_thumbnail('feat-img-gal', array('class' => 'featured_image_gallery', 'alt' => '', 'title' => '')); ?>          <?php endwhile; ?>     <?php wp_reset_query(); ?>      **Store Page - Product CPT - store.php**               <?php $wp_query = new WP_Query(array('post_type' => 'product', 'productcategory' => 'epr-apparel', 'posts_per_page' => 6, 'orderby' => 'rand', 'paged' => $paged )); ?>     <?php while ($wp_query->have_posts() ) : $wp_query->the_post(); ?>     // Do Stuff     <?php endwhile; ?>     <?php wp_reset_query(); ?>          <?php $wp_query = new WP_Query(array('post_type' => 'product', 'productcategory' => 'epr-accessories', 'posts_per_page' => 6, 'orderby' => 'rand', 'paged' => $paged )); ?>     <?php while ($wp_query->have_posts() ) : $wp_query->the_post(); ?>     // Do Stuff     <?php endwhile; ?>     <?php wp_reset_query(); ?>      **Store Page - Footer Query - footer.php**               <?php $wp_query = new WP_Query('category_name=blog&posts_per_page=1'); ?>     <?php while ($wp_query->have_posts() ) : $wp_query->the_post(); ?>      // Do Stuff     <?php endwhile; ?>      ![store.php](http://i.stack.imgur.com/UfUdr.jpg) ![taxonomy.php](http://i.stack.imgur.com/Rtv5t.jpg) ![single- product.php](http://i.stack.imgur.com/xUeMN.jpg)


How to sell an album for download

I'm trying to deliver a set of nine audio files, as part of a single purchase for download. My first thought was to make an RSS file as the actual purchased item and then the customer would be able to download the nine actual files using iTunes from that feed. I'm not convinced that this is the best approach. I have tried to deliver an RSS file but the file simply arrives as an XML document in the download folder of the users browser. I believe I would need to use itpc:// in the URL, but that doesn't seem to be an option. I'm sure I'm not the first person to try and see a collection of recordings, not unlike selling an album.


Rewrite rules for custom post type

There is a nonhierarchical custom post type "news".               /news/     /news/page/2/     /news/post_slug/      Each post has custom field `"views"`. When someone opens post, field's value increased by one. Would like to sort posts by this custom field, by its value.               /news/     /news/views/ = /news/?sort=views (get posts with custom field "views" and sort asc)     /news/views/page/2/ = /news/?sort=views&page=2 (similar to previous, next page)     /news/post_slug/      Got working `/news/?sort=views`, but this link is not human-like. It should be transformed to `/news/views/` and be able to handle pagination. How can we do this?


echo site_url() returns a different value than what is in the database siteurl field

I have just copied a WordPress site to a different domain, everything on the front-end and admin side displays and works smoothly except I found my category links are linking to the old site domain. ( when echoed from get_category_link($parent->cat_ID) ) The siteurl and home fields in the database are correct (http://subdomain.newdomain.com) However when I echo any of home_url() site_url() or network_site_url() I get http://www.oldsite.com I've tried setting it in both the functions.php file and wp-config.php files, and have checked and re-checked the database field, even switching it away, breaking the site, switching it back to have the same results. What is going on?


What is the right way to clean up $title before wp_insert_post?

I am using a function to insert some post data and i am having problems with the title/title - slug. The title is random selected from an array, some title have `?`, `!` or `.` (dots) I notice `wp_insert_post` doesn't clean up the title so in the title slug (permalink) i see the `?`, `!` or dots. How can i fix this? Any WP built-in function? This is my function               function my_add_post($title, $content){       // Create post object       $title = str_replace('.','',$title);       $title = str_replace('?','',$title);       $my_post = array(         'post_title'    => $title,         'post_content'  => $content,         'post_status'   => 'publish',         'post_author'   => 1,         'post_category' => array(1)       );            // Insert the post into the database       wp_insert_post( $my_post );        }


html id is removed for non admin user?

I have a custom functionality which create a custom post with info entered on a form Part of the post content is a line like `<div id="featuredcocktail">` When I tested it as an admin all worked perfect and the content was created as I wanted, but once I used the form as non-logged user the custom post was created with only `<div>`. When I changed the id to class like `<div class="featuredcocktail">` it worked well for both admin and non-logged user.               $my_post = array(                     'post_title' => $company_field,                     'post_type' => 'bgmp',                                   'post_status' => 'draft',                     'comment_status'  => 'closed',                     'ping_status' => 'closed',                     'post_content' => $content                 );              $id = wp_insert_post( $my_post );         $cont   = '
'. "\r\n";         $cont  .= ''. "\r\n";         wp_update_post( array('ID' => $id, 'post_content' => $cont ) );       Any idea how I can use id?


WordPress Custom Permalink Structure with Custom Post Type and Taxonomies

I searched for a solution everywhere, using plugin and without but I can't reach my goal. I have a Custom Post Type called "services", an associated Custom Taxonomy called "service-categories", and some sub-terms of the same Taxonomy. I want to create a hierarchical permalink structure. I need one of these:   1. /custom-post-type-name/term-name/(subterm-name)/post-name   2. /custom-taxonomy-name/term-name/(subterm-name)/post-name   3. /custom-post-type-name/custom-taxonomy-name/term-name/(subterm-name)/post-name Thanks to all.


How to List Custom Post Type Titles Based on Theirs Taxonomy Terms Inside a Nested Loop

I am trying to list at least the last three updated Custom Post Type's title lets call it "Cast" inside another loop which is listed based on the Taxonomy terms called "Actress" I used the following loop to get the list of my tax terms:               $taxonomy = 'actress';     $term_args=array(       'hide_empty' => false,       'orderby' => 'name',       'order' => 'ASC'     );     $tax_terms = get_terms($taxonomy,$term_args);     ?>
     <?php     foreach ($tax_terms as $tax_term) {     echo '
' . $tax_term->name.'
';     }     ?>
     <?php       well this helped me to list the terms but I am really confused how to add the list of each terms associated custom post? to be more clear I illustrate following image,hopefully this will give you an idea what I am seeking for? Can you please help me to figure out how to do this? Thanks **Update**               <?php          get_header();     //list terms in a given taxonomy     $taxonomy = 'actress';     $term_args=array(       'hide_empty' => false,       'orderby' => 'name',       'order' => 'ASC'     );     $tax_terms = get_terms($taxonomy,$term_args);     ?>
     <?php     foreach ($tax_terms as $tax_term) {     $loop = new WP_Query(                       array(                         'post_type' => 'cast',                         'tax_query' => array(                             array(                                 'taxonomy' => 'actress',                                 'field'=>'id',                                  'terms' => $tax_term->ID                                )                         ),                         'posts_per_page' => 3                       )                  );     while ( $loop->have_posts() ) {             $loop->the_post();             echo '
' . get_the_title() . '
';         }          }          ?>
     <?php get_footer(); ?>


How to remove uncategorised posts from WordPress

I am using koresponsive theme. I am displaying name of categories as my menu bar just below my header. Now I need to remove 'Uncategorized' category from displaying it in the menu bar. How can I do it? What is the code.Please help me. Here is my `header.php`. I guess I have to change in `wp_list_categories`. I tried many ways. But it is not working.                   <!DOCTYPE html>         <?php $options = get_option('koresponsive'); ?>        <html class="no-js" <?php language_attributes(); ?>>              <meta charset="<?php bloginfo('charset'); ?>">     <title><?php wp_title(''); ?></title>     <?php kore_meta(); ?>      <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />     <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />     <?php wp_enqueue_script("jquery"); ?>     <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>          <?php kore_head(); ?>     <?php wp_head(); ?>         <?php if (is_front_page()) { ?>            <?php } ?>                   <?php flush(); ?>       <body id ="blog" <?php body_class('main'); ?>>

                      <?php if( is_front_page() || is_home() || is_404() ) { ?>
                             <a href="<?php echo home_url(); ?>"><?php bloginfo( 'name' ); ?>
                   <?php } else { ?>
                             <a href="<?php echo home_url(); ?>"><?php bloginfo( 'name' ); ?>
                   <?php } ?>                   <?php if ( !function_exists('dynamic_sidebar')          || !dynamic_sidebar('Top Widget') ) : ?>             <?php endif; ?>

                                              <?php if ( has_nav_menu( 'primary-menu' ) ) { ?>                             <?php wp_nav_menu(   array( 'theme_location' => 'primary-menu', 'menu_class' => 'menu', 'container' => '' ) ); ?>                         <?php } else { ?>
                                 <?php wp_list_categories('title_li='); ?>
                         <?php } ?>


Hiding posts - WP Hide Post not working

I frequently publish posts that I need to be hidden. They need to be published, so that someone who has their url can go to them, but I don't want them showing up on my homepage, in my recent posts widget, on my blog page, in my categories etc. I know I can normally use the WP Hide Post plugin for this, but somehow that isn't working for my site. When I create a new post and choose all the hide options WP Hide Post offers, the post still shows up on my blog page (which isn't my homepage). I've looked around here and found some similar topics to hide posts using code, but only to hide posts from one location, for example from the recent posts widget or from the homepage or from... I'm searching for a way to hide them from practically everywhere without having to add several lines of code each time I publish a post that needs to be hidden. Would really appreciate it if someone could help me. Bummed that the WP Hide Post plugin doesn't work for me:/ Thanks! PS I'm know publishing those posts as pages using WP Hide Post to hide the pages, this works, but it clutters up my pages list.


tags & categories with custom post type

What do i need to do to enable categories and tags for a custom post type i´ve made? I use the following code:               /* Create custom post type: "Tilbud" */     register_post_type('tilbud', array(     'label' => __('Tilbud'),     'singular_label' => __('Tilbud'),     'public' => true,     'show_ui' => true,     'capability_type' => 'post',     'hierarchical' => false,     'rewrite' => false,     'query_var' => false,     'supports' => array('title')     ));


How to prevent plugins from loading jQuery

I recently downloaded a free plugin from wordpress.I want to remove the plugin from loading jQuery because you experts know that it is already loading from wordpress header.php file. The plugin is testimonial-slider How to edit the plugin to prevent it from loading jQuery? I tried other methods like enqueue scrips, but cannot find success.Now I'm planning to edit this plugin, can anyone guide me? thanks


Filter custom post types by custom field using AJAX

I have a few custom post types (books, films etc) created with WP-Types. I then have a custom field called Genre, created with ACF. If a user selects "Books" from the dropdown on the frontpage, he is taking to an archive page displaying all the books available. What I would like now is to create a dropdown on that archive page, that lists all the genres available in "Books". When the user selects a genre from that dropdown, the posts must be filtered with AJAX. I have been trying for hours with no success to get this filtering plugin working which seems to do exactly what I need: > http://luis-almeida.github.io/filtrify/ I understand that something like this is quite difficult to achieve, but hoping someone on here knows Wordpress enough to help me achieve this. Thanks in advance!


Can a Wordpress blog be entirely hosted on a CDN if cached?

I am developing a Wordpress blog for a client who believes that more than 1m pageviews will be served every month. Unfortunately his server resources are very limited so I was thinking of hosting the blog - as a static website - on a CDN. My client intends to publish posts in batches, morning, afternoon and evening so I was thinking of doing the below:   1. I install the blog on my client's server where my client can manage posts, pages, etc.   2. Whenever a new post is published, I would create a static .html version of the post and upload it to the CDN. I could use W3 Total Cache or WP Super Cache to create the .html. I would then use the CDN's APIs to upload the file.   3. In-between batches, when his server is idle, I will re-create the .html of all old posts for areas such as "Latest blog posts", etc.   4. I update the .html of the old posts on the CDN Comments in this blog are closed. Of course when users open the blog at http://www.mydomain.com, this has to be loaded from the CDN(which I believe would be push CDN) and not from the client's server. I don't want my client's server to be accessed in any way(which I believe would be pull CDN) due to the lack of CPU and memory; it will only be used by the client himself to manage the content. Is this something I can achieve? My main concern are permalinks, can a CDN replicate the same permalink structure of my blog?


Wordpress multisite change language

I want to change site language through cookies. As I have multisite, so define('WPLANG') is not working in wp-config.php. So I added hook to filter "locale". But still not working... What to do ? p.s I have translated .po & .mo files in "wp-content/languages/" folder. The code in functions.php               add_filter( 'locale', 'set_my_locale', 9999 );     function set_my_locale( $lang ){     $lang = "fr_FR";     return $lang;     }      Any ideas ? **UPDATE:** Created as a plugin and all worked like a charm.


Safe way to allow sample HTML code in comments?

I see that post comments do not allow short snippets of sample HTML code to be entered for safety reasons. But if you have a blog where you expect to have conversations about code, how do you handle this? Is there a safe way to allow code in comments so that it can be discussed? Thanks.


Sort Posts by custom fields inside a table

I am trying to build a table in each category pages where all the posts from the category will be displayed and make them sortable by custom fields value. I searched a lot about this and I am not sure whats the best way to do this. I have tried this method which has several flaws. this is what I have in category.php

Event Name	     <a href="<?php $category_id = get_query_var('cat'); echo get_category_link( $category_id );?>&last_updated">Updated	     <a href="<?php $category_id = get_query_var('cat'); echo get_category_link( $category_id );?>&published">Published	     <a href="<?php $category_id = get_query_var('cat'); echo get_category_link( $category_id );?>&votes_desc">Votes	     <a href="<?php $category_id = get_query_var('cat'); echo get_category_link( $category_id );?>&ratings_desc">Rating
              <?php if(have_posts()): while(have_posts()): php the_post(); ?>            <tr <?php post_class(); ?> id="post-<?php the_ID(); ?>">                <a href="<?php the_permalink();?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>
	               <?php the_field('last_updated'); ?> <?php $updtd = get_field('last_updated'); echo time_ago($updtd); ?>	               <?php the_field('published'); ?> <?php $pub = get_field('published'); echo time_ago($pub); ?>	                <?php the_field('votes'); ?>	                <?php the_field('ratings'); ?>
         <?php endwhile ?>               <?php endif ?>
      and this is what I have in my functions.php:               add_action('pre_get_posts', 'wpd_pre_get_posts');          function wpd_pre_get_posts( $query )     {     // validate     if( is_admin() )     {         return;     }          // get original meta query     $meta_query = $query->get('meta_query');          if(is_category()){                  if( isset($_GET['votes_desc']) )         {         $query->set('orderby', 'meta_value_num');           $query->set('meta_key', 'votes');           $query->set('order', 'DESC');          }              if( isset($_GET['ratings_desc']) )         {         $query->set('orderby', 'meta_value_num');           $query->set('meta_key', 'ratings');           $query->set('order', 'DESC');          }              if( isset($_GET['last_updated']) )         {         $query->set('orderby', 'meta_value_num');           $query->set('meta_key', 'last_updated');           $query->set('order', 'DESC');          }              if( isset($_GET['published']) )         {         $query->set('orderby', 'meta_value_num');           $query->set('meta_key', 'published');           $query->set('order', 'DESC');          }          // always return     return;          }      } **How it works:** When you go to yoursite.com/cat=3&published the table is sroted by the latest published posts. **Flaws**   1. The last updated filed is not being sorted. although its as same as the published field, when clicked, the posts are not sorted by latest dates.   2. you cannot sort the table by multiple custom fields value.. If anyone can help with this, I will be grateful. I know I am doing a lot of things wrong. :( Thanks


How to remove categories filter from wordpress admin?

I removed the categories column from "All posts" page by applying this code.               add_filter("manage_edit-post_columns", "my_post_edit_columns");     function my_post_edit_columns($columns){       unset($columns['categories']);       return $columns;     }      This code removed categories column. But still i see the categories filter in the top. Is there a way to remove it other than using CSS to hide it? Thanks


Simplest way to create two private sections each with a common account

My client's site requires two separate, private sections. For each of them, there is one common login/password pair (or possibly one password without login) to be used. The client probably wants this information to be manageable in dashboard. Since for each page the credentials are the same for everybody with access, I guess working with WP users and WP native private functionality is unnecessarily complicated. But then what would be the easiest way to implement this?


queries inside of a class

I'm building a plugin and I'm quite new to wordpress I have a class what has couple of methods what should execute database queries. The class look as it follows               class MyClass{                  private $wpdb;                  function __construct(){                 global $wpdb;                  }                  function query(){             $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->wp_competitors                                  ( id, field_key, field_value ) VALUES ( %d, %s, %s )",1,                                  $field_key, $field_value) );                  }               }      I would like to be able to use inside of my class wordpress native database class, how to do this?


Specific Post Format Image Thumbnail

I have a post thumbnail set for standard posts (when an image is featured) but for image format posts I'd like to have a separate, dynamically resizing (i.e. image resizing in the functions php via add_image_size), thumbnail. I found this snippet from the codex:               if ( has_post_format( 'video' )) {     echo 'this is the video format';     }      I've tried using it on my index.php with 0 success. Am I on the right track or should I be doing something completely different?


I want my yearly archives to show a list of all posts

The default behaviour for monthly and yearly archives is to get a set of posts for that period (limited by the max-posts-per-page setting) and show them in full, with paging. I would like a different behaviour for yearly archives (it would seem more natural in most blogs to me, BTW) : show a list of all posts for that year -like an index-, perhaps with excerpts. Which would be the recommended way?


Get the bare URL for an attachment

I'm trying to get the link to the thumbnail size of an attachment image. I tried this:               wp_get_attachment_link( $img_id, 'thumbnail' );      but it returns the actual HTML for the image wrapped in a link. I want just the bare URL directly to that size image. Does Wordpress have a different function I should be using, or do I have to extract it from the HTML returned by `wp_get_attachment_link`?


Disable single post page

Is there a way to disable single post page, for example when some tries to go to single post page to show 404 page.


How to show a random selection of posts from the search

I want to show only a random selected number of search results from a search. Its different to the random output from a category. Any Ideas how to do this? it is for a big database to give every post of the search result the chance to be viewed.


prepare() not working

When I do this:               $transients = $wpdb->get_col(         "         SELECT     option_name         FROM       $wpdb->options         WHERE      option_name         LIKE       '_transient_wb_tt_%'         "     );      It works fine, but when I use prepare like so:               $transients = $wpdb->get_col( $wpdb->prepare(         "         SELECT     option_name         FROM       %s         WHERE      option_name         LIKE       '_transient_wb_tt_%'         ",         $wpdb->options     ) );      It doesn't work, what am I doing wrong here?