Show Metabox Images in slideshow instead of static

I am using META BOX plugin from here http://wordpress.org/support/plugin/meta- box. The images which i add in pluupload uploader , these images show up as static images. What i need is to show them in a slideshow rather than just static images. How can i do this, Please help ? Here is the code i use to call the images added via pluupload metabox in the post.                  <?php global $wpdb;     $images = get_post_meta( get_the_ID(), 'rws_plupload', false );     $images = implode( ',' , $images );     // Re-arrange images with 'menu_order'     $images = $wpdb->get_col( "         SELECT ID FROM {$wpdb->posts}         WHERE post_type = 'attachment'         AND ID in ({$images})         ORDER BY menu_order ASC     " );     foreach ( $images as $att )     {         // Get image's source based on size, can be 'thumbnail', 'medium', 'large', 'full' or registed post thumbnails sizes         $src = wp_get_attachment_image_src( $att, 'full' );         $src = $src[0];         // Show image         echo "<img src='{$src}' />";     }         ?>


custom post type, single category page and search form

i have created a custom post type called directory, on my directory page which lists my directories i have a sidebar which shows the categories and how many are in a category but when i click one of them to go to the category it goes to category.php and says there was no results when there should be. i have tried using category-directory.php , directory-category.php , archive- directory.php , taxonomy-directory.php but none of these work how could i make this work? here is my directory.php file

                                     <?php                                     $subcategories = get_categories('&child_of=98&hide_empty&orderby=ASC&pad_counts=1');                                      echo '
';                                     ?>
Directories
<?php                                     foreach ($subcategories as $subcategory) {                                       echo sprintf('
%s
', get_category_link($subcategory->term_id), apply_filters('get_term', $subcategory->name) . " ( " . $subcategory->category_count . " ) "   );                                     }                                     echo '
';                                     ?>

                                     <?php                                     the_title();                                     ?>

                                     <?php query_posts(array( 'post_type' => 'directory', 'posts_per_page' => '0' ,'orderby' => 'date','order' => 'DESC' ) );?>                                                   <?php while (have_posts()) : the_post();?>
                                                 <img src="<?php if(get_field('logo')) {the_field('logo');} else {?><?php bloginfo('template_url'); ?>/images/placeholder.jpg<?php } ;?>" alt="<?php the_title();?>" />                                                 <a href="<?php the_permalink();?>">
<?php the_title();?>
                                                 <a href="<?php the_field('website');?>">
<?php the_field('website');?>

<?php content('30');?>

                                         <?php endwhile;?>                                     <?php wp_reset_query(); ?>

                      <?php include(TEMPLATEPATH . '/footer-page.php'); ?>      Also does anyone know how i could add a search form to search only my custom post type? any help would really be appreciated


Language files in theme subfolder languages - translate files in theme subfolder js

How can I translate a string from a file in the theme subfolder "js" if the language files are in the theme subfolder "languages"? Regards, The_Hegemon


Remove dashboard access but allow ajax file upload

I want to restrict dashboard access for users with a custom user role. The code works fine, and i can perform custom ajax requests successfully, howeverim not able to upload a file using the wp.media uploader. This is my restriction code               add_action('admin_init', 'no_mo_dashboard');     function no_mo_dashboard() {         if (!current_user_can('custom_role') && !(defined('DOING_AJAX') && DOING_AJAX)) {             wp_redirect(home_url());              exit;         }     }      It would seem as if the wp.media uploader is uploading the file via ajax, however the above statement doesn't allow for it (i guess DOING_AJAX isn't set?) Below is my upload code               jQuery(document).ready(function($){              var custom_uploader;              $('#upload_image_button').click(function(e) {                  e.preventDefault();                  //If the uploader object has already been created, reopen the dialog             if (custom_uploader) {                 custom_uploader.open();                 return;             }                  //Extend the wp.media object             custom_uploader = wp.media.frames.file_frame = wp.media({                 title: 'Choose Image',                 button: {                     text: 'Choose Image'                 },                 multiple: false,                 library : {                     type : false,                 },             });                  $this = $(this);             //When a file is selected, grab the URL and set it as the text field's value             custom_uploader.on('select', function() {                 attachment = custom_uploader.state().get('selection').first().toJSON();                 $('.uploaded_image .circle_avatar').css("background-image", "url("+attachment.sizes.apcc_avatar.url+")");                  });                  //Open the uploader dialog             custom_uploader.open();              });               });      Any ideas where i'm going wrong here? Cheers guys! EDIT Interestingly, the following code works               if (!current_user_can('custom_role') && !(defined('DOING_AJAX') && DOING_AJAX) && count($_POST) == 0) {             wp_redirect(home_url());              exit;         }      However i can see the potential security risks here (someone could post a form to an admin page themselves and gain access)


Ajax simple experiment

I want to output the post id. But I am receieving null... In `footer.php`               <script>     jQuery("a.more-link").live('click', function(event) {         event.preventDefault();         jQuery.ajax({             url: '<?php echo admin_url('admin-ajax.php'); ?>',             type: 'POST',             data: {                 'action' : 'do_ajax',                 'post_id' : '<? echo $_REQUEST['post_id'];?>'             },             dataType: "json",             success: function(myResult) {                 alert(myResult);             },             error: function(error) {                 alert(error);             }         });     });     </script>      And in `functions.php`               add_action('wp_ajax_nopriv_do_ajax', 'retrieve_id');     add_action('wp_ajax_do_ajax', 'retrieve_id');          function retrieve_id(){               global $post;         $myPost= $post->ID;         $output =  $myPost;         $output = json_encode($output);         if (is_array($output)) {             print_r($output);         } else {             echo $output;         }         die;     };      Why does it show null?


wp localize script is not working in a custom AJAX request

I am trying to use `wp_localize_script()` to send some php values to a script. The following are the part of the file `inc/show-event.php`.               if( $price ) {         $pricefortwo    = ceil( ( 2 * $price) - ( 0.2 * $price ) );         $savefortwo     = ( 2 * $price) - $pricefortwo;         $priceforthree  = ceil( ( 3 * $price) - ( 0.333 * $price ) );         $saveforthree   = ( 3 * $price) - $priceforthree;         $priceforretake = ceil( 0.5 * $price );         $saveforretake  = $price - $priceforretake;              // Setting the session variables         $_SESSION['price'] = $price;         $_SESSION['price_for_two'] = $pricefortwo;         $_SESSION['price_for_three'] = $priceforthree;         $_SESSION['price_for_retake'] = $priceforretake;              $session_array = array(                     'price'         => $_SESSION['price'],                     'price_for_two'     => $_SESSION['price_for_two'],                     'price_for_three'   => $_SESSION['price_for_three'],                     'price_for_retake'  => $_SESSION['price_for_retake']                 );         wp_localize_script( 'init_show_calendar', 'session_param', $session_array );     }      After this when I try and use the object name `session_param` in `init_show_calendar.js` file it throws a js error saying `session_param` is not defined. but when i use the following code in `functions.php`.               $session_array = array(                     'price'         => $_SESSION['price'],                     'price_for_two'     => $_SESSION['price_for_two'],                     'price_for_three'   => $_SESSION['price_for_three'],                     'price_for_retake'  => $_SESSION['price_for_retake']                 );     wp_localize_script( 'init_show_calendar', 'session_param', $session_array );      it returns me the variable but it doesn't return the latest values, it returns the value stored in a page refresh. FYI: The `show-event.php` is called in a plugin in the following way               add_action('wp_ajax_get_event', array($this, 'render_frontend_modal'));     function render_frontend_modal() {         require_once AEC_PATH . 'inc/show-event.php';     }      Please let me know if you want any more information.


How do I load a CSS style into WordPress admin area only?

I'm trying to load a CSS file for my WordPress post area, but having no luck. I have read over the wp_enqueue_style function and came up with the code below, but it doesn't load up. Is there a tag or character missing from my code. I have a custom write panel when a user post that I want to style with the CSS file. Any help would be great. Here is what I have in my themes `functions.php` file:               function mytheme_add_init() {         $file_dir=get_bloginfo('template_directory');         wp_enqueue_style("functions", $file_dir."/scripts/custom.css", false, "1.0", "all");         wp_enqueue_script("rm_script", $file_dir."/scripts/custom.js", false, "1.0");     }


Twenty ten or Twenty eleven as base for responsive child theme

I'm about to make a new child theme and really would like to learn a bit about making it responsive. The design/changes will be rather small. I've done some child themes for both Twenty ten and Twenty eleven but not sure which one to choose for trying to learn responsive design. You could argue Twenty eleven is the latest but I've read somewhere Twenty ten is better maintained. I know there are many barebones/frameworks, but these two I know quite well. Any thoughts on this?


formatting horizontal and vertical images in Settings?

I have several custom media sizes we always use. vertical: 95x117, 130x160 horizontal: 440x304, 220x152 home: 260x160 Is there anyway to set the thumbnail, medium and large to vertical parameters and horizontal ones? Or is it better to leave the defaults (150x150, 300, 1024) so that I can set the sizes using width and height parameters as needed? Thanks! Donna


inserting a category into post

Can you tell me how can I insert a whole category into the specific post. for example: have 4 posts in a category "zanimljivosti" and I want to put that category to be shown inside another post not as a link but to show all 4 inside that new post. Can I do that?


Infinite counting in Wordpress

I have this function in Wordpress that counts 10 users by default. I would like to change it from showing 10 users to infinite number. There should be no end to counting. How can I do this?               function get_random_followers($userid, $count = 10){          $followers = get_the_author_meta('followers', $userid);          /** if no followers at the moment */     if( !is_array($followers)){         $return = "";     } else {              $flw = array_pick($followers, $count);              $return = '
' . "\n";         foreach( $flw as $folow){                  $return .= "
";                 $return .= '';                     if( get_the_author_meta( 'user_custom_avatar', $folow ) != "" ) {                         $return .= '';                     } else {                         $return .= get_avatar( get_the_author_meta( 'user_email', $folow ), '40' );                     }                 $return .= '';             $return .= "
";              }         $return .= '
' . "\n";     }          echo $return;          }


$GLOBALS['hook_suffix'] variable empty

I'm trying to implement the code to add a custom post status from my plugin, exactly as given in this tutorial: http://jamescollings.co.uk/blog/wordpress- create-custom-post-status/ Now, it isn't working and after some investigation it seems the admin_footer- post.php action isn't firing. The codex page for this action hook states . . . > admin_footer-(hookname) is triggered at the end of the section of a specific > admin page, after `admin_footer` and `admin_print_footer_scripts` actions. > > The hookname part you can get using the variable $GLOBALS['hook_suffix'] . . . but that variable is empty. I've tried directly accessing $hook_suffix with no luck, and printing out the entire $GLOBALS array shows no hook_suffix anywhere. I am very confused. At first I thought maybe it was written for an older version of WP but there's a comment on the blog post from just 3 days ago from someone who seems to have achieved success. I've tried turning off themes and all other plugins, and just have absolutely no idea where to go from here. What could make the $GLOBALS['hook_suffix'] variable, apparently a common enough thing in WP development, simply cease to exist on my site?


re-register custom post type with custom capabilities

I have created custom post type as below.               register_post_type( 'connector',         array(             'labels' => array(                 'name' => __( 'Connectors' ),                 'singular_name' => __( 'Connector' ),                 'all_items' => __( 'All Connectors' ),                 'add_new' => __( 'Add Connector' ),                 'add_new_item' => __( 'Add New Connector' ),                 'edit' => __( 'Edit'),                 'edit_item' => __( 'Edit Connector' ),                 'new_item' => __( 'New Connector'),                 'view' => __( 'View Connector'),                 'view_item' => __( 'View Connector'),                 'search_items' => __( 'Search Connectors'),                 'not_found' => __( 'No Connectors found' ),                 'not_found_in_trash' => __( 'No Connectors found in trash' ),                 'parent' => __( 'Parent Connector')             ),                    'description' => __( 'This is where you can add new Connectors' ),         'public' => true,         'show_ui' => true,         'capability_type' => 'page',                 'publicly_queryable' => true,         'exclude_from_search' => false,         'hierarchical' => true,         'rewrite' => array( 'slug' => 'connector', 'with_front' => false ),         'query_var' => true,         'supports' => array( 'title', 'editor', 'thumbnail', 'comments', 'excerpt','author',/*, 'page-attributes'*/ ),         'taxonomies' => array('post_tag'), // this is IMPORTANT for adding tags         'has_archive' => true,         'show_in_nav_menus' => true,         'show_in_menu'=>false         )     );      and then further used into my website and having large number of authors. Now, I want to add custom capabilities to my custom post type - 'connector'. I have followed answer from Change custom post type to hierarchical after being registered               function modify_connectors() {         if ( post_type_exists( 'connector' ) ) {               $capabilities = array(             'publish_posts' => 'publish_connectors',             'edit_posts' => 'edit_connectors',             'edit_others_posts' => 'edit_others_connectors',             'delete_posts' => 'delete_connectors',             'delete_others_posts' => 'delete_others_connectors',             'read_private_posts' => 'read_private_connectors',             'edit_post' => 'edit_connector',             'delete_post' => 'delete_connector',             'read_post' => 'read_connector',         );                   global $wp_post_types, $wp_rewrite;         $wp_post_types['connector']->hierarchical = true;         $wp_post_types['connector']->capability_type = 'connector';         $wp_post_types['connector']->capabilities = $capabilities;         //I am not sure from nowonwards am I doing right or wrong         $args = $wp_post_types['connector'];         $wp_rewrite->add_rewrite_tag("%connector%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type=connector&name=");         add_post_type_support('connector','page-attributes');         }     }     add_action( 'init', 'modify_connectors', 1 );      I can't find any custom capabilities under "User Role Editor" menu related to connector. Is this something possible to add custom capabilities after register post type has been completed?


Add Adsense code in index.php

My wordpress blog homepage has thumbnail gallery. I want add adsense image ad code to 5,10 place. Below code from my index                  <?php if (have_posts()) : while (have_posts()) : the_post(); ?>       <div id="post-<?php the_ID(); ?>" <?php post_class('thumb'); ?>>      I found BELOW code from here (wordpress.stackexchange)                 <?php $post_counter=0; ?>       <?php if (have_posts()) : ?>       <?php while (have_posts()) : the_post(); ?>       <?php require('post.php'); ?>       <?php       $post_counter++;       if ($post_counter == 2 || $post_counter == 3) { ?>       INSERT ADSENSE CODE HERE       <?php } ?>       <?php endwhile; ?>      I have little knowledge in php. I dont know how to modify it. Kindly help me. Thanks in advance..)


Get plugin info from Wordpress.org repository API with plain PHP code

The documentation of the Wordpress.org API is quite terrible. It links to a website that gives a 502 Bad Gateway error. To be precise, how should my POST request look to the http://api.wordpress.org/plugins/info/1.0/ URL, to get, say, plugin information for the plugin `advanced-custom-fields`? I tried this:               $array(       'action' => 'plugin_information',       'body'   => 'O:8:"stdClass";s:22:"advanced-custom-fields";'     );      but it returns `Action not implemented` error, and I can't quite figure out where to find a correct example. I really want to do this without the Wordpress function `wp_remote_post`, because I'm trying to implement this outside of a WP install, and to be fully honest, I'm trying to do it in a Ruby app, using php-serialize gem. I only need the PHP array structure, so I could request it with a Ruby `net/http` request.


Too Many Pages in Wordpress? 2013

I've read a few threads both here and elsewhere about Wordpress having performance issues once a certain amount of pages have been published. But, most of these threads are at least a couple years old, and it seems like an issue that Wordpress would try to fix. So - my question - does anyone know if this is still an issue? If, so are there any work arounds that would keep performance issues from occurring? I'm thinking of building a site using mostly static pages, and the site could grow into the 5,000 - 10,000 page range. Thanks!


Auto sort the wp-admin post list by a meta key

I am using this following code in my functions file to hide and add some custom columns to my post-edit screen in wp-admin. I am now trying to get the post list to sort by a post meta field (last name). I've read through many tutorials on how to do this, but I can't find anything that matches what I have. I don't need the column to be sortable, I just want the list to automatically sort itself by a custom meta key. And, just FYI, I'm not using a custom post type. This just the regular post type. Can somebody shove me in the right direction on how to do this?                   //Add a First and Last Name column to the post edit table     function topo_modify_post_table( $column ) {         $column['first_name'] = 'First Name';         $column['last_name'] = 'Last Name';              return $column;     }     add_filter( 'manage_posts_columns', 'topo_modify_post_table' );               function topo_modify_post_table_row( $column_name, $post_id ) {              $custom_fields = get_post_custom( $post_id );              switch ($column_name) {             case 'first_name' :                 ?><a style="font-weight:bold;" href="<?php echo admin_url(); ?>post.php?post=<? echo get_the_ID(); ?>&action=edit"><?php the_field('actor-first-name'); ?><?php                 break;             case 'last_name' : ?>                 <a style="font-weight:bold;" href="<?php echo admin_url(); ?>post.php?post=<? echo get_the_ID(); ?>&action=edit"><?php the_field('actor-last-name'); ?><?php                 break;                  default:         }     }          add_filter( 'manage_posts_custom_column', 'topo_modify_post_table_row', 10, 2 );                         //Remove columns     add_filter('manage_post_posts_columns', 'ST4_columns_remove_category');          // REMOVE DEFAULT COLUMNS     function ST4_columns_remove_category($defaults) {         // to get defaults column names:         // print_r($defaults);         unset($defaults['comments']);         unset($defaults['date']);         unset($defaults['author']);         unset($defaults['title']);         return $defaults;     }


HTML in WooCommerce settings

I need to append a default text block to each product description (same text for each and every product) in WooCommerce. So I've created simple plugin which adds new settings field as rich text editor (`wp_editor`) into "WooCommerce > Settings > Catalog" tab. All works fine and I can enter/save plain text, but it strips any HTML tags. I believe tags are stripped by `woocommerce_clean` in settings-save.php               if ( isset( $value['id'] ) && isset( $_POST[$value['id']] ) ) {      update_option($value['id'], woocommerce_clean($_POST[$value['id']]));     } elseif( isset( $value['id'] ) ) {      delete_option($value['id']);     }      How can this be fixed without changing core code?


How to duplicate fields in custom post types?

Lately I've been using Magic Fields quite alot. One of it's great advantages is the ability to duplicate a group - i.e. give the post/page author the ability do create multiple "meta-boxes" at will. I would really like to switch to using wordpress native custom fields. Is there any way to achieve this "duplication" feature without the plugin ?


Using wpdb to connect to a separate database

I want to connect `wpdb` to another database. How do I create the instance and pass it the database name/username/password? Thanks


What is a better way to backup files then FTP?

I want to backup my WP flies but the FTP is really slow. Is there a better solution ? (assume CRON and SSH in a managed VPS)


Pagination Categories

<?php          /**** Pagination ****/         function theme_pagination() {                  global $wp_query, $wp_rewrite;                  $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1;                  $pagination = array(                                 'base' => @add_query_arg('paged','%#%'),                                 'format' => '',                                 'total' => $wp_query->max_num_pages,                                 'current' => $current,                                         'show_all' => false,                                         'end_size'     => 1,                                         'mid_size'     => 2,                                 'type' => 'list',                                 'next_text' => '' . __('다음 동영상 »', get_theme_name()) . '',                                 'prev_text' => '' . __('« 이전 동영상', get_theme_name()) .''                                 );                  if( $wp_rewrite->using_permalinks() )                 $pagination['base'] = user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link( 1 ) ) ) . 'page/%#%/', 'paged' );                      $test = explode('?', remove_query_arg( 's', get_pagenum_link( 1 )));                 $url  = isset( $test[0] ) ? $test[0] : null;                 $vars = isset( $test[1] ) ? $test[1] : null;                           if( $vars != '' ){                     $vars = '?' . $vars;                         $pagination['base'] =  user_trailingslashit( trailingslashit( $url ) . 'page/%#%/' . $vars, 'paged' );                     $pagination['base'] = substr( $pagination['base'], 0, strlen($pagination['base']) +1);                 }                  if( !empty($wp_query->query_vars['s']) )                 $pagination['add_args'] = array( 's' => get_query_var( 's' ) );                  echo paginate_links( $pagination );              }     /****/               /**** return page number ****/     function page_number( $separator = '' ){         global $paged;         if( $paged > 1 ){             echo $separator . 'page ' . $paged;         }else{             return false;         }     }          ?>      all of pages are working except for categories for ex when i click 2 it redirects me to .com/page/2/?cat=82 instead of .com/?cat=82&paged=2 what do i have to modify?


Why does wp_enqueue_script ignore my 'wp_head' hook?

I would like `css_head_scripts` and `js_head_scripts` to be appended to `wp- head`   but Wordpress completely ignores it? Am I missing something?                   function css_head_scripts() {             wp_enqueue_style( 'Master Stylesheet', get_template_directory_uri()."style.css" );         }         function js_head_scripts() {             echo '<!--[if lt IE 9]>';             wp_enqueue_script( "HTML5 Shiv", "https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js" );             wp_enqueue_script( "Respond.js", "https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js" );             echo '<![endif]-->';         }         function js_footer_scripts() {             wp_enqueue_script( "My jQuery", "http://code.jquery.com/jquery-1.10.2.min.js" );             wp_enqueue_script( "Bootstrap", get_template_directory_uri()."/js/bootstrap.min.js" );         }         add_action('wp_head', 'css_head_scripts');         add_action('wp_head', 'js_head_scripts');         add_action('wp_footer', 'js_footer_scripts');


Localize variables with TinyMCE script

I am writing a plugin that has variables that I would like to localize for use within TinyMCE. The logical choice seemed to me to localise them with the enqueued TinyMCE script itself like so:               public function localize_variables() {         wp_localize_script( 'tinymce', 'varName', 'value' );     }     add_action( 'admin_enqueue_scripts', 'localize_variables' );      However I can't find where TinyMCE is being enqueued! I put this little function at the bottom of my functions page and ran it on my Admin edit posts page:               function my_inspect_scripts() {         global $wp_scripts;         print_r($wp_scripts);     }     add_action( 'wp_print_scripts', 'my_inspect_scripts' );      After going through the data dump I noticed that TinyMCE was not in the list of scripts being enqueued! However the script its self was being loaded as a resource within the browser. I feel like I am missing something here.


Reorder "menu order" of attachments to another predefined order

I want to show photos attached to a post in a gallery using the built-in system with a custom order. Currently with the `[gallery]` shortcode it is posible to order it by name, by upload date, by ID, randomly or by a custom "menú order". I guess there are more option with custom queries in templates, but I haven't looked for that yet. I would like to order a large bunch of photos and keep them by the date they were taken (not a core option, but that is a tangential issue), particularly as I would like eventually to continue uploading things later to the same gallery and I may get a bit confused if some photos belong between the already uploaded ones. Also, is not always easy to get the photos _uploaded_ in order, even. My problem is that a simple "post_date" orderby query is not enough for me as I still would like to change the order of a few attachment for conceptual issues after the "post_date" order. So, I would like to **have an option on the UI to automatically reorder the "menu order" to another predefined order** (i have the "EXIF created_timestamp" in mind, but it can be alphabetical, uploaded date / ID or even random), and one could continue changing manually the order on top of that. I want to ask if there's already a plugin that does something similar to that or if there are some functions that I have to look for reference.


how to get db values without using an loop with wpdb->get_results()

So I want to return the data from 1 row from my custom DB table, but I dont want to use a loop as I only need the values once....so is there a way to do this?               $results = $wpdb->get_results($wpdb->prepare("SELECT * FROM mytable WHERE the_id = %d", $id));          $results->the_id;//not working     $results->the_name;//not working     ...


Add class active to static menu

I have a static main menu, but I'd like to add the class 'active' to the menu item in the nav if it is the page, or a child of that page. I imagine it to be a series of something like: if ( $post->post_parent == '1' ) { add_class 'active' } Can this be done with Wordpress?                                                 Home                                                        About Us                                                        How Do I                                                        Our Services                                                             Do It Online                                                        Contact Us


Wordpress constantly running out of memory

My Wordpress installation on a shared hoster is constantly running out of memory: The error pops up at seemingly random, for example when uploading photos or sometimes without doing anything just browsing the Admin area. It is a very fresh installation (with little content and traffic), I receive this error no matter which Theme and which plugins I use. I already added these lines to my config: .htaccess               php_value memory_limit 128M      wp_config.php               define('WP_MEMORY_LIMIT', '128M');     define( 'WP_MAX_MEMORY_LIMIT', '256M' );      My PHP Limit seems sufficient: PHP Memory Limit:               memory_limit    512M    512M      HOWEVER after all this my memory monitor plugin still says:               WordPress Memory Limit: 40M      Do I have to do anything else to apply these changes?


Wordpress wont startup

So far I've narrowed down the execution trail to `index.php` -> `require('./wp-blog-header.php');` ->               if ( !isset($wp_did_header) ) {         require_once( dirname(__FILE__) . '/wp-load.php' );      ->                if ( file_exists( ABSPATH . 'wp-config.php') ) {     require_once( ABSPATH . 'wp-config.php' );      -> `require_once(ABSPATH . 'wp-settings.php');` -> `wp_not_installed();` The execution doesn't get any further than this and I can't find where `wp_not_installed()` is defined. I don't know why it's led up to that method/function in the first place because I've already installed and set Wordpress up. Any help appretiated...


get_post_type on post.php

How can I get the post_type while on the post.php page? I'm working on a plugin that lets users create a new post type. Then in the new post type, a meta box will be added with some options. The meta box to be added is based on certain parameters that were set while creating the new post type. So I need to check what the post_type is, and if it's a certain post_type, a certain meta box will be added to the post edit page. I have it working just fine for add new page (post-new.php) using: $post_type = $_GET['post_type']; But this doesn't seem to get the post type on the post.php page when editing an existing post within the newly created post type. I've also tried: $post_type = get_post_type( $post->ID ); and $post_type = $post->post_type; Any ideas? ### Edit Example code from comment below:               <?php      $post_type = get_post_type($post->ID);      $custom_query = new WP_Query(array( 'post_type' => 'custom-types', 'name' => ''.$post_type.'', 'posts_per_page' => 1 ));      // STARTS THE LOOP      while ($custom_query->have_posts()){          $custom_query->the_post();          // GETS POST META VARIABLES          global $post;          $title = get_the_title();          $option_a = get_post_meta($post->ID, '_option_a', true);          $option_b = get_post_meta($post->ID, '_option_b', true);      }      ?>      ### Edit This code works on the post-new.php file: But not on the post.php file. However, when I fill in the name parameter manually, it works on the post.php file. The `get_post_type($post->ID);` is being ignored in the meta boxes on the post.php page, so instead of pulling data from the post with the name of the post type, it's just pulling data from the most recent post, as if I ran the query without the name parameter at all. ### Edit When I use `global $post;` no data is pulled from the WP_Query on the post.php page. With no `global $post;` the most recent post is pulled from the WP_Query. When I manually enter the name parameter, it works fine on the post.php page. The code, as is, works fine on the post-new.php page. I tried browsing through the source code of the post.php page to see how post_type is referenced there, but no luck. . .figuring out what to use to get the post type.


How do I Upload/Import Form (Input) Files via. Ajax function?

I keep running into an issue getting the file(s) added/switched to ajax so that the server ajax handler can deal with the rest. How can I get the $_FILES to be passed the same as with the default action (built into form elements)? ## Updated I was originally sending a mixed object, but modified it to use the FormData Object only. Using FormData Objects is a solution for uploading files instead of being dependent on JS/jQuery plugins to accomplish the task. **HTML Form**               <form id="frmImport" name="frmImport" method="post" enctype="multipart/form-data" >         <input id="fileImportData" name="importData" type="file" />         <br/>         <button id="btnImport" type="submit" >Import</button>     </form>      **JavaScript**               jQuery(document).ready(function($){         //This is already setup and sent from the server side, and is         // is used to prevent unauthorized users from uploading data.         var importnonce = "3x4mpl3f4k3n0nc3";               $('#frmImport').submit(function(e)         {             e.preventDefault();             //CHECK ERRORS ON USER SIDE, IF TRUE, END OPERATIONS.             if (import_errors())             {                 return false;             }             import_db();             return false;         });              function import_errors()         {             if ($('#fileImportData').val() == '')             {                 alert('No file(s) selected. Please choose a JSON file to upload.');                 return true;             }             if ($('#fileImportData').val() != '')             {                 var ext = $('#fileImportData').val().split('.').pop().toLowerCase();                 if($.inArray(ext, ['json']) == -1)                  {                     alert('Invalid file type. Please choose a JSON file to upload.');                     return true;                 }             }             return false;         }              function import_db()         {             //REMOVED - Everything was switched over to be added to the FormData Objects             //var ajaxData = {              //    action : 'ajax_handler_import',             //    _ajax_nonce : importNonce             //};                  //This is where issues occurred, I couldn't get the file added to ajax             // and preserved in $_FILE, and this isn't the only method I've tried              // to add data. However, this was the most promising.                  //MODIFIED - Everything is appended to the FormData Object instead.             //ajaxData.formD = new FormData();             //jQuery.each($('#fileImportData')[0].files, function(i, file) {             //    ajaxData.formD.append('file-'+i, file);             //});                  var formData = new FormData();             jQuery.each($('#fileImportData')[0].files, function(i, file) {                 formData.append('uploadFile-'+i, file);             });             formData.append('action', 'ajax_handler_import');             formData.append('_ajax_nonce', importNonce);                  jQuery.ajax({                 url: ajaxurl,                 type: 'POST',                 cache: false,                 contentType: false,                 processData: false,                      //MODIFIED - From ajaxData to formData                 data: formData,                      beforeSend: function(jqXHR, settings){                     console.log("Haven't entered server side yet.");                 },                 dataFilter: function(data, type){                     //May need/want to create a function to parse the data. Which includes                     // PHP Errors that would normally break the AJAX function with a JS                      // Error with no sign of the PHP Error message. Normally want to                      // try/catch php errors.                     console.log("JSON string echoed back from server side.");                 },                 success: function(data, textStatus, jqXHR){                     console.log("Back from server-side!");                     //Checking errors that may have been caught on the server side that                     // normally wouldn't display in the error Ajax function.                     if (data.msg != 'success')                     {                         alert(data.error);                     }                 },                 error: function(jqXHR, textStatus, errorThrown){                     console.log("A JS error has occurred.");                 },                 complete: function(jqXHR, textStatus){                     console.log("Ajax is finished.");                 }             });           }     });      **PHP Server/Handler**               <?php     class server     {         function ajax_import_handler()         {             check_ajax_referer("ajax_handler_import");                  $rtnData = new stdClass();             $rtnData->msg = 'success'; //For signifying Server errors             $rtnData->error = ''; //For displaying custom error messages or using the try/catch method                  //Do Stuff             foreach ($_FILES as $key => $value)             {                 //GET FILE CONTENT                 $file_array[$key] = json_decode(file_get_contents($value['tmp_name']));             }             //Do More Stuff                  //Add Stuff to $rtnData                  echo json_encode($rtnData);         }     }     ?>


Create a simple shop's website with products list

I need to create a webpage for the book store. For now I need to create several static web pages and one page with list of products. I don't know how to create this list, I don't need any shopping carts and payments. Just plain products list with separate page for each product. I also can consider commercial plugins. Thanks for any suggestions!


How can I upload video, generate thumbnail and convert to different formats?

I haven't used WP in a very, very long time so please bear with me. I'm using v3.3.1 I've used `get_children()` to display images of a page in a custom template. I then customized a template to turn the images into a JQuery carousel. Now, I want to add videos to that gallery. **My question is** , how can I:   1. Have thumbnails generated once I upload videos via media library.   2. Convert the videos into multiple formats (all or most of: mp4, webm/vp8, ogg/vorbis & swf) so that I can use them with MediaElement.js I'd really appreciate some direction on this Thanks.


How do I set a featured image (thumbnail) by image URL when using wp_insert_post()?

While looking through the function reference entry for wp_insert_post(), I noticed that there's no parameter in the array it requires which will allow me to set the 'Featured Image' for a post, displayed as the post thumbnail in my theme. I have looked into functions like set_post_thumbnail(), as suggested by Mr. Bennett, but this seems to be a relatively new addition to WordPress itself and the WordPress codex. As such, there aren't any sources that I can find which explain how the $thumbnail_id parameter should be acquired and supplied. If this really is the function to use, in what way could I provide it with a valid $thumbnail_id parameter when all I have is an image URL? Thanks in advance!


Change featured image urls in database

Im storing my images on another server and Ive managed to change the urls in the database but I cant seem to change the featured image urls? I will not be adding any more images so I just want to change the url for all images. This is the sql I used for normal images               UPDATE wp_posts SET post_content = REPLACE (post_content, 'src="http://www.oldsiteurl.com', 'src="http://newsiteurl.com');      and               UPDATE wp_posts SET  guid = REPLACE (guid, 'http://www.oldsiteurl.com', 'http://newsiteurl.com') WHERE post_type = 'attachment';      All the other images are fine except the featured images.


How do I add a dropdown list of numbers 1 - 1000 as an extra profile field?

I don't want to write out something like this from 1 to 1000:                       <select name="number_pick" id="number_pick" >                 <option value="1" <?php selected( '1', get_the_author_meta( 'number', $user->ID ) ); ?>>1</option>             <option value="2" <?php selected( '2', get_the_author_meta( 'number', $user->ID ) ); ?>>2</option>             <option value="3" <?php selected( '3', get_the_author_meta( 'number', $user->ID ) ); ?>>3</option>             </select>         So instead, I am trying to use a foreach statement to get from 1 to 1000. I think I am close, but I have something wrong and I don't know what it is.                           <select name="number_pick" id="number_pick" >                 <?php foreach (range(0,1000) as $number)                 echo "<option value='$number' selected( '$number', get_the_author_meta( 'number_pick', $user->ID ) ) >$number</option>"; ?>                 </select>      Can anyone tell me what I am missing in the lines above? Here is the complete code:                       <?php                 add_action( 'show_user_profile', 'show_extra_profile_fields' );                 add_action( 'edit_user_profile', 'show_extra_profile_fields' );                      function show_extra_profile_fields( $user ) { ?>
Extra profile information

                             Pick A Number	                                                              <select name="number_pick" id="number_pick" >                                     <?php foreach (range(0,1000) as $number)              echo "<option value='$number' selected( '$number', get_the_author_meta( 'number_pick', $user->ID ) ) >$number</option>"; ?>                                 </select>

                 <?php }                      add_action( 'personal_options_update', 'save_extra_profile_fields' );                 add_action( 'edit_user_profile_update', 'save_extra_profile_fields' );                      function save_extra_profile_fields( $user_id ) {                     if ( !current_user_can( 'edit_user', $user_id ) )                         return false;                     update_usermeta( $user_id, 'number_pick', $_POST['gender'] );                 }             ?>


Pagination with custom loop

my question may look like Pagination not working with custom loop, but there is a different. I use the custom loop for display flash game. I want to make a pagination on page games by category. category.php :               <?php     if ($cat)     {     $cols = 2;     $rows = 4;     $paged = (('paged')) ? get_query_var('paged') : 1;     $post_per_page = $cols * $rows; // -1 shows all posts     $do_not_show_stickies = 1; // 0 to show stickies          $args = array(         'post_type' => 'game',         'category__in' => array($cat),         'orderby' => 'date',         'order' => 'DESC',         'paged' => $paged,         'posts_per_page' => $post_per_page,         'caller_get_posts' => $do_not_show_stickies     );     $wp_query = new WP_Query($args);      begin_roundblock(get_cat_name($cat), 'games-pages-category', null);     if (have_posts()):       echo '
';         /* Begin Breadcrump*/         echo '
';                 if(function_exists('bcn_display'))                 {                     echo '
';                     echo 'Go Back:';                         bcn_display();                     echo '
';                 }         echo '
';         /* End Breadcrump*/         $i = 0;         while (have_posts())         {             the_post();                  $class = 'game-info';             if ($i % $cols == 0)                 $class .= ' clear';                  echo '
';             the_post_thumbnail(array(60, 60), array('class' => 'game-icon'));             $title = get_the_title();             if (mb_strlen($title) > 7)                 $title = mb_substr($title, 0, 6).'...';             echo ''.$title.'
';             $i++;         } ?>
     <?php if(function_exists('wp_pagenavi'))                { wp_pagenavi(); } ?>
     //For default WP

<?php next_posts_link('« Older Entries') ?>

<?php previous_posts_link('Newer Entries »') ?>

     <?php else: ?>
Not Found

Sorry, but you are looking for something that isnt here.
         <?php get_search_form(); ?>     <?php endif;     end_roundblock();     }     ?>      I got the pagination links, also I tried to use the wp-pagenavi plugin and it's right calculate the number of my post's(game's) to display with right number of pages. But when I clicked on link "Older Entries" (or any page in case pagenavi plugin) it's go to main page, but url is "http://mydomain/category/category_name/page/2". I try to use many other plugin's, but all the same. Doe's anybody could help me with it? Thanks.


rss feed code help

this rss feed question was resolved but now when i tried this code `<a href="<?php echo get_post_comments_feed_link($feed); ?>">RSS feed of this post</a>` on my archives page,then i am getting the wrong url feed what i want is when i click on the this feed, then i should get all the feeds of that current page which means, my url is this `http://mbas.in/location/mba-in- ghana` where location is my custom taxonomy, if i write this in url `http://mbas.in/location/mba-in-ghana/feed` then i get all the feeds of that page, but if i write the code and i click on the link then it is giving me feeds of this url `http://mbas.in/university-ghana-business-school/emba/feed` this is the first post of my that page, what is the problem with this?


the_author() returns empty string

I have created a page template for the front page of a site I am building using WordPress. I am displaying the 3 latest posts on this page and all works fine except for the display of the author of the post. I am using the following code               <?php             $recentposts=get_posts('showposts=3');             if ($recentposts)              {                 foreach($recentposts as $post)                 {                     //setup_postdata($post);         ?>

<a href="<?php the_permalink() ?>" rel="bookmark"                           title="Link to <?php the_title_attribute(); ?>">                             <?php the_title(); ?>

                 <?php                     $postContent = $post->post_content;                     if(strlen($postContent) > 50)                     {                         $postContent = substr($postContent, 0,                                   strrpos(substr($postContent, 0, 60), " ")) . " ...";                     }                     echo $postContent;                 ?>

Posted <?php the_time("jS M Y"); ?> by <?php the_author(); ?>

              <?php                 }             }         ?>      and I have also tried the following               $user_info = get_userdata($post->post_author);     echo $user_info->first_name;     echo $user_info->last_name;      but both result in an empty string.


add generated stylesheet from parent theme after child-themes style.css

I have a child-theme -> parent-theme setup, where I need to have stylesheet called generated.css loaded in addition to the style.css file added by the active child-theme. The generated.css file is residing in the parent-theme and is being dynamically generated and provided by the parent-theme.. I started out the obvious way, simply adding an import rule to the beginning of the child-themes style.css:               /* Get Parent BASE CSS */     @import url('../parent-theme/style.css');               /* Get Parent GENERATED CSS */     @import url('../parent-theme/generated.css');      But this does not work for two reasons. 1) I want to be able to add a cache-busting version number to the file:               <link rel='stylesheet'  href='http://www.com/wp-content/themes/parent-theme/generated.css?ver=2389642855'>      2) I want the file to be loaded last, after the child themes style.css Is it possible to hook in the loading of this generated.css stylesheet into the head so it is added after the child-theme's style.css using the functions.php of the parent theme? What hook or WP mechanism could I use?


Where can I find the corrent version of my wordpress blog?

Where can I find the corrent version of my wordpress blog ? http://photoshop.faressoft.org


Hide Slider on Post Type Page

If users enter a code on the homepage and that code is valid they will be sent to a post type page where a profile is shown. The issue is that somehow the homepage slider is shown on that profile page too. Somehow it is loaded as well and I do not want that. I tried to unload it using a conditional, but that does not seem to work. Here is the homepage code:                   <?php get_header(); ?>

                         <?php                 //if ( 'viewprofile' !== get_post_type() ) {             $args = array( 'post_type' => 'slider', 'posts_per_page' => 10 );             $loop = new WP_Query( $args );             while ( $loop->have_posts() ) : $loop->the_post();             ?>

                             <?php                             the_content();                             echo the_post_thumbnail();                             ?>

                        <?php   endwhile;            //}         ?>

                         <form action="<?php echo get_option('home'); ?>?post_type=viewprofile" method="post">                         <?php _e('If you received a Card,
 enter the code here:', 'textdomain');?><input name="myaccesskey" type="text" class="inputBox" /><input type="submit" value="<?php _e('Go', 'textdomain');?>" class="go" />                         </form>

         <?php get_sidebar(); ?>      <?php get_footer(); ?>      And here is the majority of the profile view page:               <?php             if(empty($_REQUEST['myaccesskey'])){                          echo "";             }else{                     global $wpdb;             $getId = null;             $getCode = $_POST['myaccesskey'];         $querystr = $wpdb->prepare("SELECT user_id FROM wp_x_usermeta WHERE meta_key='myaccesskey' AND meta_value='%s'",$getCode);                      $querystrChecking = mysql_query($querystr);                     if(mysql_num_rows($querystrChecking)<=0){                         echo "";                     }             elseif ($row = mysql_fetch_assoc($querystrChecking)) {                 $getId = $row['user_id'];             }                     $uploads = wp_upload_dir();                  //             }             ?>         <?php get_header(); ?>

PROFILE

                  <?php _e('Name:', 'textdomain');?> <?php the_author_meta( 'first_name', $getId ); ?>   <?php the_author_meta( 'last_name', $getId); ?>
                   <?php _e('Nick Name:', 'textdomain');?> <?php the_author_meta( 'nickname', $getId ); ?>
                   <?php _e('Age:', 'textdomain');?><?php get_the_author_meta( 'dateofbirth', $getId );?>
                      <?=get_the_author_meta( 'myfavouritelinks', $getId );?>

<?php _e('About Me:', 'soodba');?>
 <?=the_author_meta( 'description', $getId); ?>

                         <?php if(get_the_author_meta( 'userphoto_thumb_file', $getId )!=""){?>                             <img src="<?=$uploads['baseurl'];?>/thumbs/<?=get_the_author_meta( 'userphoto_thumb_file', $getId );?>" />                         <?php }?>                     <?php _e('see all pictures', 'textdomain');?>

<?php _e('Contact information:', 'textdomain');?> <?= get_the_author_meta('user_email', $getId );?>

               <?php if ( is_active_sidebar('inner')): ?>

          <?php dynamic_sidebar( 'inner' ); ?>

         <?php endif; // end sidebar widget area ?>      <?php get_footer(); ?>         I tried other conditionals such as `if (is_page() || is_front_page())`, but the slider is still loaded on the profile page underneath the `get_the_author_meta` details as I guess it is part of the front page still???. Any ideas how to fix this? **Update** It seems that profile view is loaded as a substring - url http://www.domain.com/?post_type=viewprofile \- of index.php. I mean, the profile page seems to be an addition of the index, while it should be a separate page. Somehow my coding is incorrectly loading index.php code **Update 2** I gave the custom post a slug using:               register_post_type('profile', array(         'label' => __('Profile'),         'singular_label' => __('Profile'),         'public' => true,         'show_ui' => false, // UI in admin panel         'capability_type' => 'post',         'hierarchical' => false,         'rewrite' => array("slug" => "user-profile"), // Permalinks format         'supports' => array('title','author')     ));      and now the conditional does work. The slider is not loaded. But the profileviewpage code is not yet either.


How do I get from search_theme_directories() to the $stylesheet (name) for switch_theme()

I have a theme. It depends on a plugin. If you try to activate the theme and the plugin isn't installed, then I want to `switch_theme()` to some other (random**) theme in the `search_theme_directories()` list. I can get the `$template` value from the key of the array returned by `search_theme_directories()`. But I can't seem to sort out how to get the `$stylesheet`. Also, given this approach, what's the best way to check if a theme is child or a parent? Without getting into details I would prefer to pick parent theme as a default. Perhaps there's a better way to do this? I would presume WP has something similar built in but I can seem to pin point that either. In short, I'm listenin' if you got ideas :) **Important** I was not able to tag this with: `search_theme_directories()`. That tag doesn't exist and I don't have the rep to add it. Could someone with some juice add it to the list of valid tags? Thanks. Note: I'm first going to check for twentytwelve and twentyeleven and then if necessary pick one if they aren't around.


Add category base to url in custom post type/taxonomy

I am building an LMS type system in WordPress, controlled by Custom Post types. The post type is called Lessons (with a slug of courses) and it has one custom taxonomy (category) called courses. The domain url structure shows right now as domain.com/courses/lesson-name, I want it to become domain.com/courses/[course-name{category}]/lesson-name, or essentially /[cpt]/%category%/%postname%/ here is the plugin I wrote that is controlling the CPTs now.               function rflms_post_type() {         $labels = array(             'name'                => _x( 'Lessons', 'Post Type General Name', 'text_domain' ),             'singular_name'       => _x( 'Lesson', 'Post Type Singular Name', 'text_domain' ),             'menu_name'           => __( 'Lessons', 'text_domain' ),             'parent_item_colon'   => __( 'Parent Product:', 'text_domain' ),             'all_items'           => __( 'All Lessons', 'text_domain' ),             'view_item'           => __( 'View Lesson', 'text_domain' ),             'add_new_item'        => __( 'Add New Lesson', 'text_domain' ),             'add_new'             => __( 'New Lesson', 'text_domain' ),             'edit_item'           => __( 'Edit Lesson', 'text_domain' ),             'update_item'         => __( 'Update Lesson', 'text_domain' ),             'search_items'        => __( 'Search Lessions', 'text_domain' ),             'not_found'           => __( 'No Lessons Found', 'text_domain' ),             'not_found_in_trash'  => __( 'No Lessons Found in Trash', 'text_domain' ),         );              $args = array(             'label'               => __( 'Lessons', 'text_domain' ),             'description'         => __( 'Referable Lessons', 'text_domain' ),             'labels'              => $labels,             'hierarchical'        => false,             'public'              => true,             'show_ui'             => true,             'show_in_menu'        => true,             'show_in_nav_menus'   => true,             'show_in_admin_bar'   => true,             'supports'        => array('premise-member-access', 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments'),             'menu_position'       => 5,             'menu_icon'           => null,             'can_export'          => true,             'has_archive'         => true,             'exclude_from_search' => false,             'publicly_queryable'  => true,             'capability_type'     => 'post',             'rewrite'                    => array('slug' => 'courses'),         );              register_post_type( 'lessons', $args );               // Hook into the 'init' action          }     add_action( 'init', 'rflms_post_type', 0 );          // Register Custom Taxonomy     function custom_taxonomy()  {         $labels = array(             'name'                       => _x( 'Courses', 'Taxonomy General Name', 'text_domain' ),             'singular_name'              => _x( 'Course', 'Taxonomy Singular Name', 'text_domain' ),             'menu_name'                  => __( 'Courses', 'text_domain' ),             'all_items'                  => __( 'All Courses', 'text_domain' ),             'parent_item'                => __( 'Parent Course', 'text_domain' ),             'parent_item_colon'          => __( 'Parent Course:', 'text_domain' ),             'new_item_name'              => __( 'New Course Name', 'text_domain' ),             'add_new_item'               => __( 'Add New Course', 'text_domain' ),             'edit_item'                  => __( 'Edit Course', 'text_domain' ),             'update_item'                => __( 'Update Course', 'text_domain' ),             'separate_items_with_commas' => __( 'Separate Courses with commas', 'text_domain' ),             'search_items'               => __( 'Search Courses', 'text_domain' ),             'add_or_remove_items'        => __( 'Add or Remove Courses', 'text_domain' ),             'choose_from_most_used'      => __( 'Choose from Most Used courses', 'text_domain' ),         );              $args = array(             'labels'                     => $labels,             'hierarchical'               => true,             'public'                     => true,             'show_ui'                    => true,             'show_admin_column'          => true,             'show_in_nav_menus'          => true,             'show_tagcloud'              => false,             'rewrite'                    => array('slug' => 'courses'),         );              register_taxonomy( 'course', 'lessons', $args );     }          // Hook into the 'init' action     add_action( 'init', 'custom_taxonomy', 0 );


Post schedule being missed

Out of the blue, my post scheduling ceased working a couple a days ago. I tried everything I found when looking for the answer here at Wordpress Answers, but none of the suggestions worked in my case. Could anyone offer a solution for this? I'm running the latest Wordpress version and already tried disabling the plugins. Thank you


Displaying comments on pages distinguished by GET IDs

Wordpress - comments_template(). I am currently trying to work with an outdated wordpress addon and I wish to add the functionality to allow commenting on certain pages. However each page url looks like:               /match/?match=1     /match/?match=2     /match/?match=3      So when I post comments on a page they are displayed okay, however when a comment is made it appears in the 3 pages listed above rather just the one page the comment was made on. So my question is how do I make it so comments_template() sees match=1,2,3, etc as individual pages rather than the same page with just different get statements. _edit_ The URL structure is:               http://pantheones.com.au/pes-csgo-open-league/match-table/?match=1     http://pantheones.com.au/pes-csgo-open-league/match-table/?match=2     http://pantheones.com.au/pes-csgo-open-league/match-table/?match=3      Each URL displays different information depending on the number of match and I want separate comments on each match.


Wordpress Theme's 404.php not found, server defaults to Apache's own 404 page

if I just type something to provoke a 404 Error on my Wordpress installation, Wordpress doesn't load its own 404.php file, but the Apache server's own 404 error message gets displayed. ## What is wrong with my Wordpress installation? Do I need to edit the Apache server's config file and redirect to the Wordpress 404.php page? UPDATE: I have partially managed to get this working, I missed the `FileInfo` directive in the `/etc/apache2/sites-available/default` file. Not all stuff get caught gracefully, though.


Wordpress search attachments - limit to custom taxonomy dropdown

I working on a site which uses a custom taxonomy attached with media library and many images attached to this particular taxonomy. I am looking for a solution to search attachment names but within a specific term. so far, what I have tried is. **1\. to show attachment name in search result**                       function attachments_search_pre_get_posts( $query ) {               if (! is_search() )                  return $query;                          // add post type attachment               $post_types = $query->get( 'post_type' );               if ( ! $post_types || 'post' == $post_types )                 $post_types = array( 'post', 'attachment' );                      if ( is_array( $post_types ) )                  $post_types[] = 'attachment';                      $query->set( 'post_type', $post_types );                    // add post status 'inherit'                $post_status = $query->get( 'post_status' );               if ( ! $post_status || 'publish' == $post_status )                 $post_status = array( 'publish', 'inherit' );               if ( is_array( $post_status ) )                  $post_status[] = 'inherit';               $query->set( 'post_status', $post_status );                    return $query;              }              add_filter( 'pre_get_posts', 'attachments_search_pre_get_posts' );      then I call the form like this                           <form role="search" method="get" id="searchform" action="<?php bloginfo('siteurl'); ?>">                 <div>                 <label class="screen-reader-text" for="s">Search for:</label>                 <input type="text" value="" name="s" id="s" />                 in <?php wp_dropdown_categories( 'show_option_all=All Categories&taxonomy=book-taxes' ); ?>                 <input type="submit" id="searchsubmit" value="Search" />                 </div>                 </form>      thou, the form is working and its adding the attachments in the search result, but it does not limit the search to custom taxonomy. any help on this will be appreciated. Regards


Sort by name - second wp_query

I am using the code below to sort by name based on taxonomy and then list the posts within each taxonomy. First query works ok for alphabetical listing of taxonomies. The problem i am having is that the posts inside each taxonomy are not listed in alphabetical order. Any ideas?
             <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                                  <?php                       //if (false == ($content = get_transient('os_travel_cache'))){                      //  ob_start();                          $taxonomies = array(                         'tax_one'       => 'Taxonomy1',                         'tax_two'       => 'Taxonomy2',                         'tax_three' => 'Taxonomy3',                     );                               foreach($taxonomies as $taxonomy => $title) {                          // start div... cor column..                         ?>

<?php echo $title; ?>

                             <?php                                       $terms = get_terms( $taxonomy,                                      array(                                         'orderby'       => 'name',                                          'order'         => 'ASC',                                         'hide_empty'    => true ) );                                       if (!is_wp_error($terms) && is_array($terms) && count($terms) > 0){                                     foreach($terms as $term){                                              $args = array(                                             'post_type' => 'os_book',                                             'tax_query' => array(                                                 array(                                                     'taxonomy' =>  $term->taxonomy,                                                     'field' => 'id',                                                     'terms' => $term->term_id                                                 )                                             )                                         );                                              ?>

 + <?php echo $term->name; ?>

                                         <?php                                              $rp = new WP_Query( $args );                                         if ($rp->have_posts())                                             while ( $rp->have_posts() ) {                                                  $rp->the_post();                                                           $name       = get_field('fl_profile_name');                                                     $location   = get_post_meta(get_the_id(), 'fl_country', true);                                                      ?>                                                     <li data-location="<?php echo $location; ?>"><a href="<?php the_permalink();?>"><?php echo $name; ?>
                                                      <?php                                              }                                         ?>

                                         <?php                                     }                                 }                                  ?>
                         <?php                     }                  //      $content = ob_get_contents();                  //      ob_end_clean();              //      set_transient('os_travel_cache', $content, 1);             //  }             //  echo $content;                 ?>                       <?php endwhile;             endif; ?>


Include Seed Content in a Theme installation

Is there a way to include standard content in a theme? I want to set certain pages for all installations of a starter theme I made for a client (they use it over and over for similar websites)


Any way to handle in document search in wordpress?

Is there any known way to incorporate in document search with WP? I am thinking about using WP with a lot of custom fields and add-ons to form a DMS but the last piece of the puzzle is in document searching and I haven't been able to find anything on the topic.


wordpress the_tags not in alphabetical order

I'm using wordpress' `the_tags()` to display the tags of each post on a single side. What I intend to do is to display the tags by the order they are typed in in the backend, and not by alphabetical order. The Wordpress codex doesn't seem to have a argument to sort `the_tags()` and the output is always in alphabetical order. Does anyone of you have a tip? Thanks


How can I get automatically anchors for every h2-heading?

I usually type my posts directly via the HTML textarea, but I forget quite often to add anchors to the -Elements. Can they automatically be added with the text of the heading? How can this be achieved? Does a plugin exist for this?


add_filter the_content in functions.php not working

I want to add_filter for the_content in functions.php of my theme. I have added code which just display echo but it seams that my filter is not applied.               function add_mod_hatom_data($content) {        // $t = get_the_modified_time('F jS, Y');        //$author = get_the_author();        // $title = get_the_title();        //if(is_single()) {         echo 'perrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr';        //   $content .= '
'.$title.' was last modified:  '.          //$t.' by '.$author.'
';        // }         return $content;         }           add_filter('the_content', 'add_mod_hatom_data');      I have tried to call it like this :               add_filter('the_content', 'add_mod_hatom_data', 99);      or change position to be on top of functions.php with no success. Do I need to enable somewhere add_filter or it is overridden by some other function ? NOTE: In my single post template I have :               <?php get_header(); ?>

                         <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                              <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article" itemscope itemtype="http://schema.org/BlogPosting">

                                                                                <?php $category = get_the_category();                                                                                if ($category[0]) {                                                                                echo ''.$category[0]->cat_name.' '.$post->ID.'';                                                                                }                                                                                ?>

                                                                                <?php the_title(); ?>

                                                 <?php $category = get_the_category();                                     if ($category[0]) {?>
                                         <?php echo 'term_id) . '" class="clearfix">' . $category[0]->cat_name . '
';                                         }                                         ?>

                                         <?php endwhile; ?>                                        <?php else : ?>

<?php _e("Not Found", "wpbootstrap"); ?>

<?php _e("Sorry, but the requested resource was not found on this site.", "wpbootstrap"); ?>

                              <?php endif; ?>

           <?php get_footer(); ?>


Custom taxonomy on permalink

I have a long time problem and look forward for your help. I have a custom taxonomy of "city" (it is no hierarchical like tags). I just would like my URLs to look like this:               /%city%/%category%/%postname%/      So this is what I like to accomplish.   * `http://example.com/city/moscow` \- Display all posts in taxonomy city-Moscow.   * `http://example.com/category/shopping` \- Display all posts in this category and all cities.   * `http://example.com/category/shopping/supermarket` \- Display all posts in this category and all cities.   * `http://example.com/moscow/shopping/` -Display all posts in this category in Moscow.   * `http://example.com/moscow/shopping/supermarket/` \- Display all posts in this -child-category in Moscow.   * `http://example.com/moscow/shopping/supermarket/postname` \- Display the post. **I’ve made the following** :   1. I’ve created a custom taxonomy - city at first.   2. I’ve added the code in function.php               function add_custom_taxonomies_city() {         register_taxonomy('city', 'post', array(             'hierarchical' => false,             'labels' => array(                 'name' => _x( 'City', 'taxonomy general name' ),                 'search_items' =>  __( 'Search cities' ),                 'all_items' => __( 'All cities' ),                 'parent_item' => __( 'Parent Categories' ),                 'parent_item_colon' => __( 'Parent Categories:' ),                 'edit_item' => __( 'Edit city' ),                  'update_item' => __( 'Update city' ),                 'add_new_item' => __( 'Add city' ),                 'new_item_name' => __( 'New city' ),                 'menu_name' => __( 'cities' ),                 );                      ),         'rewrite' => array(             'slug' => 'city',             'with_front' => false,             'hierarchical' => false             ),         ));     }     add_action( 'init', 'add_custom_taxonomies_city', 0 );           add_filter('post_link', 'town_permalink', 10, 3);     add_filter('post_type_link', 'town_permalink', 10, 3);          function town_permalink($permalink, $post_id, $leavename) {         if (strpos($permalink, '%city%') === FALSE) return $permalink;          // Get post         $post = get_post($post_id);         if (!$post) return $permalink;          // Get taxonomy terms         $terms = wp_get_object_terms($post->ID, 'city');           if (!is_wp_error($terms) && !empty($terms) && is_object($terms[0])) $taxonomy_slug = $terms[0]->slug;         else $taxonomy_slug = 'not-city';              return str_replace('%city%', $taxonomy_slug, $permalink);     }      **The result** :   * `http://example.com/city/moscow` \- It works    * `http://example.com/category/shopping` \- It works   * `http://example.com/category/shopping/supermarket/` \- It works    * `http://example.com/moscow/shopping/` \- It works    * `http://example.com/moscow/shopping/supermarket/` \- It doesn’t!!!!!    * `http://example.com/moscow/shopping/supermarket/postname` – It doesn’t!!!!! This post has a following link: `http: //mysite.ru/ moscow/shopping/postname` But I need the links to contain the child-category.   1. I’ve tried to solve the task with another option: I’ve added the following code into function. php               function addRoutes() {         add_rewrite_tag('%city%', '(.+?)');         add_rewrite_rule('(.+?)/(.+?)/([^/]+)(/[0-9]+)?/?$', 'index.php?city=$matches[1]&category_name=$matches[2]&name=$matches[3]&page=$matches[4]', 'top');       add_rewrite_rule('(.?.+?)(/[0-9]+)?/?$', 'index.php?pagename=$matches[1]&page=$matches[2]', 'top');         flush_rewrite_rules();     }     add_action('init', 'addRoutes');      **As a result** `http://example.com/city/moscow` \- Page not found 404 error. `http://example.com/category/shopping` \- Page not found 404 error.. `http://example.com/category/shopping/supermarket/` \- Page not found 404 error.. `http://example.com/moscow/shopping/supermarket/postname` –400 error It seems the sustem doesn’t understand %city% What is wrong? Look forward for your help Can anybody help me? Thank you very much! * * * I decided to change the structure of the URLs to:   * `example.com/city/moscow/category/shopping/` -Display all posts in this category in Moscow.   * `example.com/city/moscow/category/shopping/supermarket/` \- Display all posts in this -child-category in Moscow.   * `example.com/city/moscow/category/shopping/supermarket/postname` \- Display the post. The code:               //The rewrite rules     function eg_add_query_vars( $query_vars ) {         $new_vars = array( 'town' );              return array_merge( $new_vars, $query_vars );     }     add_filter( 'query_vars', 'eg_add_query_vars' );          function eg_add_rewrite_rules() {         global $wp_rewrite;              $new_rules = array(             'city/(.+?)/category/(.+?)/?$' => 'index.php?city=' . $wp_rewrite->preg_index(1) . '&category;_name=' . $wp_rewrite->preg_index(2),     'city/(.+?)/category/(.+?)/(.+?)/?$' => 'index.php?city=' . $wp_rewrite->preg_index(1) . '&category;_name=' . $wp_rewrite->preg_index(2) . '&category;_name='. $wp_rewrite->preg_index(3),          //'city/(.+?)/category/(.+?)/(.+?)/(.+?)/?$' => 'index.php?city=' . $wp_rewrite->preg_index(1) . '&category;_name=' . $wp_rewrite->preg_index(2) . '&category;_name='. $wp_rewrite->preg_index(3). '&page;='. $wp_rewrite->preg_index(4),// This is me effort to write the rule for posts (doesn't work)                );         $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;     }     add_action( 'generate_rewrite_rules', 'eg_add_rewrite_rules' );               //creating the permalink:     function city_permalink($permalink, $post_id, $leavename) {         if (strpos($permalink, '%city%') === FALSE) return $permalink;                  // Get post             $post = get_post($post_id);             if (!$post) return $permalink;                  // Get taxonomy terms             $terms = wp_get_object_terms($post->ID, 'town');               if (!is_wp_error($terms) && !empty($terms) && is_object($terms[0])) $taxonomy_slug = $terms[0]->slug;             else $taxonomy_slug = 'not-city';              return str_replace('%town%', $taxonomy_slug, $permalink);}              function wp_town_query( $query ) {         if( isset( $query->query_vars['city'] ) ):             if( $city = get_term_by( 'id', $query->query_vars['city'], 'city' ) )                 $query->query_vars['town'] = $city->slug;         endif;     }     add_action( 'parse_query', 'wp_city_query' );      My settings in Permalink admin page: city/%city%/category/%category%/%postname%/ as a result I have: \- `example.com/city/moscow/category/shopping/` -works \- `example.com/city/moscow/category/shopping/supermarket/` \- works but still I can't understand how to write the rule for posts: \- `example.com/city/moscow/category/shopping/supermarket/postname` \- doesn't. Pagination not working too. I'll be glad to have any advice! It's work:                    'city/(.+?)/category/(.+?)/(.+?)/([^/]+)/?$' => 'index.php?city=' . $wp_rewrite->preg_index(1) . '&category;_name=' . $wp_rewrite->preg_index(2). '&category;_name=' . $wp_rewrite->preg_index(3). '&name;=' . $wp_rewrite->preg_index(4),      'city/(.+?)/category/(.+?)/page/?([0-9]{1,})/?$' => 'index.php?city=' . $wp_rewrite->preg_index(1) . '&category;_name=' . $wp_rewrite->preg_index(2). '&paged;=' . $wp_rewrite->preg_index(3),     'city/(.+?)/category/(.+?)/?$' => 'index.php?city=' . $wp_rewrite->preg_index(1) . '&category;_name=' . $wp_rewrite->preg_index(2),


Hooking after get_header()

Does anyone know a good way to hook just after get_header() without hacking the theme? I know you can hook before the function loads header.php but I am trying to insert some HTML just after get_header() is finished.


who to limit number of li in wp_nav_menu

need help regarding wordpress navigation i am using                if ( has_nav_menu( 'main_nav' ) ) {        wp_nav_menu( array('menu' => 'guest menu' ));       }      from back end if i keep the menu empty(do not any page/category to menu) it displays all the pages in menu on front end. i want it it to display nothing or by default only one menu item (only one `<li`>) if the menu in back end is empty. can i limit `wp_nav_menu()` to display only one `<li>`


using 1 form shortcode (si or cf7) for all multisite sites

I have a network with more than 50 sites. I want to create one contact form (which means one shortcode) using contact form 7 or fast secure contact form. Then, I want to use that shortcode on all the 50+ sites so all sites use the same form. The problem is that when I try to use a shortcode of site A over site B, it's not working. Do you know how can I use a contact form shortcode globaly on all sites at once? Thanks!


add unique code required to register

I have a custom registration form on my homepage and I want to add a field where a code has to be put in to allow people to register. So that only people i give the code to can register. I believe it'd be as simple as adding a 1+2= ? validation to the form, but i can't even find any info on that. Let me know if anyone has any ideas. Thanks.               <form action="<?php echo site_url('wp-login.php?action=register', 'login_post') ?>" method="post">                       <input type="text" name="user_login" id="user_login" class="input"  onfocus="if(this.value == 'Username'){this.value = '';}" type="text" onblur="if(this.value == ''){this.value='Username';}" value="Username" />                           <input type="text" name="user_email" id="user_email" class="input"  onfocus="if(this.value == 'Email Address'){this.value = '';}" type="text" onblur="if(this.value == ''){this.value='Email Address';}" value="Email Address" />                          <?php do_action('register_form'); ?>                       <input type="submit" value="Register" id="register" />
A password will be e-mailed to you.
                             </form>


WP_Query orderby taxonomy term value (numeric)

I have this query...               <?php               $press = new WP_Query(array(             'posts_per_page' => -1,             'post_type'     => 'individual',             'post_status'   => 'private'          ));              if ($press->have_posts()) : while ($press->have_posts()) : $press->the_post();          ?>      But my custom post-types are using custom taxonomy with a numeric term value. My question is there anyway in ordering this query by the term value? The taxonomy is called 'individual-group' Any help would be hugely appreciated thanks. Josh


Sidebar Generator issue

I hope this doesn't come across as very dumb (to some extend it is, however), but I am having a hard time dealing with the Sidebar Generator. In the description it is stated that "Now supports themes with multiple sidebars.". If I understand this correctly, it would mean that if my theme has let's say 3 predefined widget areas, using this plugin I'd be able to populate each one of them with different custom sidebars (combinations of widgets) for every single page, right? To simplify it further, let's assume that I register sidebars like this:               if ( function_exists('register_sidebars') ) {         register_sidebars(3);     }      Then I call them - one in sidebar.php and two in footer.php - like this:               if ( function_exists('dynamic_sidebar') && dynamic_sidebar(1) )...     if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) )...     if ( function_exists('dynamic_sidebar') && dynamic_sidebar(3) )...      The plugin documentation states that every instance of dynamic_sidebar() should be replaced with generated_dynamic_sidebar(). Here comes my question then - is it possible to call a sidebar like this:               if ( function_exists('dynamic_sidebar') && generated_dynamic_sidebar(1) )      and still be able to modify it through the Sidebar Generator? Basically, I'm needing this in order to have 3 separate areas which can be populated with custom sidebars on a per page basis. It, as you've already guessed, doesn't work as desired by me. I can't replace Sidebar 1 with a custom created sidebar through the plugin. Is it possible to do this and what exactly am I missing? On the other hand, if I call sidebars with               if ( function_exists('dynamic_sidebar') && generated_dynamic_sidebar() )      I am then able to replace them through the plugin by choosing Replace WP Default Sidebar with ... which doesn't actually satisfy me as then I have 3 areas with the same content which is far from useful. I am, to say it again, aiming at having a number of areas with unique identifiers which are able to house different combinations of widgets on different pages. Any help is greatly appreciated! P.S. Hope I didn't sound like a neanderthal! :)


Display 3 posts with different HTML markup using a loop

I want to be able to display 3 posts from the same category on my index.php page, but due to the way my site's HTML/CSS is coded I'm having some difficulty understanding the correct way to go about doing this using a loop (as the code for the divs being used are not the same for all three sections, it's using different CSS styles to achieve a layered effect/look ). Here is the HTML code

Headline 1

Nullam sit amet scelerisque est.

Aliquam erat volutpat. Duis sed nisi nunc, faucibus rutrum mauris.

Nullam iaculis lorem ut tortor ullamco per aliquet. Integer id leo non mauris pulvinar gravida vitae a enim.

Nullam sit amet scelerisque est.

Headline 2

Paragraph text

Headline 3

List item

      Any help would be very much appreciated.


Custom rewrite rule takes place AFTER the generic category rule

I've got a custom post type defined to handle a company's distributors. It takes a post and routes it under `/distributors/abc-truck-sales`. I noticed that loading `/distributors/` matches up to a category_name and is queried as such. I've got a custom rewrite rule that is **supposed** to make `/distributors/` into a redirection to the index.php               add_rewrite_rule('distributors/?$', 'index.php?show=all&post_type=distributor', 'top');      This rule is correctly added to the rewrite rules, and yet the rule `'(.+?)/?$' => 'category_name=distributors',` _always matches first_! What do I have to do to prevent a category view? **Unset it?** Update 1: Changing the permalink category and tag bases accomplished nothing. Except prefix the paths, of course. If I load up `/distributors/` it still assumes that it's a category (and I can change it to any old category and it'll load it).


Conditional tags help (if none, don't display anything)

Although I've read several times through the Wordpress Codex, I have difficulties to do what I want. Actually this is for certain parts of my blog, so I guess once I figure out how to do it I can make it work for all of them. For example: If there are no tags, the CSS coding is still shown (background, image etc.) which looks weird. Same for Recent Posts and Pingbacks. My setup for the them looks like this:               <?php if ( have_comments() ) : ?>

Pingbacks
     <?php wp_list_comments(array(       'callback'=>'mytheme_comment',       'type'=>'pings',     )); ?>
      <?php else : // this is displayed if there are no comments so far ?>              <?php if ('open' == $post->comment_status) : ?>                            <?php else : // comments are closed ?>
Comments are closed.
              <?php endif; ?>     <?php endif; ?>      And the function.php code for the comments:               function mytheme_comment($comment, $args, $depth) {        $GLOBALS['comment'] = $comment; ?>        <li <?php comment_class('clearfix'); ?> id="li-comment-<?php comment_ID() ?>">          <?php echo get_avatar($comment,$size='63'); ?>          <div id="comment-<?php comment_ID(); ?>">
             <?php printf(__('%s'), get_comment_author_link()) ?><?php edit_comment_link(__(''),'  ','') ?> <?php printf(__('%1$s @ %2$s'), get_comment_date('Y/n/j'),  get_comment_time('G:i')) ?>
               <?php comment_text() ?>

                          <?php if ($comment->comment_approved == '0') : ?>              <?php _e('Your comment is awaiting moderation.') ?>
           <?php endif; ?>
              <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>

     <?php }      The page link is only shown when there's actually more than 1 page, so why doesn't that work for the tags as well? Related Posts:
Related Posts

                                                            <?php                                  $backup = $post;                                 $tags = wp_get_post_tags($post->ID);                                 if ($tags) {                                     $tag_ids = array();                                     foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;                                          $args=array(                                         'tag__in' => $tag_ids,                                         'post__not_in' => array($post->ID),                                         'showposts'=>4, // Number of related posts that will be shown.                                         'caller_get_posts'=>1                                     );                                     $my_query = new wp_query($args);                                     if( $my_query->have_posts() ) {                                         while ($my_query->have_posts()) {                                             $my_query->the_post();                                         ?>
<a href="<?php the_permalink() ?>" rel="bookmark"><?php the_post_thumbnail(array(120,80)); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>

                                         <?php                                         }                                         echo '';                                     }                                 }                                 $post = $backup;                                 wp_reset_query();                                  ?>

      How do I get them to display everything (including CSS) only if there actually is content to show? Thanks a lot in advance.


Archive dropdown styling not applied

I am trying to add a custom dropdown for archives but struggling with couple of mistakes that might be the reason why it doesn’t work. The CSS only gives my dropdown the `width`, not the other styles included for it. I am pretty sure the issue is about PHP. I can’t attach option values to more than just the first choice. How can I fix that? ### PHP               <select id="cd-dropdown" name="cd-dropdown" class="cd-select"                   onChange='document.location.href=this.options[this.selectedIndex].value;'>     <option value="-1"><?php echo attribute_escape(__('Select Month')); ?></option>     <?php wp_get_archives('type=monthly&format=option&show_post_count=1'); ?> </select>      ### CSS               .cd-dropdown > span,     .cd-dropdown ul li:nth-last-child(-n+3) span {         box-shadow: 0 1px 1px rgba(0,0,0,0.1);     }      I think the problem is about values. I am trying to style my dropdown the way Codrops teaches: here. Right now I don’t get any style at all to my dropdown, except the `width` that is set to `300`.


Custom post type, taxonomy and admin bar

I have two kind of post types in my WordPress website:   1. "Articles" which is the classic post type   2. "Breves" which is a custom post type I want them to share the same standard categories and post tags so this is how I created the "Breve" custom post type as a plugin:               function breve_register() {              $labels = array(             'name' => _x('Brèves', 'post type general name'),             'singular_name' => _x('Brève', 'post type singular name'),             'add_new' => _x('Ajouter', 'portfolio item'),             'add_new_item' => __('Ajouter une brève'),             'edit_item' => __('Editer une brève'),             'new_item' => __('Nouvelle brève'),             'view_item' => __('Voir la brève'),             'search_items' => __('Rechercher une brève'),             'not_found' =>  __('Aucune brève trouvée'),             'not_found_in_trash' => __('Aucune brève trouvée dans la corbeille'),             'parent_item_colon' => ''         );              $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => null,             'supports' => array('title','editor','thumbnail'),             'taxonomies' => array('category', 'post_tag')           );               register_post_type( 'breve' , $args );     }     add_action('init', 'breve_register');      It works well as I can select a category and define a post tag when I create a new "breve" post, the same way I would with a new "article". **My concern:** Before registering the taxonomies of "Breves", only the "Articles" section displayed the "Categories" and "Post tags" links on the left admin menu bar. Now, these two links also appear under the "Breves" section of the left admin menu bar which is redundant. At least, I would like to see the "Categories" and "Post Tags" links only for "Articles", not for "Breves" on the left admin menu bar. But if possible (this would be awesome), I would like "Categories" and "Post Tags" to show only once and at the SAME LEVEL than "Articles" and 'Breves" on the Admin menu bar, not inside any of these two sections. It would make sense as now "Categories" and "Post Tags" are shared by more than one section so putting them under a single section would raise an ergonomic and logic issue. May I ask you some help on how to achieve this? Thank you.


Replacing strings within posts with the translatable string

I am working on a multi language website. Some posts have external resources for download. 'Download' string which is wrapped in `a` tag for download is in english across all languages. How can I wrap these strings to make them translatable? I tried search 'Download' and replace with `<?php _e('Download', 'rkm') ?>` but php block is wrapped in comment tags as it is, I presume, within the `<?php the_content() ?>` function. If you need more info please do not hesitate to ask. Thanks in advance!


How do I show content from a plugin using the template the site is currently working with?

I am trying to extend the first serious plugin that I am building. I'd like to be able to use it with different sites/templates. At the moment I designed a custom page that I included with the plugin that outputs a bunch of data that is edited through the plugin. I built 1.0 of this so it looked fine with the theme that was being used while I built the template. But when I tried using a new theme everything got messed up (I kind of expected that to be honest). To help answer the question my approach has been the following with this page:               <?php     /*     Template Name: Football Game (Single)     */     get_header(); ?>

          Custom content here

          <?php get_sidebar(); ?>     <?php get_footer(); ?>      This looks fine on the original template I was developing for, but on the new template (Twenty Fourteen), the nav on the left covers it up, and the nav has no menu items anymore. I am simply looking for a technique/approach/methodology to make plugin content display nicely in a variety of templates.


unable to override style block within wp_head()

I am using the wpbootstrap theme based on bones. I noticed that my website had a white band along the top and I haven't been able to workout what was causing it however I have finally worked it out. the tag has a padding of 42px attributed. I have tried to override this within my css file but because it is loaded within wp_head() and includes !important it won't seem to work. Below is the code: Part of header.php               wordpress head functions         <?php wp_head(); ?>         end of wordpress head      Loaded HTML on website:               <style type="text/css" media="screen">     html { margin-top: 32px !important; }     * html body { margin-top: 32px !important; }     @media screen and ( max-width: 782px ) {         html { margin-top: 46px !important; }         * html body { margin-top: 46px !important; }     }     </style>      my custom.css:               html {     margin-top: 0 !important;     }      Any help would be appreciated


Create menu locations for each category in wordpress

I need display a special menu in each category page in wordpress, for example I have 3 category: horse,dog,cat So I must have 3 menu in Menu Settings **locations** with name: horse,dog,cat with this code in `functions.php` I get all categories name:               $category_ids = get_all_category_ids();     foreach($category_ids as $cat_id) {       $cat_name = get_cat_name($cat_id);       $arr = $cat_name;     }      and with this code in `functions.php` I register menu:               register_nav_menus( array(       'primary' => 'Main Navigation',       'secondary' => 'Footer Navigation',       $arr     ));      but it's not working and registers only last category, I think we must import `register_nav_menus`'s `array` in `foreach`, but I don't know how to do it


How to get current action?

I am developing custom registration form. Is it possible to get current action (comment adding or user registration) in function? For example i am using:               add_filter('preprocess_comment', 'checkQuestion');     add_filter('registration_errors', 'checkQuestion', 10, 3);      So, from function `checkQuestion` i need somehow to know from what action it was called?


Linking a user with a specific post type they are allowed to modify and hide the rest

I've looked everything on internet but didn't found the answer to my problem. Here is my situation. I'm using, for a college website, Wordpress 3.8 and the amazing plugin Advance custom field and CPT UI. I created custom post type for differents sections in the college (programmes, single formation, etc...) and in each section, I got all the formations related to this section. Each section have their administrator and each formations have their teachers. The problem is, is their any way to set 1 or more person to see only the sections they're related to and the teachers to see / add only the formation IN the section they are related too? Edit: For more precision on my problem, it's not the Custom post type that I want to hide when you don't have the right permissions but what's inside. For exemple, in my category program, I got all the programs that the college have (i.e. Web design, metal inspection, starting your own buisiness, etc.. wich they are in different sectors) I want the teacher of Web design, for exemple, to see only Web design and not metal inspection and starting your own buisiness...wich ACF don't do.