User accounts: allow users login to cms and change ONLY their profile page?

We want to create profiles for individuals/companies which would allow them to login to the backend and adjust their profile. Is there any easy way to handle logins for hundreds of pages that only allow the user to see and edit their page rather than everyone elses pages as well? So essentially the admin of Wordpress would have access to everyones pages but the individual/company would only have access to their page - which they can then update. UPDATE: Sorry, I meant that an actual page would represent their profile. I guess forget the word profile for now - can a user login to the cms and only edit a page they have created? Therefore if a hundred people created a new page, I only want them to be able to edit their own page.


Convert shortcode into html form

I want to convert this shortcode.               [list-style="one"]     a     b     c     d     [/list-style]      To ouput like this one (html form)

a

b

c

d


How to get a unique nonce for each Ajax request?

I've seen a couple of discussions about getting Wordpress to regenerate a unique nonce for subsequent Ajax requests, but for the life of me I can't actually get Wordpress to do it-- every time I request what I think should be a new nonce, I get the same nonce back from Wordpress. I understand the concept of WP's nonce_life and even setting it to something else, but that hasn't helped me. I don't generate the nonce in the JS object in the header via localization- I do it on my display page. I can get my page to process the Ajax request, but when I request a new nonce from WP in the callback, I get the same nonce back, and I don't know what I'm doing wrong... Ultimately I want to extend this so that there could be multiple items on the page, each with the ability to add/remove-- so I need a solution that will allow multiple subsequent Ajax requests from one page. (And I should say I've put all of this functionality into a plugin, so the front-end "display page" is actually a function included with the plugin...) functions.php: localize, but I don't create a nonce here               wp_localize_script('myjs', 'ajaxVars', array('ajaxurl' => 'admin-ajax.php')));      Calling JS:               $("#myelement").click(function(e) {         e.preventDefault();         post_id = $(this).data("data-post-id");         user_id = $(this).data("data-user-id");         nonce = $(this).data("data-nonce");         $.ajax({           type: "POST",           dataType: "json",           url: ajaxVars.ajaxurl,           data: {              action: "myfaves",              post_id: post_id,              user_id: user_id,              nonce: nonce           },           success: function(response) {              if(response.type == "success") {                 nonce = response.newNonce;                 ... other stuff              }           }       });     });      Receiving PHP:               function myFaves() {        $ajaxNonce = 'myplugin_myaction_nonce_' . $postID;        if (!wp_verify_nonce($_POST['nonce'], $ajaxNonce))           exit('Sorry!');             // Get various POST vars and do some other stuff...             // Prep JSON response & generate new, unique nonce        $newNonce = wp_create_nonce('myplugin_myaction_nonce_' . $postID . '_'             . str_replace('.', '', gettimeofday(true)));        $response['newNonce'] = $newNonce;             // Also let the page process itself if there is no JS/Ajax capability        } else {           header("Location: " . $_SERVER["HTTP_REFERER"];        }        die();     }      Frontend PHP display function, amongst which is:               $nonce = wp_create_nonce('myplugin_myaction_nonce_' . $post->ID);     $link = admin_url('admin-ajax.php?action=myfaves&post_id=' . $post->ID        . '&user_id=' . $user_ID        . '&nonce=' . $nonce);          echo 'ID        . '" data-user-id="' . $user_ID        . '" data-nonce="' . $nonce        . '" href="' . $link . '">My Link';      At this point I'd be _really_ grateful for _any_ clues or pointers in getting WP to regenerate a unique nonce for each new Ajax request... * * * UPDATE: I've solved my problem. The code snippets above are valid, however I changed the $newNonce creation in the PHP callback to append a microseconds string to ensure that it is unique on subsequent Ajax requests.


Adding link post format to theme and permalink to rss feed

I have been in the process of adding the link post format to the thematic theme via a child theme. To be honest, this is the first time I have done any sort of theme work with WordPress. I have been able to change the title permalink to the link I am linking to and adding a symbol to the title so that there is a visual to someone to realize that there may be a different behavior. (Example post) Should I be using thematic's filters to push out these changes to the theme or should I be using WordPress's? Also, how do I add a permalink in the RSS feed so people can still comment on my site (much like Daring Fireball) I have been doing the following in `functions.php`:               /**      * Override the post title logic      */     function mikewillsthematic_thematic_postheader_posttitle() {         if (has_post_format('link')) {             $posttitle = '
';             $posttitle .= '∞ ';             $posttitle .= get_the_title();                $posttitle .= "
\n";         } else {             // Handle other post types.         }         return $posttitle;     }     add_filter('thematic_postheader_posttitle', 'mikewillsthematic_thematic_postheader_posttitle');          /**      * Override the RSS URL      */     function mikewillsthematic_rss_permalink($permalink) {         global $wp_query;         if($url = get_post_meta($wp_query->post->ID, 'post_format_data', true)) {             return $url;         }         return $permalink;     }     add_filter('the_permalink_rss', 'mikewillsthematic_rss_permalink');          /**      * Override the RSS title      */     function mikewillsthematic_rss_title($title) {              if (has_post_format('link')) {             $posttitle = '∞ ';                 $posttitle .= $title;         } else              $posttitle = $title;              return $posttitle;     }     add_filter('the_title_rss', 'mikewillsthematic_rss_title');      But I feel that this seems... excessive. Is there a better way?


Duplicate results are displayed in a custom plugin

I'm building a custom plugin for a Wordpress project I'm building as it's quite a specific project, and there isn't an off the shelf plugin suitable for the task. On one page I want to list objects from the database (which is also a custom database table) in a table. There is currently one item in the database, and I can echo this fairly easily to the page without any issue. The problem occurs when I try to put this data in to a HTML table, so when there is more than one object in the database it can be presented properly. However, as I have said there is only one record in the database at this moment, but when I include this data in to a table it displays the same record twice. Here is my code:               <?php         global $wpdb;         $satrent = $wpdb->get_row("SELECT id, name FROM phones WHERE phonetype = 'satellite' AND rent = '1'", ARRAY_N);     ?>      And for the HTML table:                       <?php             foreach($satrent as $sr)             {             ?>
                  	                 <?php print $satrent[1]; ?>	                 View	                 Edit	                 Delete
         <?php         }         ?>      Have I missed something or done something wrong? Many thanks!


Change ul class="children" for wp_list_pages?

Hello I'm using this code to print a list of Pages and Subpages:
     <?php wp_list_pages('title_li=&depth=2&child_of='); ?>
      It outputs:

Page 1

Page 2

Subpage 2a

Subpage 2b

Page 3

Subpage 3a

Subpage 3b

Page 4

      Is there a way to override the `<ul class="children">` for something else in the **functions.php**? like `<div class="container"><div class="container2"><ul>` and the closing to `</ul></div></div>` I was checking this example but I don't know how to apply it to my case... Any help appreciated, thanks!


Exclude custom post type from search by custom field value?

I've been unable to find anything on how to do this, or if it's even possible. What I want to do is not display results of search in custom post type "resources" on which "resource_usertype" (key) is not "Public" or "Students" or "Alumni" (values). Or maybe a better way to say it is to only display search results in which values of "resource_usertype" are "Public", "Students", or "Alumni".


Can't override template file in child theme

I have my WordPress installation running using a child theme based on a theme I have bought. The original theme has templates files in a template folder `/original_theme/template/testimonial.php`. I want to override one of the files inside this folder so I copied it to my child theme's folder `child_theme/template/testimonial.php`. As far as I understand the documentation on child themes this is the recommend way to apply changes to the template files. This works for the `header.php` file but not for the template file I want to override. Changes are ignored and even an empty file displays the correct content. Is there anything else I have to do?


Can I insert the feature image inside the content, after any paragraph?

I want to display the feature image inside a post text, perhaps after the third or fourth paragraph (or any) into the_content. Searching the site I've found this code, by Amit:               add_filter('the_content', function($content)     {        $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );        $img = '';        $content = preg_replace('#(
.*?
)#','$1'.$img, $content, 1);        return $content;     });      Works like a charm, but I can't figure out how include the post_thumbnail after a defined paragraph (not only the second). Can anybody point me on the right direction? Thanks in advance!!


Is there a way to show different source feeds on individual pages?

As a freelance writer, I have a few outlets I write for routinely plus additional sites, and while I used to post my content manually, due to SEO concerns and logistical issues, I have been looking to modify my Wordpress install to pull posts of mine from my client websites and display the content as it is added. I'm not sure if this is a valid comparison, but essentially I want to use Wordpress like Mahara which seems to be built for you to post all types of content, like a digital potfolo, all in one place. Although I did try Mahara (http://demo.mahara.org/) for a short period, I ultimately went back to Wordpress because of the community and also the fact I'm used to using it for client projects and such. Thanks in advance for any assistance,


Need Help Creating a Multi-Step, Video-Guided Enrollment Site

I have a distinct idea, and the beginnings of some ideas of how to implement it, but I find myself already spiraling off into research tangents and side- paths that can't possibly be healthy, so I figured I'd admit my ignorance and ask for help. I'd like to craft a website whose primary elements are one (or possibly more, if that's easier) videos guiding you through an enrollment process, and then one or more pages dedicated to holding forms and downloads related to said enrollment. In essence, my original vision was a site with a guide video situated in the top-left or top-center, approximately 5 minutes long, that discusses the basic technical elements of enrollment along with some fuzzier stuff (e.g., important dates, information about the program, etc.). Below or beside that, there would be a multi-step "enroller"--e.g., a step to collect name/address/contact info, a page to download important documentation, a page to submit additional survey information, etc. Since the video relates to all these steps, I'd like the video to remain static while the user steps through the enrollment process. Furthermore, since there are several steps, I'd prefer the enrollment process to use a sort of (Previous Page) (Next Page) structure to keep the contents of each step simple--if they were all just listed out on a single "page," it would stretch too far vertically and draw the user away from the video. Finally, I'd like the video playing and the enrollment procedure to operate independently from one another. If the user finishes one step of enrollment and goes to the next, I don't want the whole page to refresh, reloading the video and making the user lose their place. I suspect that judicious use of iframes will be key here, but since the video's going to be hosted on Youtube, I am unsure if that might complicate things. Theme isn't very important, and I'm happy to get any number of plugins--even paid ones--to make it work. Since I've already gazed into a number of rabbit's holes with plugins and iframes and modifying PHP files, I figured it'd be wise to ask if there's a preexisting theme or template for this before I lose untold amounts of time learning everything from scratch, but the specifics of what I want are hard to search for. Thanks for any help you can give!


New blog created with Wordpress is not crawlable by sitemap software

I have a new blog at glowingstart.com (didn't want to add it to the question, but the domain is needed to verify that it can't be crawled by that sitemap- generating site) and I was trying to use this site http://www.xml- sitemaps.com/ to create a sitemap. I have created sitemaps for other sites there and it worked fine. But with this new site, I got an error. Is there some setting which prevents crawling that Wordpress has? Or what may be the reason for this? Thank you!


How do I assign this filter to a variable? (Appending php & markup to the_content)

===I HAVE SOMETHING THAT WORKS NOW, JUST NOT CORRECTLY. PLEASE READ THE WHOLE POST, I AM GOING TO LEAVE IT ALL UP HERE BECAUSE OTHERS MAY BE ABLE TO BENEFIT FROM ME BUMBLING THROUGH THIS PROCESS!! I am using the Advanced Custom Fields plugin v3.1.5 (current as of this writing) and I have a problem that I just can't seem to solve. I have created a "field group" and it renders correctly on the post edit screen. The meta box is specifically for the author to enter affiliate links. I have included a true/false field at the beginning of the box, so if it is checked (returns true), then the meta box will display on the front end of the site. This actually works perfectly. I added my code:               <?php if(get_field('affiliate_checkbox')){ ?>

             Weedub Product Recommendations

                     <?php the_sub_field('label_affiliate'); ?>

                     <a href="<?php the_sub_field('link_affiliate'); ?>" target="_blank" alt="reference link" title="reference link"><?php the_sub_field('text_for_link_affiliate'); ?>

      This was added just after               <?php the_content(); ?>      and therein lays the problem. I have a plugin that appends a "sponsors box" to the end of the_content and that sponsor box displays BEFORE my affiliate meta box. I understand why this happens (generally) but I am absolutely CLUELESS as to how to get my code to be appended to the content instead of writing it in AFTER the content. I found the WordPress codex page that talks about the "the_content filter" but I just can't get it to work. I honestly don't even know how to start! Can I write this filter into my functions.php file and have it APPEND my code to the end of the_content and get it to display BEFORE the plugin's "sponsor box"???? I REALLY need help with this, I have thoroughly exhausted 3 full days working on this to no avail... Any and all help is appreciated, as I'm no php wizard, and I'm at my wits end -Aaron ===================EDIT=========================== I've got something working now, but it's breaking some other filters on the page... BUT ... it IS working, lol :               function weedub_affiliate_filter($content) {          print $content; if (is_single()) { ?>

             Weedub Product Recommendations

                     <?php the_sub_field('label_affiliate'); ?>

                     <a href="<?php the_sub_field('link_affiliate'); ?>" target="_blank" alt="reference link" title="reference link"><?php the_sub_field('text_for_link_affiliate'); ?>

                    add_filter( 'the_content', 'weedub_affiliate_filter', 9 );      I know that it isn't right according to WordPress, I have stumbled on a post written by Ian Stewart about 3.5 years ago: Here is the link It taught me how to make it work the incorrect way!! There are 2 comments below the post that attempt to say how to do it the right way, but the commenters assume you know what you are doing, lol. =============EDIT===================== Ok... I'm not getting any errors any more, which is phenomenal! but, scroll down towards the end of the page here: Just past END OF THE_CONTENT you will see that there is no data from the fields... I am pretty sure that it has something to do with this line: `if (is_single() && get_field('affiliate_checkbox') && get_field('affiliate_label')) {` but.. I'm not sure! Tim, you are awesome, we are getting REALLY close!


Is there a social members only login plugin for WordPress?

I'm totally new at WordPress and I'm setting up a site where I want members- only pages. But I also want my members to be able to login with there social network logins (Facebook, Twitter, OpenId, etc). If possible, I would also want to allow non-members to comment on public posts, but not view (and so not comment on) members-only posts. Is such a thing possible with WordPress and/or a certain (combination of) plugin(s)?


Handling custom taxonomies

I am redesigning my website and in the process I am also streamlining the way to navigate the content. Currently, my content is divided in default WP categories by content type and topics like this:   * Reviews     * Topic1     * Topic2     * Topic3   * News And that's all. News dont have any further hirarchy and that makes it quite hard for users to find related content. The solution I've thought involves use of WP's Custom Taxonomy feature. According to my plan, i'll be a making a new set of categories. The current ones will be named as 'Content Type' and the new ones will be 'Topics'. Author will have to select two categories with every post from these two sets: **Content Type:**   * News   * Review **Topic:**   * Topic1   * Topic2   * Topic3 With that issue solved, now I need something for users to navigate the content. As I am using Genesis, i'll make use of its two menus in header. One will show links different content types along with home and other usual buttons. While the secondary menu will show the topics. What I want help is with what happens when someone clicks those links. For content type links, i plan to use simple list of posts. But for topics, I want something advanced. I want a page which shows Topic name on top along with tabs for different content types filed under that topics. Something like this. Can you guys give me some pointers that how can I achieve this?


Add common Post Actions to Custom Meta Column

I've created a custom post section and removed all of the default items (title, editor, etc...) using add_action and added my own custom meta boxes. The Issue: Since i've removed the default Title box there's no way to get back into the post since it shows the custom meta box content in custom columns on the top level of the section: ![Custom Meta Column Display](http://i.stack.imgur.com/pKrmI.png) The Question: How do I add the "Edit | Quick Edit | Trash | View" options to the custom column like WordPress does by default with the Title? Code being used for section:               add_action('init', 'addchic_register');          function addchic_register() {              $labels = array(             'name' => _x('Addy Chicken', 'post type general name'),             'singular_name' => _x('Addy Chicken', 'post type singular name'),             'add_new' => _x('Add New', 'addchic item'),             'add_new_item' => __('Add New Convo Item'),             'edit_item' => __('Edit Convo Item'),             'new_item' => __('New Convo Item'),             'view_item' => __('View Convos Item'),             'search_items' => __('Search Convos'),             'not_found' =>  __('Nothing found'),             'not_found_in_trash' => __('Nothing found in Trash'),             'parent_item_colon' => ''         );              $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             /*'menu_icon' => get_stylesheet_directory_uri() . '/article16.png',*/             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => null,             'supports' => array('')           );               register_post_type( 'addchic' , $args );     }      Meta boxes:               add_meta_box("addy_meta", "Addy", "addy_meta", "addchic", "normal", "low");               function addy_meta(){       global $post;       $custom = get_post_custom($post->ID);       $addy = $custom["addy"][0];       ?>       <input size="100" name="addy" value="<?php echo $addy; ?>" />       <?php     }      Thanks!


How can I add a custom column to the "Manage Categories" table?

I've done this with posts, but I can't find the proper way to reference the category table's columns. I'm trying to add a column titled "Image" to the table, so that when the table grid of categories is displayed, if there is a category image assigned to the category, it will appear in the grid. The first step for me is to determine the proper filter to address in order to insert the columb into the table. I've tried each of these to no avail...               add_filter('manage_categories_columns', 'myFunction', 10, 2);     add_filter('manage_category_columns', 'myFunction', 10, 2);          function myFunction($cat_columns)     {         $cat_columns['cat_image_thumb'] = 'Image';         return $cat_columns;     }


Determining What Content Gets Displayed

I'm looking into using Wordpress as a basic content management system. I'm quite confused about what determines what content gets displayed when and where. For a simple example, I installed a theme and now I see something like this at the bottom of my "page": _By admin on April 26, 2011 | Edit_ There's also a comment box down there and I didn't expect one to be there. It appears that all I have to do is edit my page.php file to change this behavior but I'm a little baffled as to why the content delivery is so tightly coupled to the theme. I can make these changes now but if I decide to install a different theme I'm back at square one. It seems I should just be able to change a few settings to determine if I want those items (above) displayed when I create a "page". I see there are many ways that content delivery is determined. Here's a quick list:   1. Settings within the Wordpress control panel. (Widgets, Menus, etc)    2. PHP code within your theme files.    3. Custom post types.    4. Plugins  So here's the question I've come to. Are there any simple rules or guidelines to help me determine what I might need to edit or customize when it comes to determining what gets displayed where?


Display types of posts in edit.php instead of All, Published, Scheduled and Draft

By default, the post list (edit.php) in the admin panel displays a couple of options. It looks like this: All (10) | Published (8) | Scheduled (1) | Draft (1) I want to change this to display different types of posts, either by a custom taxonomy or by category. What I want it to look like is this: Articles (5) | Releases (5) | Scheduled (1) | Draft (1) So, the default when opening the Posts list should only include posts marked as articles, while the posts marked as releases should be in another window. Is there any way to change this? I've been trying for a while, but can't figure it out.


How to change header image size in custom themes

I'm using WP 3.5 for a CMS for one of our clients. I need to have a bigger header image than 940 × 250 pixels, so I changed width and height parameters, but when I try to upload a new image, it still asks me to crop it. What am I doing wrong?                   $settings = array(         'width'                  => 1700,         'height'                 => 300,         'flex-height'            => true,         'flex-width'             => true,         'header-text'            => false,         'uploads'                => true,     );     add_theme_support( 'custom-header', $settings );


Looking for references to WordPress Popularity Statistics

I found a recent report putting WordPress at 10-15% of the Alexa Top 1 Million Sites. http://hackertarget.com/2011/03/web-tech-2011-report/ Do you have any references to other similar data or reports (not only Top 1M)?


post_class not working with css

through the codex I read about how to use the post_class() function to create a css hook for styling the content. Here is the code I have, PHP:               <li class="<?php post_class();?>"> <?php the_title(); ?>
     <p class="<?php post_class(); ?>"> <?php the_content(); ?>
      However, the following CSS does not work, the styling does not change:               .category-blockquote {     color: green;     }      This is despite the codex saying you can prefix a category name with 'category-' in your CSS to hook onto that content. https://codex.wordpress.org/Function_Reference/post_class Any help on why my code is not working would be much appreciated. Thanks in advance.


Wordpress media manager multiple selection output

I'm trying to use media manager in metabox, and I need to use multiple select. I just have problem with doing output from that selection. I need element in metabox to hold all selected files urls. My code is here:               jQuery(document).ready(function($){     var custom_uploader;     $('#upload_image_button').click(function(e) {         e.preventDefault();         //If the uploader object has already been created, reopen the dialog         if (custom_uploader) {             custom_uploader.open();             return;         }         //Extend the wp.media object         custom_uploader = wp.media.frames.file_frame = wp.media({             title: 'Choose Image',             button: {                 text: 'Choose Image'             },             multiple: true         });         custom_uploader.on('select', function() {             selection.map( function( attachment ) {             attachment = attachment.toJSON();             $("#obal").after("<img src=" +attachment.url+">");             });         });         custom_uploader.open();     });     });      What's wrong with it?


Lists Top Authors by Most Recent Posts

I'm trying to display a table format of the top authors listed by the most recent posts. It should display the author, its avatar, the date, and the title of the post (with a link). I have it listing the top authors along with the avatar. But it won't display the title of the post or the correct date. Here's what I have so far:               $uc=array();     $blogusers = get_users_of_blog();     if ($blogusers) {     foreach ($blogusers as $bloguser) {     $userpost = get_posts('showposts=1&author='.$bloguser->user_id);     $uc[$bloguser->user_id] = '';     if ($userpost) {       $uc[$bloguser->user_id]=$userpost[0]->post_date;     }     }     arsort($uc);     $i = 0;     foreach ($uc as $key => $value) {          $user = get_userdata($key);     $post_id= $user->postID;     $post_title= $user->post_title;     $post_date= $user->post_date;     $post_count = get_usernumposts($user->ID);     if ($post_count && $i < 10) {       $author_posts_url = get_author_posts_url($key);             ?>

                             <img src="<?php bloginfo ('template_directory'); ?>/images/authors/<?php print $user->user_login; ?>.jpg" onerror= "this.src='<?php bloginfo ('template_directory'); ?>/images/authors/default.jpg'" width="45" height="50">
<?php printf ("%s
", $post_id,$post_title)?>

By <?php print $user->display_name;?>

Posted <?php the_time(get_option('date_format'));?>

      <?php    }      $i++;     }     }


ecommerce plugin with "buy for a friend" feature

Does anyone know about any ecommerce plugin with a feature to send the purchase to a friend? I need that feature but I cannot find any around. I would appreciate any information on this.


Frontpage pagination issue with paginate_links() function

I'm using following snippet to output pagination:               // get the current page          if ( get_query_var('paged') ) {         $current_page = get_query_var('paged');     } else if ( get_query_var('page') ) {         $current_page = get_query_var('page');     } else {         $current_page = 1;     }          // structure of “format” depends on whether we’re using pretty permalinks     $permalink_structure = get_option('permalink_structure');     $format = empty( $permalink_structure ) ? '&page=%#%' : 'page/%#%/';          echo paginate_links(array(           'base' => get_pagenum_link(1) . '%_%',           'format' => $format,           'current' => $current_page,           'total' => $total,           'mid_size' => 4,           'type' => 'list'     ));      When I set permalink type to `http://wordpress/?p=123` and use static page for frontpage with pagination, I recieve wrong URLs like: `http://wordpress/&page=2` instead of: `http://wordpress/?page=2` If you navigate to `http://wordpress/?page=2`, links in pagination will be also wrong, because current URL with queries goes as a base, for example: `http://wordpress/?page=2&page=3` If I use any other permalink type with rewriting, everything works fine. I'm looking any solution for this snippet and frontpage pagination. Thanks in advance for any help. **UPDATE:** My main problem was a mistype at `&page=%#%` but actually i need `&paged=%#%` and i add condition with is_front_page() function to switch `&` to `?` for frontpage query.


jquery-ui-autocomplete not loaded

I am using Advanced Custom Fields for a registration form on Classipress and I have indicated that the Business Name, First Name, Last Name and Type of owner are required fields. However, when I test the registration form it allows me to skip all of those and go directly from password to captcha. I want those fields captured to assure myself that the businesses are legitimate for the use of the site since I can't always tell from the email address. A response I got in a classipress forum was the script 'jquery-ui-autocomplete is not loaded' and that I should check to see if cp_load_scripts had been modified. The response also said the coad I was looking for was "wp_enqueue_script ('jquery-ui-autoomplete'); I understand php only minimally and don't know where to begin looking for or adjusting any of this script. . . does anyone have a minute to explain what it is -- and where to look -- and perhaps why. . . thanks very much Unfortunately this is one of those places where a little knowledge is a dangerous thing -- but it isn't enough!


Problem with login form

I'm having a problem with the login form for a site I've inherited, wherein only certain users are sent to the correct page after logging in. On this site, users with accounts are allowed into a special area. These accounts are all normal WordPress user accounts with very limited access. In order to access this special area of the site, users must use a login form. The login form appears to be based on this code for customizing the wp-admin login:               <?php     if ( ! is_user_logged_in() ) { // Display WordPress login form:     $args = array(                'redirect' => admin_url(),           'form_id' => 'loginform-custom',           'label_username' => __( 'Username custom text' ),           'label_password' => __( 'Password custom text' ),           'label_remember' => __( 'Remember Me custom text' ),           'label_log_in' => __( 'Log In custom text' ),           'remember' => true            );            wp_login_form( $args );       } else { // If logged in:     wp_loginout( home_url() ); // Display "Log Out" link.       echo " | ";       wp_register('', ''); // Display "Site Admin" link.       }     ?>      from this page: https://codex.wordpress.org/Customizing_the_Login_Form The former web designer had changed the `admin_url()` bit to `site_url( '/foo/bar/ ' )` and the `wp_loginout( home_url() )` bit changed to `wp_redirect('/foo/bar' )`, and it worked just fine. I changed these to `site_url( '/foo/ '` and `wp_redirect('/foo/' )`. Just about everything works as you would expect. If you're already logged in and click our login link, you're kicked to `/foo/`. Problem is: if you're not already logged in, upon logging in you're still kicked to `/foo/bar/`. However, administrator accounts who log in here are correctly kicked to `/foo/`. So far, I've run `grep -rl "/foor/bar" /wordpress/site/path` to find any remaining references to this path, but they are all just buttons and hyperlinks. I'm fairly new at this; is there something obvious I'm missing?


How to display original unmodified thumbnail

I have uploaded a few images that are being used as thumbnails. I cropped them within WordPress to be square and focus on the subject of the image. I have also got a slider that is rectangular and shows one image at a time. At the moment the sliders displays each posts thumbnail which is square and modified. I was wondering how you can display each posts original uploaded image for the thumbnail and if this is even possible. This is all on the homepage. Any help and advice welcome.


linking to an svg through comments_popup_link

I want to remove the text in the comment section and replace it with svg which falls back to png. This is my code so far                    <?php comments_popup_link('<object type="image/svg+xml" data="images/comment.svg"></object>', '1 <object type="image/svg+xml" data="images/comment.svg"></object>',                  '%<object type="image/svg+xml" data="./images/comment.svg"></object>'); ?>      I don't see anything wrong with my code plus my i have chmoded the images folder and its contents to 777, any pointers would be great. I am very new to Wordpress theme development so please excuse me if this is trivial. thanks


Cannot save post meta data as Administrator in Wordpress

I have an wordpress installation at yogazoga.com with several custom post types. When i try to add meta data to posts through admin panel it simply does not work. See the post at: yogazoga.com/listing/yoga-collective/ , the contact details below the post content are all meta data and blank at the moment . Interestingly when i post it as an editor, it works fine, like on this page: yogazoga.com/listing/shari-ser/.


Post Size Limit

I am in the process of writing a very long post -- currently 8,500 words and around 40 images, with more to come -- and, all of a sudden, the preview doesn't work: It just shows empty content, with the header loading correctly. The symptoms are the same as described on this page, however I am not using any shortcodes. (Although, maybe that wouldn't matter: If the problem is with PHP's RegExp, then whether there are shortcodes or not, length will still be an issue.) Unfortunately, this is on a managed server, so I have no way of changing the PHP.ini file. As such, what are my options? If this is the likely cause, presumably the only thing I can do is split my post into several. Any other ideas?... Thanks :) EDIT: Using WP 3.2.1


How to make shortcodes parse in two different themes

I've got a mobile and a desktop theme for my website , but the shortcodes in my desktop theme are a lot more functional than the ones in my mobile theme, I use only the shortcodes in my desktop theme, but as expected, the shortcodes in my desktop theme don't parse in my mobile theme. I want some of the shortcodes in my desktop theme to parse in my mobile theme too. I've read that the `do_shortcode()` function does the trick but I don't know how to implement it in my mobile theme. Thanks!


Two Custom Post Types with Identical Articles Competing for the same Slug

I have created two custom post types, each with it's own slug. Each custom post type contains some articles with the same title. So ideally I would have . . customposttype1/mainarticle/ customposttype2/mainarticle/ Instead I get . . . customposttype1/mainarticle/ customposttype2/mainarticle2/ <\-- with the extra 2 on the end The permalinks are set to "postname". Any help would be appreciated.


After 3.5.1. upgrade, posts appearing on Site yet *NOT* in WP admin!

Upgraded to newest WP version yesterday and with that many of my posts disappeared from admin. However, they do appear fine online. If you go to link below, all posts on Projects section of site were previously IN admin. Clearly they exist somewhere, just not sure how to retrieve. I can see all associated keywords in admin (along w/ number of posts linked to keywords). http://tri-lox.com/projects/ Any ideas how this might have happen and how I can reverse? Pls help! Thanks.


How do I edit the htaccess file to optimize my website?

Hi I have tried to optimize my website energyshop.se for a cpl of days but I cant seem to get it done. This is how my .htaccess looks like:               Header unset ETag     FileETag None     # Hantera och redirecta användare till en gemensam error-sia     ErrorDocument 404 /psych/cgi-bin/error/error?404           # BEGIN Compress text files      <ifModule mod_deflate.c>       <filesMatch "\.(css|js|x?html?|php)$">         SetOutputFilter DEFLATE       </filesMatch>     </ifModule>     # END Compress text files           # BEGIN Expire headers      <IfModule mod_expires.c>     ExpiresActive On     <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf|form)$">     ExpiresDefault "access plus 1 year"     </FilesMatch>     </IfModule>     # END Expire headers           # BEGIN Cache-Control Headers      <ifModule mod_headers.c>       <filesMatch "\.(ico|jpe?g|png|gif|swf)$">         Header set Cache-Control "max-age=2592000, public"       </filesMatch>       <filesMatch "\.(css)$">         Header set Cache-Control "max-age=604800, public"       </filesMatch>       <filesMatch "\.(js)$">         Header set Cache-Control "max-age=216000, private"       </filesMatch>       <filesMatch "\.(x?html?|php)$">         Header set Cache-Control "max-age=600, private, must-revalidate"       </filesMatch>     </ifModule>     # END Cache-Control Headers           # BEGIN Turn ETags Off      <ifModule mod_headers.c>       Header unset ETag     </ifModule>     FileETag None     # END Turn ETags Off           # BEGIN Remove Last-Modified Header      <ifModule mod_headers.c>       Header unset Last-Modified     </ifModule>     # END Remove Last-Modified Header          # BEGIN Gzip Compression     <ifModule mod_gzip.c>       mod_gzip_on Yes       mod_gzip_dechunk Yes       mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$       mod_gzip_item_include handler ^cgi-script$       mod_gzip_item_include mime ^text/.*       mod_gzip_item_include mime ^application/x-javascript.*       mod_gzip_item_exclude mime ^image/.*       mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*     </ifModule>     # END Gzip Compression          AddDefaultCharset UTF-8     DefaultLanguage sv-SE          # Force “File Save As” Prompt     AddType application/octet-stream .avi .mpg .mov .pdf .xls .mp4 .rar      But the problem is that when I run tests they still say that I containing ? to shorter, cleaner ones. Some of it works fine but not the big things as I mentioned. If i look me up uing a newly created php-file with only in it an then run it in a browser it actually tells me that (in two plaes): _SERVER["HTTP_ACCEPT_ENCODING"] gzip,deflate,sdch and _ENV["HTTP_ACCEPT_ENCODING"] gzip,deflate,sdch so i guess it is supported but I havent made the right code or something. Anyone that solved these kind o problems before?


Saving Meta Data within Custom Post Type

I cannot figure out why these functions aren't saving the data for price and location while saving startdate and starttime. When I do print_r($custom) - I can see that [events_price] => Array ( [0] => ) is blank..                function event_detail_box_content( $post ) {         $custom = get_post_custom($post->ID);         $meta_sd = $custom["events_startdate"][0];         $meta_pr = $custom["events_price"][0];         $meta_lo = $custom["events_location"][0];              $meta_st = $meta_sd;              $time_format = get_option('time_format');              if ($meta_sd == null) { $meta_sd = time(); $meta_st = 0;}              $clean_sd = date("D, M d, Y", $meta_sd);         $clean_st = date($time_format, $meta_st);              echo '<input type="hidden" name="events-nonce" id="events-nonce" value="' . wp_create_nonce( 'events-nonce' ) . '" />';              ?>

Event Date<input name="events_startdate" class="tfdate" value="<?php echo $clean_sd; ?>" />

Event Time<input name="events_starttime" value="<?php echo $clean_st; ?>" />Use 24h format (7pm = 19:00)

Event Price<input name="events_price" value="<?php echo $meta_pr; ?>" />

Event Location<input name="events_location" value="<?php echo $meta_lo; ?>" />

         <?php         print_r($custom);      }             add_action ('save_post', 'save_events');             function save_events($post_id){              if ( !wp_verify_nonce( $_POST['events-nonce'], 'events-nonce' )) { return; }              if ( !current_user_can( 'edit_post')) return;              if(!isset($_POST["events_startdate"])): return; endif;              $updatestartd = strtotime ( $_POST["events_startdate"] . $_POST["events_starttime"] );         update_post_meta($post_id, "events_startdate", $updatestartd );               update_post_meta($post_id, "events_price", $POST["events_price"] );          update_post_meta($post_id, "events_location", $POST["events_location"] );       }


WordPress admin bar overlapping twitter bootstrap navigation

I am having an issue with the WordPress admin bar overlapping the twitter bootstrap (2.3.0) nav bar. I have tried this fix:               body.admin-bar .navbar-fixed-top {         top: 28px;     }          .navbar .brand {         color: #000 !important;         text-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 30px             rgba(255, 255, 255, 0.125);         font-weight: bold !important;     }          .nav-container {         padding-left: 0;         padding-right: 0;     }          .nav-tabs, .nav-pills {         margin-top: -6px;     }          .dropdown-menu li>a:hover,.dropdown-menu li>a:focus,.dropdown-submenu:hover>a         {         color: #fff !important;     }          #inner-header {         width: 100%;     }          input,textarea,select,.uneditable-input {         margin-bottom: 0;     }          .navbar-form,.navbar-search {         margin: 0 0 9px;     }          .navbar-search {         padding-left: 0;     }          #s {         width: 100px;     }      but alas it is still posing an issue. I am wondering what fixes are available?


Use full size images in a specific gallery

Thumbnails are displaying as 100px however the full size is 130px which is what I want. I want this only in one specific gallery. Also would like to link each gallery thumbnail image to an external url


Do you use css reset in your child theme

I am trying to make a child theme . I want to use the html5 reset from this website . http://html5doctor.com/html-5-reset-stylesheet/ Anyone here use the code ? Can you find me a child theme with lots of functions and codes. I've downloaded and doing research . I think i need to know more. Please give me a standard child theme(if you want to) I've to explore more. Waiting for your answer . Happy New Year . Thanks .


Basic password protection without using users and roles

I'm using WooCommerce, and want to be able to password protect products (or preferably whole categories if possible), but without using the Users & Roles functionality build into WP(because I need anonymous guests to be able to enter the password too). I've tried the standard post password protection build into WP, but all that does is block the product's description from showing up (i.e. the body of the "post"), but it doesn't stop you from seeing the product image, details, etc (and in fact you can still purchase the product too). I've gone down the road of writing something myself (basically I included a custom attribute in any page I wanted protected, and then customised the page template's PHP code to require a password before displaying the page, but my attempts (so far) aren't working 100% because they screw with the cart/checkout process (I think it's interrupting the posted form data or something). Any ideas? Thanks Dave


Published posts counter

I'd like to have statistics for the website. Is there is any snippet to allow WP admin in Dashboard to monitor how many posts published daily or monthly by other users ?


Delete Child Posts

I'm trying to delete all child posts when the parent is deleted. The parent post deletes just fine, but the child posts are not properly deleting. Here's the code I have in place now:               $args = array(              'post_parent' => $parentid,             'post_type' => 'custom-type'         );              $posts = get_posts( $args );              if ($posts) {                  // Delete all the Children of the Parent Page             foreach($posts as $post){                      wp_delete_post($post->ID, true);                  }              }              // Delete the Parent Page         wp_delete_post($parentid, true);      What it should do is loop through and get the posts that are the child of `$parentid` and delete them, then delete the parent post. Currently, it just deletes the parent post, but leaves all the children behind. I'm looking at my database and the child pages are definitely created correctly with the correct `post_parent` id. Is there a way to get all child posts and delete them? Thanks, Jason


Admin can enter JavaScript - potential security risk?

WP 3.5/TwentyTwelve/Clean install. I try this when login as admin and editor. I try add reply for first post "Hello World":               <script>alert('XSS')</script><script><</script>      and get popup window ![enter image description here](http://i.stack.imgur.com/Q2y8t.png). Is it porential security risk or can no care? Thanks for advance..


How to change the title of a Meta Box on a specified Custom Post Type?

> **Possible Duplicate:**   >  Change The Title Of a Meta Box Is it possible to change the title of a Meta Box on a specific Custom Post Type add or edit page? For example, if I'm viewing the post type add or edit page for the Custom Post Type: `my_custom_post_type_name`, can I re-label the Meta Box "Publish" to something more like "My CPT Actions"?


Show Welcome Panel on Dashboard for every user

I have customised the welcome panel on the dashboard for users with information in. I then hid the "Dismiss" button and added CSS to make the welcome panel always visible. Using the 'welcome_panel' hook. This works fine for Admins but the Welcome Panel is not displayed for other users such as editors and authors. Its not that the admin panel is being hidden its not included in the source code. I need to find a way to include the welcome panel code for every user not just admins. Just found the following in `wp-admin/index.php`. So it will only show if user can edit_theme_options.               <?php if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :      Is there a way to edit this or call the do_action( 'welcome_panel' ); even if the user cannot edit_theme_options?


Removing the [...] from the excerpt returned by get_the_excerpt() only in some places

I wish to use the excerpt of a post in the meta description for better SEO, so I am using the get_the_excerpt() function to get the post's excerpt. However, I noticed that at the end it is adding [...] when the post's content is not separated by the More separator, and when it is longer than the configured maximum length. Is there a clean way to remove this [...] in the end of the excerpt? The function doesn't seem to have a boolean parameter to specify whether you want it, or anything of that sort. ** UPDATE ** I do not want to remove the [...] from the main index.php. I just want to remove it in certain instances (in the meta description), and leave it in others. So the hook solution does not work in this case. Thanks.


how to get category name if my category got custom slug

so my category got slug 'aeroplanes' and I need to get category names from it, but I can't get it with               $category = get_the_category($post->ID);      echo $category[0]->cat_name;      cause it takes all posts from default category with category slug 'category'. How can I do that if I got category slug 'aerpolanes'?


Admin - Load existing admin template as a submenu page

I'm trying to save my client a few clicks. I've created a custom role of "Customer" and I'd like to get them to that screen, without having to have them click "Users" and then select the "Customer" role. So, I have a custom menu called "Orders". I'd like to add a submenu called "Customers" and "load" this page: users.php?role=custom I'm guessing I have to use the callback function on add_submenu_page and then load that template? What's the right way to go about this?


Show category name and new articles and display page numbers. What function to use. Ex. cat name 1   * -listcat1 1 update   * -listcat1 2 update   * -listcat1 3 update   * -listcat1 4 update cat name 2   * -listcat2 1 update   * -listcat2 2 update   * -listcat2 3 update   * -listcat2 4 update pagination 1,2 paged=2 cat name 3   * -listcat3 1 update   * -listcat3 2 update   * -listcat3 3 update   * -listcat3 4 update and paged=x cat name x   * -listcatx 1 update   * -listcatx 2 update   * -listcatx 3 update   * -listcatx 4 update thank


multiple files in wordpress plugin

i'm trying to write a plugin with multi files, i'm sure i did it before without a problem but now i have the problem in the subject. in the main plugin file i included a file name - ydp-includes.php, inside of ydp-includes.php i included all the files i wanted like this:               <?php     include(dirname( __FILE__ ) .'/1.php');     include(dirname( __FILE__ ) .'/2.php');     include(dirname( __FILE__ ) .'/3.php');     include(dirname( __FILE__ ) .'/4.php');     ?>      but i'm getting: **Fatal error: Call to undefined function add_action().** The files are includes but for a reason i can't see at the moment wordpress doesn't see them as one plugin package and each wordpress function inside ignored. is there another best practice way to develop multiple files wordpress plugin ? what i'm doing wrong ? thanks


Custom Post Types and 404 Pages

I have tried refreshing my permalinks but I still cant get this to work correctly. I have the categories `movies`, `gaming`, `blu-ray`, and `tv` already created, so my URLs are `site.com/movies/` for example. I would like for a post for movies to be at `site.com/movies/post-here/` so for my custom post type my slug is `movies. All my normal wordpress psots under the category `movies` are now 404ing while posts created specifically from the post type `Movie Posts` is working fine. Is this normal? Is there a step I'm not including? Here are all my custom post types (Created with Custom Post Type UI):               //Movies Custom Post Type     register_post_type('movies_cp', array(  'label' => 'Movie Posts','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => 'movies'),'query_var' => true,'exclude_from_search' => false,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),'taxonomies' => array('category','post_tag',),'labels' => array (       'name' => 'Movie Posts',       'singular_name' => 'Movie Post',       'menu_name' => 'Movie Posts',       'add_new' => 'Add Movie Post',       'add_new_item' => 'Add New Movie Post',       'edit' => 'Edit',       'edit_item' => 'Edit Movie Post',       'new_item' => 'New Movie Post',       'view' => 'View Movie Post',       'view_item' => 'View Movie Post',       'search_items' => 'Search Movie Posts',       'not_found' => 'No Movie Posts Found',       'not_found_in_trash' => 'No Movie Posts Found in Trash',       'parent' => 'Parent Movie Post',     ),) );               //Gaming Custom Post Type     register_post_type('gaming_cp', array(  'label' => 'Gaming Posts','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => 'gaming'),'query_var' => true,'exclude_from_search' => false,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),'taxonomies' => array('category','post_tag',),'labels' => array (       'name' => 'Gaming Posts',       'singular_name' => 'Gaming Post',       'menu_name' => 'Gaming Posts',       'add_new' => 'Add Gaming Post',       'add_new_item' => 'Add New Gaming Post',       'edit' => 'Edit',       'edit_item' => 'Edit Gaming Post',       'new_item' => 'New Gaming Post',       'view' => 'View Gaming Post',       'view_item' => 'View Gaming Post',       'search_items' => 'Search Gaming Posts',       'not_found' => 'No Gaming Posts Found',       'not_found_in_trash' => 'No Gaming Posts Found in Trash',       'parent' => 'Parent Gaming Post',     ),) );               //Blu-ray Custom Post Type     register_post_type('blu-ray_cp', array( 'label' => 'Blu-Ray Posts','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => 'blu-ray'),'query_var' => true,'exclude_from_search' => false,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),'taxonomies' => array('category','post_tag',),'labels' => array (       'name' => 'Blu-Ray Posts',       'singular_name' => 'Blu-Ray Post',       'menu_name' => 'Blu-Ray Posts',       'add_new' => 'Add Blu-Ray Post',       'add_new_item' => 'Add New Blu-Ray Post',       'edit' => 'Edit',       'edit_item' => 'Edit Blu-Ray Post',       'new_item' => 'New Blu-Ray Post',       'view' => 'View Blu-Ray Post',       'view_item' => 'View Blu-Ray Post',       'search_items' => 'Search Blu-Ray Posts',       'not_found' => 'No Blu-Ray Posts Found',       'not_found_in_trash' => 'No Blu-Ray Posts Found in Trash',       'parent' => 'Parent Blu-Ray Post',     ),) );               //TV Custom Post Type     register_post_type('tv_cp', array(  'label' => 'TV Posts','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => 'tv'),'query_var' => true,'exclude_from_search' => false,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),'taxonomies' => array('category','post_tag',),'labels' => array (       'name' => 'TV Posts',       'singular_name' => 'TV Post',       'menu_name' => 'TV Posts',       'add_new' => 'Add TV Post',       'add_new_item' => 'Add New TV Post',       'edit' => 'Edit',       'edit_item' => 'Edit TV Post',       'new_item' => 'New TV Post',       'view' => 'View TV Post',       'view_item' => 'View TV Post',       'search_items' => 'Search TV Posts',       'not_found' => 'No TV Posts Found',       'not_found_in_trash' => 'No TV Posts Found in Trash',       'parent' => 'Parent TV Post',     ),) );


How to turn this customized core function into a filter/action in functions.php?

So in template.php the original function looks like this:                   function meta_form() {             global $wpdb;             $limit = (int) apply_filters( 'postmeta_form_limit', 30 );             $keys = $wpdb->get_col( "                 SELECT meta_key                 FROM $wpdb->postmeta                 GROUP BY meta_key                 HAVING meta_key NOT LIKE '\_%'                 ORDER BY meta_key                 LIMIT $limit" );             if ( $keys )                 natcasesort($keys);      Meanwhile someone in my office changed it to do this:                   function meta_form() {             global $wpdb;                if ( isset($_GET['post']) )             $post_id = (int) $_GET['post'];           elseif ( isset($_POST['post_ID']) )             $post_id = (int) $_POST['post_ID'];           else             $post_id = 0;                if ( $post_id ) {             $post_ = get_post($post_id);                }                if ($post_->post_type == 'video_photo' ){             $limit = (int) apply_filters( 'postmeta_form_limit', 30 );             $keys = $wpdb->get_col( "                 SELECT meta_key                 FROM $wpdb->postmeta             where meta_key like 'tqmcf_%'                 GROUP BY meta_key                 HAVING meta_key NOT LIKE '\_%'                 ORDER BY meta_key                 LIMIT $limit" );           }else{             $limit = (int) apply_filters( 'postmeta_form_limit', 30 );             $keys = $wpdb->get_col( "                 SELECT meta_key                 FROM $wpdb->postmeta                      GROUP BY meta_key                 HAVING meta_key NOT LIKE '\_%'                 ORDER BY meta_key                 LIMIT $limit" );           }                  if ( $keys )                 natcasesort($keys);      I've been doing research and it looks like any changes to the core should be done in my theme's function.php file using add_filter or add_action. Is this the right way to go? How would I do that? I still don't have too good of a grasp of how they work. Thanks for your help in advance.


500 Internal Server Error after Register dialog, but with successful registration

I get a 500 Internal Server error if I try to register a new user. This user will be created successfully, but I don't want that my users will see the error page and, therefore, think that something went wrong. My WordPress is hosted in a subdirectory of my institutions web page (e.g., `www.page.com/path/WordPress`). The installation itself is in the `/var/www` directory on an Ubuntu in a VirtualBox image. It seems that 500 Internal Server errors are quite common, but I didn't found a working solution for me in the web. Most discussions recommend to do one of the following things:   * Disable all plugins   * Change to default theme   * Checked Apache2 log   * Checked PHP log I tried them all, bot none works for me. Has somebody an additional recommendation?


Woocommerce purchase note?

I think i am missing something glaringly obvious here: I am trying to include the pruchase note in the customer-completed-order.php so the customer recives the note along with the pruchase confirmation. but i am failing miserably. here is what i have tried:                   <?php echo '
'.  $purchase_note .  'PURCHASE NOTE
'; ?>      and this                   <?php                    $purchase_note = get_post_meta( $_product->id, '_purchase_note');                         echo '
' .  $purchase_note . '
';                      ?>      and this:                   <?php                    $purchase_note = get_post_meta( $_product->id, '_purchase_note', true)) :                         echo '' . apply_filters('the_content', $purchase_note) . '	';                     ?>      and this:                   <?php       if ($order->status=='completed' || $order->status=='processing') {                     if ($purchase_note = get_post_meta( $_product->id, '_purchase_note', true))                         echo '

' . apply_filters('the_content', $purchase_note) . '

';                 } ?>      nothing seems to work.... it shows up on the order-received page but will not show on the order confirmed email. Any help is much apricated I am also open to some other method to get the note to the client upon purchase. such as custom meta values maybe?? Chris


Creating an accordion style menu

Is there any way to create a menu with dropdown list like the image below in WordPress ? ![accordion menu](http://i.stack.imgur.com/4Qtw0m.jpg)   _click to enlarge_ ⤴ Here, when we click on [+] sign the dropdown menu shows up, I can manage the CSS, but what would be the code to make this possible?


Why does WordPress rely on an fully qualified site_url with a 15-step plan for moving a site?

From the Moving WordPress codex page (emphasis mine): > When your domain name or URLs change there are additional concerns. The > files and database can be moved, however references to the old domain name > or location will remain in the database, and that can cause issues with > links or theme display. > > If you do a search and replace on your entire database to change the URLs, > you can cause issues with data serialization, due to the fact that some > themes and widgets store values with the length of your URL marked. When > this changes, things break. To avoid that serialization issue, you have two > options: > >   1. Only perform a search and replace on the wp_posts table. >   2. Use the Search and Replace for WordPress Databases Script to safely > change all instances. ( If you are a developer, use this option. It is a one > step process as opposed to the 15-step procedure below ) > What are the benefits of saving the site_url vs. using relative links? Is it because of performance? Or is there some other benefit (e.g. SEO-related or technical) when hyperlinks in the content are fully qualified? Because it certainly makes WordPress more difficult to use when developing in a team, when you have a shared database with your test/acceptance environment, and when 'going live' with a WordPress website.


Highlight posts currently being edited on multiple editor site?

I have a custom page that uses the Cleverness To-Do List plugin to display multiple posts on a page. My site has multiple editors, and if a post is currently being edited on the custom page (not the dashboard) by another editor, I want that post (in the form of a `<tr>`) to be highlighted. Can someone point me in the direction of how to accomplish this in the context of my custom page's structure? The site structure looks like this when you're editing a post: *****.com/blog/to-do-list/?action=edit-todo&id=1190 The PHP used to display the list:               /**      * Display the to-do list with checkboxes      */     public function display( $complete = 0 ) {         extract( shortcode_atts( array(             'title'      => '',             'priority'   => 0,             'assigned'   => 0,             'deadline'   => 0,             'progress'   => 0,             'category'   => 0,             'addedby'    => 0,             'date'       => 0,             'todoid'     => '',             'editlink'   => 0         ), $this->atts ) );         global $current_user;         get_currentuserinfo();         $this->add_script = true;         $layout = 'list';         $this->list = '';              list( $this->url, $this->action ) = CTDL_Lib::set_variables();              /** @var $title string */         if ( $title != '') {             $this->list .= '
'.esc_html( $title ).'
';             }              // get to-do items         /** @var $todoid int */         if ( $todoid != '' ) {                  $post = CTDL_Lib::get_todo( $todoid );             if ( $post ) {                 $id = $post->ID;                 list( $the_priority, $assign_meta, $deadline_meta, $completed_meta, $progress_meta ) = CTDL_Lib::get_todo_meta( $id );                      if ( CTDL_Loader::$settings['list_view'] == 2 ) {                     $completed = ( $todoid != '' && get_post_meta( $id, '_user_'.$current_user->ID.'_status', true ) == 1 ? 1 : 0 );                 } else {                     $completed = ( $todoid != '' && get_post_meta( $id, '_status', true ) == 1 ? 1 : 0 );                 }                      $this->show_checkbox( $id, $completed, $layout, ' single' );                 $this->show_todo_text( $post->post_content, 'list' );                 /** @var $priority int */                 if ( $priority == 1 ) $this->show_priority( $the_priority );                 /** @var $progress int */                 if ( $progress == 1 ) $this->show_progress( $progress_meta );                 /** @var $assigned int */                 if ( $assigned == 1 ) $this->show_assigned( $assign_meta );                 /** @var $addedby int */                 if ( $addedby == 1 ) $this->show_addedby( get_the_author() );                 /** @var $deadline int */                 if ( $deadline == 1 ) $this->show_deadline( $deadline_meta );                 /** @var $date int */                 if ( $date == 1 ) $this->show_date_added( get_the_date(), get_the_date( CTDL_Loader::$settings['date_format'] ) );                 $this->list .= do_action( 'ctdl_list_items' );                 /** @var $editlink int */                 if ( $editlink == 1 ) $this->show_edit_link( $id );             } else {                 /* if there are no to-do items, display this message */                 $this->list .= '
'.apply_filters( 'ctdl_no_items', esc_html__( 'No items to do.', 'cleverness-to-do-list' ) ).'
';             }              } else {                  /** @var $category mixed */             $this->loop_through_todos( 0, $category );              }              wp_reset_postdata();     }      PHP used to create the `<tr>`:               /**      * Creates the HTML for the To-Do List Table Headings      * @param $completed      */     public function show_table_headings( $completed = 0 ) {         extract( shortcode_atts( array(             'priority'   => 0,             'assigned'   => 0,             'deadline'   => 0,             'progress'   => 0,             'categories' => 0,             'addedby'    => 0,             'date'       => 0,             'editlink'   => 1         ), $this->atts ) );              $this->list .= '

';         $this->list .= '	';         $this->list .= ''.apply_filters( 'ctdl_heading_item', esc_html__( 'Item', 'cleverness-to-do-list' ) ).'	';         /** @var $priority int */         if ( $priority == 1 ) $this->list .= ''.apply_filters( 'ctdl_heading_priority', esc_html__( 'Priority', 'cleverness-to-do-list' ) ).'	';         /** @var $progress int */         if ( $progress == 1 && CTDL_Loader::$settings['show_progress'] == 1 ) $this->list .= ''.apply_filters( 'ctdl_heading_progress', esc_html__( 'Progress', 'cleverness-to-do-list' ) ).'	';         /** @var $categories int */         if ( $categories == 1 && CTDL_Loader::$settings['categories'] == 1 ) $this->list .= ''.apply_filters(             'ctdl_heading_category', esc_html__( 'Expeditor',             'cleverness-to-do-list' ) ).'	';         if ( CTDL_PP ) $this->list .= ''.apply_filters( 'ctdl_heading_planner', esc_html__( 'Post Planner', 'cleverness-to-do-list' ) ).'	';         /** @var $assigned int */         if ( $assigned == 1 && ( CTDL_Loader::$settings['assign'] == 0 && ( CTDL_Loader::$settings['list_view'] != 0 && CTDL_Loader::$settings['show_only_assigned'] == 0                 && ( current_user_can( CTDL_Loader::$settings['view_all_assigned_capability'] ) ) ) || ( CTDL_Loader::$settings['list_view'] != 0 && CTDL_Loader::$settings['show_only_assigned'] == 1 )                 && CTDL_Loader::$settings['assign'] == 0 ) ) $this->list .= ''.apply_filters( 'ctdl_heading_assigned',             esc_html__( 'Assigned to', 'cleverness-to-do-list' ) ).'	';         /** @var $addedby int */         if ( $addedby == 1 && CTDL_Loader::$settings['list_view'] == 1 && CTDL_Loader::$settings['todo_author'] == 0 )             $this->list .= ''.apply_filters( 'ctdl_heading_added_by', esc_html__( 'Added By', 'cleverness-to-do-list' ) ).'	';         /** @var $deadline int */         if ( $deadline == 1  && CTDL_Loader::$settings['show_deadline'] == 1 ) $this->list .= ''.apply_filters( 'ctdl_heading_deadline',             esc_html__( 'Deadline',             'cleverness-to-do-list' ) ).'	';         /** @var $date int */         if ( $date == 1 && CTDL_Loader::$settings['show_date_added'] == 1 ) $this->list .= ''.apply_filters( 'ctdl_heading_date_added', esc_html__( 'Date added',             'cleverness-to-do-list' ) ).'	';         if ( $completed == 1 && CTDL_Loader::$settings['show_completed_date'] == 1 ) $this->list .= ''.apply_filters( 'ctdl_heading_completed', esc_html__( 'Completed', 'cleverness-to-do-list' ) ).'	';         $this->list .= do_action( 'ctdl_table_headings' );         /** @var $editlink int */         if ( $editlink == 1 && current_user_can( CTDL_Loader::$settings['edit_capability'] ) || CTDL_Loader::$settings['list_view'] == 0 )             $this->list .= ''.apply_filters( 'ctdl_heading_action', esc_html__( 'Action', 'cleverness-to-do-list' ) ).'	';         $this->list .= '

';     }


List post wit the same category but exclude parent

I have the followind code:               <?php global $post;                 $cat_ID=array();                 $categories = get_the_category(); //get all categories for this post                     foreach($categories as $category) {                         array_push($cat_ID,$category->cat_ID);                     }                 $args = array(                     'orderby' => 'date',                     'order' => 'DESC',                     'post_type' => 'post',                     'numberposts' => 10,                     'post__not_in' => array($post->ID),                     'category__in' => $cat_ID                 );                 $cat_posts = get_posts($args);                     if ($cat_posts) {                              echo 'SOME HTML';                              foreach ($cat_posts as $cat_post) { ?>      It currently lists all post which contain the same category as the current post you are on. What I would like it to do is to exclude the parent category. The a example category list / example would look like this: Work   \- Animation   \- Film   \- Misc When on a post eith the cat Animation all the other posts with the same cat show up (which is good ) but so does the main parent 'Work'. How do I exclude it? THANK YOU!


Custom url structure - pages under a custom post type

I'm struggling with the structure of my Wordpress site and I was hoping you might be able to give me some advice. The site is for a series of events and the structure is as follows:   * Gateway (contains a list of events)      * London 2012 (a specific event)        * Overview (default for event)       * Speakers       * Agenda       * Venue       * Register     * New York 2012        * Overview       * Speakers       * Agenda        * Venue       * Register I am using several custom post types, and each have a number of custom fields attached: Events: the information from this custom post type is used to create the Overview page Speakers: this a pool of the potential speakers. Speakers are added to a specific event using the above custom post type Venue: this is a pool of potential venues. The venue is added to a specific event using the above custom post type I would like the structure of the site to be as follows:   * / - Gateway   * /london-2012/ - A specific event overview   * /london-2012/speakers - Speakers page   * /london-2012/agenda - Agenda page   * /new-york-2012/speakers - Another speakers page   * etc. …where an identical page 'types' (eg. speakers page) will all use the same template across the board (I'll just get the parent event from the URL and do a custom query to grab the data for the page). Can anyone suggest the best way to do this? I believe either a URL rewrite solution or categories may work but I'm unsure about both :( **Update 1** Have sorted this using redirects - for example, speakers pages:               add_rewrite_rule(       '^event/([A-Za-z0-9-]+)/speakers/?$', //Checked against the global $wp object - $wp->request       'index.php?page_id=9&event_slug=$matches[1]', //Use WP_Query params to find your page       'top' //This will superceed the default WP rewrite stack     );      then registered the variable:               add_filter('query_vars', 'my_query_vars');          function my_query_vars($vars){         $vars[] = 'event_slug';         return $vars;     }


Block wordpress style for my plugin admin page

I have my own style for my plugin, it works, but wordpress adds a style too, and the page is not looking very ok. Is there any way to block wordpress style for my plugin administration page?


using wp_remote_get to retrieve own url on local host

I have a website in local development at test:8888 and I am trying to get the following to work in my functions.php file.               $response = wp_remote_get( 'test:8888/?p=1' );     print_r($response);      Unfortunately this is printing               WP_Error Object ( [errors] => Array ( [http_request_failed] => Array ( [0] => A valid URL was not provided. ) ) [error_data] => Array ( ) )        Is it possible to request your own url while developing on localhost?


Registering post type is not adding to admin menu

I started playing with an idea a few days ago that will be using custom post types. I've never used CPTs before and am running into issues with the basic registration process. The following registration code is hooked into `init` and I have verified that it is running, however I am not seeing "Slides" appear in the admin menu. *EDIT: WP_DEBUG is enabled and nothing is being produced.*               register_post_type(self::$post_type, array(         'labels'               => array(             'name'               => __('Slides', 'bonestheme'),             'singular_name'      => __('Slide', 'bonestheme'),             'add_new_item'       => __('Add New Slide', 'bonestheme'),             'edit_item'          => __('Edit Slide', 'bonestheme'),             'new_item'           => __('New Slide', 'bonestheme'),             'view_item'          => __('View Slide', 'bonestheme'),             'search_items'       => __('Search Slides', 'bonestheme'),             'not_found'          => __('No Slide Found', 'bonestheme'),             'not_found_in_trash' => __('No slides found in Trash', 'bonestheme')         ),         'capability_type'      => array('slide', 'slides'),         'description'          => 'Represents a single slide in the header slideshow.',         'hierarchical'         => false,         'menu_position'        => 5,         'public'               => false,         'register_meta_box_cb' => array('SlideJS', 'createCPTMetaboxes'),         'rewrite'              => false,         'show_in_admin_bar'    => false,         'show_in_nav_menus'    => true,         'show_ui'              => true,         'supports'             => array('title', 'thumbnail')         )     );          remove_post_type_support( self::$post_type, 'editor' );


Change the output of wp_title()

I use wp_title to generate some kind of breadcrumb and it works well, but in there I have the title of the _site_ , and I want to delete that. It looks like this: Taxonomy1: City | Title of the site. I get that by using `<?php wp_title(); ?>`. How can I delete the title of the site in that output?


Remove all nav menu classes ( but keep useful ones... )

I'm trying to remove all menu-item classes (except for `.current- menu-{item/parent/ancestor`} and `.menu-item-has-children`)               function custom_nav_menu_css_class($classes) {         $classes = preg_replace('/^((menu|page)[-_\w+]+)+/', '', $classes);         return $classes;     }     add_filter('nav_menu_css_class', 'custom_nav_menu_css_class');      This almost does the job, _except_ it removes `.menu-item-has-children`? Any idea what I should change, to exclude it from being removed? (P.S. I'd rather not use a custom walker...)


Sort posts with multiple meta_keys

does anybody know how to filter post by meta_key1 (meta_key1=something) and order by meta_key2 at the same time ? `query_posts('post_type=press_articles&posts_per_page=5&meta_key=dt_featured_press_radio&meta_value=yes&order=ASC')` how add order by meta_key2 here ? thanks!


Images will not attach to posts after site migration

I recently migrated a WordPress install from a subdirectory to the root. After the migration everything worked great, except that I can no longer set a featured thumbnail or add a picture in the WYSIWYG. On a possibly related note, I can only set post tags from the Quick Edit screen and not the post edit screen. When I click set featured image on the post edit screen it opens the screen to add media, but it opens in a new page, not like in a box before. When I click to the media library and click show next to an image, it does not show and so I can't select "use as featured image." I can still upload the photo, but I can't attach it to the post. I'm not sure if the tags issue is related, but whenever I enter a tag in the Post Tag box it will not save. But if I go out to the All Posts listing, I can enter them via Quick Edit. Any ideas? Thanks in advance.


Page Navigation not working for the next pages

I use a custom template to display the lists of post. The pagination design works, and even the post_per_page works but then it only display the post indicated for the post per page. so when clicked to the next page. it only displays nothing. I have searched through internet and tried the given solutions however it didnt worked out. I am just a newbie with wordpress. Your help is so much appreciated. thank you :) Here is my code for the custom page template:                      <?php        $paged = ( get_query_var( 'paged' ) ) ? (get_query_var( 'paged' )) : 1;       $temp = $dynamic_que;       $dynamic_que= null;         if ( isset( $_POST['nextbtn'] ) )          {              $given_id = $_POST['catidfwd'];                  /*  query_posts( array ( 'category__and' => 4208,$given_id) );                     // The Loop                     while ( have_posts() ) : the_post();                     $postid = get_the_ID();                       echo '
';                           the_title();                       echo 'ASC);                     //$dynamic_que->query('paged'=>$paged);                 $dy_que = array ('category_id' => $given_id, 'posts_per_page' => '7', 'page'=>$paged);                  $dynamic_que = new WP_Query($dy_que);                     //$dynamic_que = new WP_Query($dy_que);                     while ( $dynamic_que->have_posts() ) {                         $dynamic_que->next_post();                         echo '
' . get_the_title( $dynamic_que->post->ID ) . '
';                     }       ?>

                     <?php                          wp_pagenavi( array( 'query' => $dynamic_que) );                          wp_reset_postdata();                         $dynamic_que = NULL;                         $dynamic_que = $temp;                     ?>

          <?php         }  // end of isset     ?>


get_page_by_title not working when used with a variable

My page title is `This is my title`, if I try and retrieve the ID from the title like this then it does not work:               $mytitle = 'This is my title';     $mytitle2 = get_page_by_title( $mytitle, OBJECT, 'mycustompost' );     print_r($mytitle2);      But if I do this it does work:               $mytitle2 = get_page_by_title( 'This is my title', OBJECT, 'mycustompost' );     print_r($mytitle2);      What gives? Does `get_page_by_title` not accept variables?


How to show selected value in dropdowm menu

I have a problem, I want to show the user the selected value the user has selected before. I have a `custom post` type I have created and I have also a separate plugin that's using a custom db. What I have done is make the dropdowm menu with all the custom posts (show posts name) and then the user choose what custom post they need to get the post link. Then I copy the post permalink into var and uptade the permalink into plugins DB. Here is the code that print all `custom post type`               <select class="edit-link-field" name="link[<?php echo $id ?>]">                 <?php                 $args = array(                     'post_type' => 'test_reviews',                     'position' => 'pastor'                 );                 $pastorList = new WP_Query($args); while ($pastorList->have_posts()) : $pastorList->the_post();                 $postID = get_the_ID();                     $is_selected = (get_the_title() == $selected) ? 'selected="selected"' : '';                     echo '<option value="'.get_permalink( ).'" '.$is_selected.'>'.get_the_title().'</option>';                      endwhile; wp_reset_postdata();                 $test = get_permalink( );                      ?>                </select>      So what I need now is the same dropdown menu but with selected value that the user selected. and if the user will change the select value and will push on the "update button" it will update the new permalink to DB


How to add the widgets manually to the sidebar?

How can I add the widget manually in the code ?


Modify output of custom loop using WP_query

I have a custom loop from a custom post type and I want to NOT display posts with the category 'slider'. I'm using this to set up the query:               $args = array( 'post_type' => 'hotwives', 'posts_per_page' => -1);     $loop = new WP_Query( $args );     while ($loop->have_posts() ) : $loop->the_post();      I was going to use this in the $args variable:               'category' => 'slider'      But not sure how to make that NOT display the posts from category 'slider'. And, incidentally, when I use that in the $args variable it still shows every post, not just the 'slider' posts. So, seems I'm not on the right track regardless. Thanks!


Set Featured Post Automatically - First Image included IN the post

I want to set the featured image to the first image IN the post content. I've come across a few functions that grab the first image **attached** to the post. Sometimes a user will add an image to a post that was previously uploaded and used in another post, which causes this function to not grab any image because it doesn't see the image as attached to that post. This is the function that grabs the first image attached to the post, but I want it to grab the first image inside of the post content, even if its not directly associated to that post. I know this can be done with a plugin, but I'm trying to add a function to my functions.php file to avoid plugin bloat. Thanks               function autoset_featured() {               global $post;               $already_has_thumb = has_post_thumbnail($post->ID);                   if (!$already_has_thumb)  {                   $attached_image = get_children( "post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1" );                               if ($attached_image) {                                     foreach ($attached_image as $attachment_id => $attachment) {                                     set_post_thumbnail($post->ID, $attachment_id);                                     }                                }                             }           }     add_action('the_post', 'autoset_featured');     add_action('save_post', 'autoset_featured');     add_action('draft_to_publish', 'autoset_featured');     add_action('new_to_publish', 'autoset_featured');     add_action('pending_to_publish', 'autoset_featured');     add_action('future_to_publish', 'autoset_featured');


Post Admin - Filter by posts without tags

I am stuck on this one and it's probably a really simple answer but can anyone please shine some light on how to add a filter menu with an option value of 'No Tags' that when clicking the Filter button will only show posts that have no tags associated with them? Many thanks in advance!


Variables posting twice

I wish to create a new variable as described in the codex, but on submission of the URL the variables are submitted twice to my function I have tried this within a plugin also a the `function.php`. I have also tried to use `wp_reset_query()` Here is my sample code:               add_filter('query_vars', 'my_function');     function my_function ($vars) {           $vars[] = 'Q1';       $vars[] = 'Q2';           return $vars;         }          add_action('parse_query', 'query_var');         function query_var () {           if (get_query_var('Q1')){             echo ('hello');           }     }


Get image post ID in media upload

I am developing a plugin that adds a Custom Post Type to my theme. It's a retail directory and the post type is a retail listing. Everything is working fine. I can upload content to the DB and then print in a customized CSS framework I have developed. However, when i want to upload and display an image, that's when I have problems. The problem occurs when the image is uploaded. I use the update_post_meta() to update the meta information of the image which is related it to the post ID and post it to the database table "wp_postmeta" under column "meta_value". I also use the WP media upload JQuery Code to select the image. I'm not sure where the problem is exactly, but I know it's with the upload because when the image goes into the "meta_value" column has value NaN and not the ID value that it should be. Here's the upload code:               add_action( 'save_post', 'process_image_meta', 10, 2 );          function process_image_meta( $post_id, $post ) {             update_post_meta( $post_id, '_image_id', $_POST['upload_image_id'] );         }      And the wp media uploader code: And finally, the display code:               function display_retail_listing_meta_box($retail_listing) {         // Retrieve current shop details based on retail lisitng ID              global $post;                  $image_src = '';         $image_id = get_post_meta( $post->ID, '_image_id', true);         $image_src = wp_get_attachment_url( $image_id );     ?>

     Image Upload	     <img id="shop_image" src="<?php echo $image_src; ?>" style="max-width:100%;" />     <input type="text" name="upload_image_id" id="upload_image_id" value="<?php echo $image_id; ?>" />     <a title="<?php esc_attr_e( 'Upload Image' ) ?>" href="#" id="upload-image"><?php _e( 'Upload Image' ) ?>     <a title="<?php esc_attr_e( 'Remove Image' ) ?>" href="#" id="remove-image" style="<?php echo ( ! $image_id ? 'display:none;' : '' ); ?>"><?php _e( 'Remove Image' ) ?>

      Followed by the WP Media Upload Code:               jQuery(document).ready(function($) {                  // save the send_to_editor handler function             window.send_to_editor_default = window.send_to_editor;                  $('#upload-image').click(function(){                      // replace the default send_to_editor handler function with our own                 window.send_to_editor = window.attach_image;                 tb_show('', 'media-upload.php?$post_id=<?php echo $post->ID ?>&type=image&TB_iframe=true');                      return false;             });                  $('#remove-image').click(function() {                      $('#upload_image_id').val('');                 $('img').attr('src', '');                 $(this).hide();                      return false;             });                  // handler function which is invoked after the user selects an image from the gallery popup.             // this function displays the image and sets the id so it can be persisted to the post meta             window.attach_image = function(html) {                      // turn the returned image html into a hidden image element so we can easily pull the relevant attributes we need                 $('body').append('
' + html + '
');                      var img = $('#temp_image').find('img');                      imgurl   = img.attr('src');                 imgclass = img.attr('class');                 imgid    = parseInt(imgclass.replace(/\D/g, ''), 10);                      $('#upload_image_id').val(imgid);                 $('#remove-image').show();                      $('img#shop_image').attr('src', imgurl);                 try{tb_remove();}catch(e){};                 $('#temp_image').remove();                      // restore the send_to_editor handler function                 window.send_to_editor = window.send_to_editor_default;                  }              });         </script>


The uploaded file exceeds the upload_max_filesize directive in php.ini

I'm trying to upload a XML file through Wordpress Importer It shows this error, no matter what the size of the file is. Even 10kb file throws up this error. My php.ini settings were set to 100MB, still no change. Back to defaults, wich is 8MB. I'm starting to think it's permission related. Any ideas?


Wordpress HTTPS - Entry of URL with and without www doesnt lead to https

I dont want to post the exact same text here again (duplicate content), so maybe anybody can refer to my question, please: http://wordpress.org/support/topic/wordpress-https-entry-of-url-with-and- without-www-doesnt-lead-to-https Thanks in advance. Andre


Make WooCommerce pages accessible for logged in users only

I have a website using WordPress, and an e-commerce using WooCommerce. I would like my shop (and all its pages) to be seen by logged in users only. Via the _User Access Manager_ plugin, I have denied access to the shop page, but with a direct link to a product etc. one can access that particular page nonetheless, even if the user is not logged in. How can I redirect users, who are not logged in, to another page if they try to access a WooCommerce page?


How to determine what is generating large amount of database queries?

For some reason, my Wordpress site is using a lot of memory (spiking at 72MB) and generating a huge amount of database queries (76923 according to Wp- Memory-Usage. I'm really not sure why this would be, as there is nothing going on on the site that would create these. The only thing I can think of is the Ninja Forms plugin. The site is here: http://cbipath.com And the plugins installed are: BlackStudio TinyMCE Easy Bootstrap Shortcodes Ninja Forms Shortcodes Ultimate Page Builder by SiteOrigin TPC Memory Usage WP-Pro-Quiz Plugin Performance Profiler I have a plugin load time of .449 sec per visit, Plugin impact of 58.8% of page load time, and 98 MySQL queries per visit (all according to the Plugin Performance Profiler). Any insight would be hugely appreciated.


Metabox with file upload to custom directory

I've found lots of tutorials on how to create a metabox file uploader using wordpress' native file uploader. However, I would like to have the uploaded file placed in to a custom directory, and I'm having a hard time finding any info on it. Can anyone provide some leads? Thanks in advance!


Custom Post Type or Shortcode, What to choose?

While developing a _multipupose_ theme for _mass audience_ , i’m facing an issue. I’m going to code staff listing section. Now i was wondering, what should i do? 1: Create dedicated Custom Post Type for staff; or 2: Create Shortcode for it. Now each decision has some pros and cons. **a) Custom Post Type:**   * Centralization, can call same group of listing on mutiple places without defining each time.   * Better staff order managerment   * No need to enter detail page link specifically   * Taxonomy support, so better hierarchy   * _cons:_ dedicated CPT for it might be an overkill **b) Shortcode Approach:**   * _cons:_ cannot do anything with current shortcode generator which are described above and there would be too many fields in shortcode generator.   * _pro:_ less messy WordPress sidemenu Now is the best approach in this context?


How to create custom LOGIN and REGISTRATION forms?

I have developed a theme for Wordpress and I need to customize login and registrations form. At the moment, as usual, the login and the registration URL are:               http://www.example.com/wp-login.php     http://www.example.com/wp-login.php?action=register      I would like to create INLINE form, with INLINE I mean that this form must to be inside my pages and not in a single(dedicated) web page. For login I need:               - Email      - Password      For Registration:               - Name     - Email     - Password     (and a pseudo check for "spammers" like captcha or arithmetical operations)      as I told I need these forms in my pages, not in a dedicated page. Two questions: 1- Can I do it **WITHOUT** using a plugin? 2- If I can, how can I show any errors (example: wrong email, wrong password) inline with the form? (without redirect to wp-login.php) Thank you!


How can I do customizations on login, registration and password recovery forms?

There are a couple of answers here basically just linking to a plugin - to be fair there are some more specific ones too. I know there are many possibilities to use different hooks for the customization. I really want to learn more about that, but where do it start?


If on term-page -> get the current term?

I'm trying to write a kind of "breadcrumb" function in my "functions.php" I'd like to query if I'm on a term-page and if so I want to print the current term I'm in. By "term-page" I mean the following. I list all terms of a custom-taxonomy (associated with a custom-post-type) as kind of categories in my header. I do this with `get_term_link($term->slug, 'my_taxonomy')`; In my new function for the breadcrumbs I'd like to query if I'm on one of this pages and print this term. First off, … I'm doing this …               if ( is_taxonomy_hierarchical('my_taxonomy) ) {                 echo "test";      But now my function is depending on this `my_taxonomy` string. I'd love to work this function for all upcoming taxonomies. How can I do this? There are conditional tags like `is_category()` that doesn't need any params. Why do all term- or taxonomy-conditionals need this param? And how can I print the current-term i'm in. Right now I'm just echoing "test" up there, however I'd like to print the current term. Any ideas on that? Thank you in advance. **UPDATE:**               function list_breadcrumbs() {              $q_object = get_queried_object();         $taxonomy = $q_object->taxonomy;              $seperator = " ⟩ ";              if ( !is_home() ) {                      echo "Home" . $seperator;                  if ( is_category() ) {                 $category = get_the_category();                  echo "" . $category[0]->cat_name . "";             } else if ( is_tax( $taxonomy ) ) {                 echo "The Term Name";             } else if ( is_single() ) {                 …             } else if ( is_page() ) {                 …


update Semiologic?

I usually wait for Denis to let us know when to upgrade to the next SP and WP version.. Anyone know? Thanks Miami


Upload attachment from external site

For example, we have some image on the external site: http://site.com/image.png How do I upload this image to my wordpress as an image attachment by php? Image should be copied to my uploads folder, post added, meta generated.


Unified Approach for Placing Option Pages

Currently, it is up to any plugin's author as to where to put a link to the plugin's option page. I have seen at least the following "solutions":   * Plugin list   * Dashboard menu   * Plugins menu   * Appearance menu    * Tools menu    * Settings menu   * Tools menu   * Top level In my opinion, this is very bad style (globally, not necessarily individually). In addition to the mass of links in many different locations, Wordpress does not sort them or anything. As it is now, plugin developers can put anything anywhere in the menues and we probably want it that way; but there really should be a unified way of registering an options page such that is recognised and placed as such. Please see here, too. The old ways could remain valid, but I'd suggest recommending to use the standardised (and easy) way. I have lately thought about writing a plugin that provides such an frontend, that is offers a function for other plugin authors that registers an options page and cares for placing links to it in the appropriate places. The notion of _appropriateness_ could be hardcoded in a first version and be left to the user in subsequent iterations. I can even image a screen were users can put pages registered by plugins (not necessarily only option pages) were it suits them; if _the user_ thinks this plugin's options should be there, so be it. What do you think? In particular:   * As a plugin author, would you delegate to such a plugin?   * Do you think I should build it?   * Should I rather implement the feature directly into Wordpress, hoping that the main hackers approve and incorporate it?


How can I prevent uploading bmp image?

I need to prevent uploading bmp image for user. How can it be possible?


Mixing Regular Javascript With jQuery in a Plugin

Sorry for a simple question. I'm learning about plugins. I've got some javascript that I want to put in a jQuery file in my plugin. (I've got jQuery and the scripts enqueued, and working fine). Is it okay if I just prepend the javasvript to the jQuery? So, the file would look like this:               //regular javasript      function do_something() {       //do Something     }          jQuery.noConflict();          jQuery(document).ready(function() {       //my jQuery stuff     }      Is there a right way of doing this or does it not matter? If I put my straight javascript first (as above), it works. If I put the javascript in with the jQuery, wrapping it in jQuery(document).ready(function() { }, then it doesn't. Is it possible to add regular javascript in the jQuery ready function? Any ideas as to why it wouldn't work? I'm trying to learn.


Allow users mark posts as "complete"?

Any search keyword suggestions to help would be appreciated - not sure how best to describe this query :) I have a custom post type "module". I have ~300+ modules in my install. I have ~100+ registered users (Subscriber role) Query: I want to allow users to mark a "module" as "Complete" using a checkbox, and be able to get that info from DB when I'm generating lists of modules. Is there a plugin or hack available or any suggestions if I need to code it up myself? Any other suggestions?


Nginx rewrite rules

I am having some problems with the Nginx rewrite algorithm for WordPress. I am using this for the rewrite and it works good;                   server_name www.domain.com domain.com;         if ($host != 'domain.com') {         rewrite ^/(.*)     http://domain.com/$1 permanent;         }       it makes this url;               http://domain.com/?author=1       to this;               http://domain.com/author/username/      which is good but with an url like this;               http://domain.com/?author=1&type=like      it makes it;               http://domain.com/author/username/?type=like      and i am not getting any error but the query is not working. What i am missing?