title: Wordpress Theme Breaking on Migration to Live Site

text: I've developed a Wordpress site locally and have recently been trying to upload it to the server. Although every time I do so, the child theme I have created for the parent seems to break. I can't figure out why this is, as I can't see anything that has changed. It says that "the parent theme is missing. Please install the "Propulsion" parent theme." although it is clearly there, and can be activated. It might be worth mentioning too that when I originally migrated the site, nothing would show up when I tried to visit the site, not even an error message. Support from Dreamhost then told me that no theme was activated, and activated the default theme for me. It was from here that I could see the error with the child theme. I would just try and delete and reinstall the child theme, although when I do so I lose all of my theme options, custom templates etc. which have taken me quite a while to build, so really would be terrible if I had to start from scratch. Is there a way I can perhaps export all this data from my local copy if I can't get it working through a normal migration? I'm testing all this on a mirror of the site through Dreamhost, i'm not sure if that might have anything to do with the problem? Any help would be greatly appreciated, i've been battling with this for a while and am getting a little desperate! Thanks again, Jack


title: Can I display the widget admin in the page admin?

text: I would like to show the 'Appearance -> Widgets' menu underneath the text field in 'Pages -> new/edit'. Is it possible to take one part of the admin and show it elsewhere? Reading some of the answers, it seems this question get's misunderstood. I'm looking for a way to **show the widgets admin** **on the page edit admin screen**.


title: Incorrect filenames in load-scripts.php parameters

text: I'm attempting to load the media upload js file in a widget. The code works on my development machine and on the staging site but not on the live server. The error I get is that wp.media is undefined. I enqueue the scripts & styles I need with:               public function enqueue_admin_scripts($hook) {              if( $hook != 'widgets.php' )             return;              wp_enqueue_style('thickbox');         wp_enqueue_script('media-upload');         wp_enqueue_script('thickbox');         wp_enqueue_script('shw', get_template_directory_uri().'/js/custom-media.js');          }      However when viewing the link that is created, I see the following: `http://xxx.com/wp-admin/load- scripts.php?c=1&load%5B%5D=hoverIntent,common,admin-bar,jquery-ui- core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-sortable,jquery-ui- draggable,jquery-ui-dr&load%5B%5D=oppable,admin-widgets,svg- painter,heartbeat,wp-auth-check,jquery-ui-position,wp- pointer,thickbox,underscore,shortcode,media- uplo&load%5B%5D=ad&ver=3.8.1` As you can see `media-upload` has been displayed as `media-uplo&load` so the media functions are never included. Has anybody come across anything like this before or can give me some advice on where to start debugging?


title: Add specific word to default page permalink

text: Right now I am working on one of my client's project. Its all about amazon product display. My client wants me to change the permalinks of all posts, pages, serch results, archive pages, categorypages, all custom post type pages. I am very new to Rewrite API. I have read the documentation provide on wordpress codex here https://codex.wordpress.org/Function_Reference/WP_Rewrite and here https://codex.wordpress.org/Rewrite_API as well as on the interne but can't able to make the things clear. Can anyone help me to generate custom permalinks for my pages ? Right now, **Page url looks like** http://mysite.com/?page_id=2 **if its default permalink** and http://mysite.com/sample-page/ **if its post name permalink**. **I wants the page url looks like** http://mysite.com/info/sample-page. Here **info** is static word I want to be added to my page url. How can I achieve this ? Can anyone help me out in this situation ? I have already wasted my 2 days in this issue and I am sure its really simple for the one who already worked with this. Quick help much appreciated. Thank You, Aezaz


title: using rewrites to secure login page

text: I'm trying to be sneaky with iis to secure a wordpress login page (not my choice to run a windows server, but that's the reality of things). It's worked so far, only the login page itself loads itself before forwarding you to the admin panel so after a successful (or unsuccessful) login the first rule kicks in and sends you to the dummy page. My rules so far:               <rule name="redirect" patternSyntax="ECMAScript">         <match url="^installbase/wp-login\.php" />         <action type="Rewrite" url="installbase/index.php?page=403-forbidden" />     </rule>          <rule name="login" patternSyntax="ECMAScript">         <match url="^sneakyURLforLoggingIn" />         <action type="Rewrite" url="installbase/wp-login.php" />     </rule>      1: I'm sure there's a more efficient way to do this 2: once wordpress accepts the login it sends you to the 403 page, requiring the user to then manually navigate to /wp-admin/. That's less than ideal. Any thougths on how to solve this catch-22? Or is there a better way to accomplish the same thing?


title: Sample Theme Options page for Multisite - what to consider

text: I used Theme Options page from the Tutorial of Ian Stewart in some of my WP site, and it works just fine. What I did externally was this (closest English Tuts). All those sites were single sites. But now I'm dealing with a WordPress Network. As I'm developing a single theme for all the sub-sites, I'm placing the `theme-options.php` into my theme as a common file. As per my search, I got a conditional statement:               global $blog_id;         if( $blog_id == '1' ) {        //do things for first site     }      Do I need to echo the same code of the `theme-options.php` under two such block to activate different thing in different site?   Or, do I need to made two different `theme-options.php` and conditionally load them for different site?                global $blog_id;          if( $blog_id == '1' ) {         require_once ( get_template_directory() . '/theme-options.php' );      } elseif ( $blog_id == '2' ) {         require_once ( get_template_directory() . '/theme-options-bengali.php' );      } else {         require_once ( get_template_directory() . '/theme-options.php' );      }      Please note: Two of my site's settings, in many cases could be different and I'd need to grab them differently for the front-end.


title: How to Update User Meta Field other than from profile?

text:
I have created a dynamic meta field that is generated for each post type. I used the following to create the meta-field:               <?php             $args=array(     'post_type' => 'Course',     'status' => 'approve'     );                             $allposts = get_posts( $args );                             foreach ( $allposts as $post ) {                              $course_name = $post->post_name;                             $post_course_meta = $_POST[$post->post_name];                             $radio_status = get_user_meta( $user->ID, $course_name, true );                             ?>                                        <input type="radio" name="<?php echo $post->post_name; ?>" value="Did not start" <?php if ($radio_status == 'Did not start' OR $radio_status == '' ) { ?>checked="checked"<?php }?> />Did not start"
     <input type="radio" name="<?php echo $post->post_name; ?>" value="Started" <?php if ($radio_status == 'Started' ) { ?>checked="checked"<?php }?> />Started
     <input type="radio" name="<?php echo $post->post_name; ?>" value="Finished" <?php if ($radio_status == 'Finished' ) { ?>checked="checked"<?php }?> />Finished      And to save it:               function save_educadme_courses_for_user( $user_id ) {           if ( !current_user_can( 'edit_user', $user_id ) ) { return false; }              $args=array(             'post_type' => 'Course',             'status' => 'approve'             );         $allposts = get_posts( $args );              foreach ( $allposts as $post ) {         $course_name = $post->post_name;         $post_course_meta = $_POST[$post->post_name];         update_user_meta( $user_id, $course_name, $post_course_meta );         }//end of master loop          }      And to display & save, I am using               add_action( 'show_user_profile', 'educadme_courses_for_user' );     add_action( 'edit_user_profile', 'educadme_courses_for_user' );     add_action( 'personal_options_update', 'save_educadme_courses_for_user' );     add_action( 'edit_user_profile_update', 'save_educadme_courses_for_user' );      Now, everything is **working fine if I wanted to update through the profile itself**. However, I don't intent to do that. I want to be able to also edit through the profile edit page, but, mainly, I want to be able to also update the meta field by hooking an update function to actions which are run on different parts of the website. However, when I try to do that, **the update** I run through the external function **doesn't update the value of the radio** or at least when I open the profile page, it saves original value I set through the profile. For instance, I wanted to test this function:               function testtt() {         if ( is_user_logged_in() ) {         update_user_meta( $user_id, 'research-introduction', 'Finished' );         }     }     add_action( 'wp_footer', 'testtt' );      But nothing happened! The value (radio button) that was checked through the profile update page is still selected. I changed a bit of code and was able to make it work the other way around, to fetch value and update but **not have any effect** when edited through the **profile page**. This brought me to the question, can I allow or use updates both ways? If yes, what am I doing wrong please? Thanks!


title: How to get date of post when using wp_get_recent_posts()?

text: I get the latest posts this way:               $args = array( 'numberposts' => '2' );     $recent_posts = wp_get_recent_posts( $args );      Then I loop through them and get information about the post this way:               $recent_posts[0]["post_title"]      How can I get the date the post was published?


title: Passing more options to: wp.media.gallery.edit

text: I am calling the media gallery edit screen like so on the front end:               wp.media.gallery.edit('[gallery ids="70,71,72"]');      The right images get loaded (70,71,72), but the media library shows just a few random selection of images, when I go to the Add to Gallery tab. First I would like the correct amount of images to show up, when called on front end. Second I would then like to restrict the images shown to the user to the images uploaded to the current post only. In another try I used the 'uploadedTo' parameter to pass a post id, like in this example at the very bottom of the page: Restricting Users to View Only Media Library Items They Have Uploaded? That worked fine. Unfortunately. this does not give me the gallery view I would like with the sidebar on the left.


title: Display total unique custon field results

text: I need show total results of a custom_field:   * Each post has a field "city";   * How many unique cities are registered? Ex.:   Madrid + Paris + Madrid + London = 3 cities


title: Form That Submits Content Securely

text: I have built a WP site for a client. One of the pages has a form which my client's customers will use to submit material to my client, and one of the required fields is a file upload. My client requires that the material submitted via that form reach my client securely. I see no WP contact form plugin that achieves this. (The ones that call themselves "secure", such as fast secure contact form, use that term in a different sense: protection against people submitting malicious content via the form.) Here is the approach I'm now thinking of:   1. I use a standard plugin to create the form (I'm using contact form 7).   2. The contents of the form submission are _not_ emailed to my client. She just receives an email notification that the form was submitted.   3. I've installed the plugin contact form DB, so that my client can access the contents of the submission from the WP admin. But there are still at least two issues that need to be resolved:   1. I need to make contact form 7 submit the content securely.   2. My client needs to be able to view the submitted content in the WP admin securely. Regarding issue # 1, it it's too much of a hassle to figure out how to make contact form 7 or any of the other WP contact form plugins submit the content securely, I could code the form myself. I see a plugin called Dagon Design that calls itself secure -- but the example they give is a form with a non-secure url, and the action of the form also is non-secure, leading me to believe that this plugin too is not using "secure" in the sense that I need. Any assistance on how to implement this, or any suggestions for an alternative approach, would be welcome.


title: Breadcrumb is not generating the correct post page url

text: I have created a custom posts type cities and the code for its deceleration is `register_post_type('City',$args);`                 $labels = array(     'name' => _x('Cities', 'post type general name'),     'singular_name' => _x('City', 'post type singular name'),     ......  );      and I Installed prime-strategy-bread-crumb to generate the breadcrumbs but the exact url for cities page is http://www.abc.com/wordpress/cities/ and the url generated by the breadcrumb is http://www.acb.com/wordpress/city/ which ultimately takes me to the archive page of post type city so do I have to make changes in the plugin file or is it all due to page url because the url of single city post is //www.abc.com/wordpress/city/shimla/ and code to display the breadcrumbs is in this page.


title: code highiglight not working comment

text: SyntaxHighlighter Evolved plugin installed on my blog. Code highlight working on post,but no comments.. I am showing the comment form with the different codes :                   <form  method="post" name="commentform" onsubmit="return false" id="commentform">         <textarea name="comment" id="commentr" cols="50" rows="10" tabindex="4">  </textarea>         <input type="hidden" name="send" id="send" value="1" />                  <input type="submit" class="sendmain" name="sendmain"  onclick="_sendmain('<?php echo $post->ID; ?>');" value="Send" />         </form>      What do you think the problem? My English is bad, I'm sorry. Thanks..


title: making users able to add their own products wp e-commerce

text: I am using wp e-commerce plugin to build a simple e-commerce website. The problem is that I want to allow all users to post their products on the website. Right now, only the admin can add products. Does anyone know if it's possible to give users the privilege to post products?


title: how to find the current page is isngle activity page in buddypress?

text: I want to check whether the current page is "Single activity page" or not, I ned like ths, `if(is_single_activity())` or               if(is_page('is_single_activity'))      Thanks


title: Inserting into WP DB

text: I had initially asked a question based on my code (which has since been removed), I need some help/guidance in creating a plugin. Scenario: I have created a custom post type (CPT), now I need to insert values into the CPT from a database table external to the wp environment. This routine needs to run once every hour, no of rows can range from 50 - 500. What is my best course of action? Side question: Do I separate my CPT code from the insert routine code?


title: How to add a user dashboard page?

text: I'm developing a Wordpress theme for the first time and I don't know how to create a custom user dashboard page, such that when a user logs in via a custom login form, he/she is not directed to Wordpress dashboard, but to a page where user specific information is shown. He/she should also be able to edit his/her information without leaving the page. The user (with low priority role) should not be able to access Wordpress dashboard.


title: Custom post type structure for posts with multiple child posts

text: I'm developing a site for an African language translation company and am currently trying to think of the best way to structure the site I have a custom post type of "Languages" set up, with posts like Arabic, Somali, Swahili etc but each of these posts need "sub" posts within them i.e History, Where is it spoken, Dialects, Alphabet & Writing system What would be the best way of setting this up? There are going to be around 140 languages so I don't think setting up individual posts for the 3/4 sub pages for each language is a good way to go as we'd be looking at over 500+ posts I'm wondering if I can set up "base" posts for the 3/4 sub pages seeing as the titles will always be unique, just the content will be different


title: Wordpress hooks/filters insert before content or after title

text: trying to insert content before the post content in my functions.php - I know how to use the regular wp hooks, but unsure how to insert into other areas. Tried this, but it kills content on any other post type:               function property_slideshow( $content ) {      if ( is_single() && 'property' == get_post_type() ) {         $custom_content = '[portfolio_slideshow]';         $custom_content .= $content;         return $custom_content;         }      }     add_filter( 'the_content', 'property_slideshow' );      How do I make this conditional?


title: How to add section above header for custom post types

text: I want to include a horizontal section at the very top of my site, above the header, that shows the next six events. I've created a custom post type called "events", and I've created about 150 events. That's all fine, but what I'm having trouble with is figuring out how to create this new section above the header to get these events to display. Would I need to edit each page's PHP to add that? Or is there something more global.


title: Using Microsift Word/Outlook for content publishing to Wordpress

text: I am tasked with building an tool to allow users to publish to Wordpress from their PC using MS Word and Outlook. I know, completely defeat the purpose of having Wordpress, but the basic requirement are:   1. Format must be preserved, including images   2. Providing an interface for categorizing and tagging the document   3. Does not involve the WP web UI. (Users insist on using Word as the publishing tool)   4. Workflow should be simple as possible, ie invoke in Word, select categories/tags, publish. After doing some research, I think this could be achieved by creating an VBA macro that saves Word to html format, and sending it via http to wordpress XMLRPC However, I haven't quite work out how to include the images, and how to keep the category from Wordpress and the macro in sync. I would like to hear from anyone who have experience in this and suggestion on how to implement this.


title: redirect to homepage after login

text: I have installed a site in my localhost. I have used a static home page with a wordpress login in it. The blog is hosted at localhost/blog. (i have followed the wordpress guide on how to get the wordpress index by keeping it inside a sub folder) the issue im having is once the user is logged in it automatically redirects to the /blog path. But i want to redirect it to the main home page. This is what i have tried so far Added the below code to the functions.php               /* redirect users to front page after login */         function redirect_to_front_page() {         global $redirect_to;         if (!isset($_GET['redirect_to'])) {             $redirect_to = get_option('siteurl');         }     }     add_action('login_form', 'redirect_to_front_page');       added plenty of login redirect modules but none of them work, all of those simply redirects to the blog page.


title: Upload file without attaching it to a POST

text: I've brought files with html file field and I'm trying to attach file to wordpress attachments using `media_handle_upload`               $attach_id = media_handle_upload ( $file_handler, null );      the I've specified second parameter as `null` because I don't want to attach it with any post, but it returns some WP Error, since it is may be not allowed to `media_handle_upload` without `post id`               WP_Error Object     (         [errors] => Array             (                 [upload_error] => Array                     (                         [0] => Array                             (                                 [0] => 0                                 [1] => 0                                 [2] => 0                             )                          )                  )              [error_data] => Array             (             )          )      is it possible to upload images with wordpress default without assigning it to any post?


title: Change Post Meta via AJAX from the posts list table

text: I've been looking around for this for a while but haven't found anything as of yet. I have a custom post type - "books" and this post type has a custom meta field of "availability". I would like to have a column for the post type that you can click on the availability link and it would change the custom meta value from "yes" to "no" and update the text link to display either "yes" for the value being yes or "no" for the value being no. I have made the post column, and I have got the column displaying the value, just need to get it to work with ajax which is where I have no idea where to start! I have studied a plugin I found on here not long back about changing a post status from a column using ajax but I cant see how to change this to work with custom meta values - Custom column for changing post status via ajax I would love any help or even pointing in the right direction with this as it has been eating away at me for days now!


title: Adding a line of text to php code

text: My wordpress theme has a button to turn breadcrumbs on or off. I want to leave the breadcrumb turned off and place a line of text where the breadcrumb would display on all pages except the home page. You can see the breadcrumb here: http://greenesrelease.com/what-is-it/ I see in the `sub_page_header.php` where the breadcrumb is called               if(!is_front_page() &&  ( get_option('rttheme_breadcrumb_menus') || get_option(THEMESLUG.'_show_search') )){         $info_bar = TRUE;     }else{$info_bar = FALSE;}


title: wordpress title and category as result

text: Please have a look a the code below!Its from a WordPress plugin. How can I get the result $search = post title (space ) category name                // Relation: Post title.     if( $relation === 'posttitle' ) {      global $post;      $search     = ( isset( $post->post_title ) ) ? $post->post_title : '';     }      Its from a WordPress plugin related-youtube-videos. I want to display you tube base on title and category! This plugin has no option for both! https://wordpress.org/plugins/related-youtube-videos/ related-youtube-videos\lib\RelatedYouTubeVideos\API.php


title: YouTube Sidebar Widget - YouTube service unavailable

text: I'm using WordPress 3.5 and YouTube Sidebar Widget 1.3.2. The plugin display service is unavailable. Why have I encountered service unavailable? The YouTube video is set to be public and embeddable.


title: hide an author_meta on a post if the Co-author function is active

text: I want to hide an `author_meta` on a post if the Co-author function is active on a post. For example: This is how it looks with one author > By Author Name | Contributor Published: 05/03/2013 2:00 pm EST Contributor is the meta Here is how it looks currently with a co-author is added > By Author Name, Author Name, Author Name, and Author Name | Contributor > Published: 05/03/2013 2:00 pm EST I would like to hide the Contributor meta (or title meta) on this type of post. I am using the Co-Authors Plus Plugin. The source for the coauthors_posts_link function is:               function coauthors_posts_links( $between = null, $betweenLast = null, $before = null, $after = null, $echo = true ){         return coauthors__echo('coauthors_posts_links_single', 'callback', array(             'between' => $between,             'betweenLast' => $betweenLast,             'before' => $before,             'after' => $after             ), null, $echo );     }


title: Get custom thumbnail sizes

text: If I use:               add_image_size('main_image', 750, 375, true);      to add additional thumbnail size. Then how can i get that size if i have only key `main_image`.


title: Passing the page ID to a login php script

text: I'm trying to create a simple registration process which goes like this,   1. A visitor clicks on a link (which is viewable only after entering some information such as name, email, phone etc.)    2. This link takes the visitor to a simple registration form that captures all the required info.   3. And on successful validation of the form redirects the visitor back to the actual URL. To do this, first I thought of passing the actual URL as a variable to the php login script but then anybody can see this URL in the status bar of their browsers and would be able to bypass the registration process completely. Now I believe another way to do this is to pass the actual ID of the destination URL as a variable to the login PHP script. Can anyone help me on how to actually go about this? The registration form can be a seperate PHP file that opens as a popup or can be a form thats embedded in one of the pages.


title: I need help in designing a custom post type

text: I've been sitting on this for three days and I still haven't figured out a good way to solve this problem—that's why i want to ask a community about it. I'm creating a page, which will have some historical routes in my city. I therefor need to create a custom post-type, which will be the route. Route have points. Each point store multiple data: name, content, GPS- coordinates, author, etc. So I need to create a repeatable area called `point` and there I'll insert all the data I need (amount of points is dynamic so this area need to be repeatable). I've done that with help from this question: Create more Meta Boxes as needed It works fine, but there's a problem because the content-field needs to be the TinyMCE-editor and for now I'm stuck on the part where i add a repeatable area through jQuery, because I can't add TinyMCE to it in a easy way. Is this a good plan or should I try another solution?


title: Which social connect plugin do you recommend?

text: I'm searching a social connect plugin which allows users to register/login using the following sites and support MULTISITE 1)Facebook 2)Twitter 3)Google 4)Yahoo 5)Others (optional) I've tried many plugin but none of them met my requirements. Plugins that support facebook,twitter,google,yahoo has security issues. I've tried otto's simple facebook and twitter connect. It is a good plugin but it doesn't support multisite, also there is no yahoo connect. Social connect has everything,support multisite, but its not working properly. Many times its not redirect to the dashboard after connect. I tried wordpress social login plugin too. But after connect its just fill dummy emails for everything even you connect with google,yahoo,etc. I don't want to use third party plugins like janrain,gigya etc... Because after some limit i need to pay money to use their services. Is there any good plugin available that support multisite and has high security,facebook,twitter,google,yahoo connect features ? Thanks


title: Pagination not working in some author pages

text:
I have an author archive page to display authors' posts. In some of the authors the pagination works, but in some cases it doesn't. Where is the problem? Here is my code:               <?php     $paged = (get_query_var('page')) ? get_query_var('page') : 1;     $wpfp_before = "";     echo "
";          if ($wpfp_before):     echo '
'.$wpfp_before.'
';     endif;     $favorite_post_ids = get_user_meta($user_id, 'wpfp_favorites', true);     if ($favorite_post_ids) {     $favorite_post_ids = array_reverse($favorite_post_ids);     $post_per_page = wpfp_get_option("post_per_page");     $page = intval(get_query_var('paged'));          $qry = new wp_query(array('post_type' => 'videosprogram' ,  'post__in' => $favorite_post_ids ,'posts_per_page' => 3,'paged' => $paged ) );                                while ($qry->have_posts() ) : $qry->the_post();               //Loop ....               endwhile; wp_pagenavi( array( 'query' => $qry ) ); ?>      UPDATE:- i try this way :-               function cpt_on_author_page( $query ) {         $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));         //$author_name = get_post_meta($curauth->id, 'author_name', true);         if ( $query->is_author() && $query->is_main_query() ) {             $query->set( 'post_type', 'videosprogram' );             $query->set( 'posts_per_page', 1 );             $query->set( 'meta_key' , 'show_program_editors');             $query->set( 'meta_value' , $curauth->id);                    }     }     add_action( 'pre_get_posts', 'cpt_on_author_page' );      but not show me any post


title: Remove post title

text: Is there a way to remove the post title? or atleast not require me to enter a post title. I have migrated from tumblr to wordpress and I didn't need to have a title with tumblr so I was wondering if I could do the same with wordpress?


title: Where can I store common cross-site text (e.g. headings, titles etc.)

text: I am developing a site that I want to hand over to a client once complete. The core page 'content' is manageable, but there are elements of content (common headings, titles etc.) that are shared across multiple pages & sections within the site, and I would like to give the client a single 'admin page' where they can set all of this information; there are about 25 bits of configurable content - all of them small strings.


title: Choose to Display Post Thumbnail?

text: I noticed the website http://gawker.com/ does something cool with images in posts - some posts have a large featured image above the title, others have none and just have images in the content. My best bet on how to achieve this in WordPress is to add `<?php the_post_thumbnail('large'); ?>` above the title and make a selectable option to display or not display the_post thumbnail in the post edit screen. It would need to only apply to the post (and not the excerpt)... I'm not sure how I would create that option. I would appreciate if anybody knows how this would be done, can direct me to a somewhat relevant tutorial, or has a better idea of how to achieve this.


title: Set home page to last page of a certain category

text: I want to create a new website with reversed pagination (I mean latest post is found in last page , while oldest one is found in first page) I could do that already with "Default Sort Ascend" plugin. Now what I want is to set front page to be the last page of a specific category (even with redirection) ... ANY HELP ??


title: Disable adding of new post (custom post type)

text: How do I disable adding of new posts of a particular custom post type? Found this code in Log Deprecated Notices plugin:                   $screen = get_current_screen();         if ( self::pt == $screen->id && ( $screen->action == 'add' || $_GET['action'] == 'edit' ) )             wp_die( __( 'Invalid post type.', 'log-deprecated' ) );         if ( self::pt != $screen->post_type )             return;


title: Stop wordpress from removing HTML attributes

text: I try to insert a post with `html tag` with `class` attribute, like this: `<dl class="dl-horizontal">`, but after saving the post, WP removes an attribute.   How can I fix it?   The only way I've found, is to make a `shortcode`:               add_shortcode('attr', 'html_attr');     function html_attr( $atts, $content = null ){      extract( shortcode_atts( array(         'tag' =>"",         'attr'=>""       ), $atts ) );          return "<" .  $tag . " " . $attr . " >";     }      But I don't think that it's a right way...


title: How to: When a bp Group created, automatically create a wp category

text: example: a user creates a group "cats" automatically a category "cats" would be created with the slug "cats" or a user creates a group "Fat Cats" automatically a category "Fat Cats" would be created with the slug fat-cats. I see there is a function wp_create_category : However,to be frank, i'm lost. Have tried, with adding this near end (line310) of child- theme/groups/create.php but no dice Any help or ideas really welcome


title: Has anyone managed to integrate the wp_editor inside a widget?

text: Adding this in the widget form method:               wp_editor($text, $this->get_field_id('text'));         seems to work. But after you press the "Save" button the widget goes funky... Adding `_WP_Editors::editor_js();` makes it show after you press the save button, but then other things start to act weird. I think it has something to do with the javascript from the footer. Has anyone successfully integrated wp_editor inside a widget?


title: Publish issue after upgrading to 3.3

text: I have a weird issue after upgrading to WP 3.3. Currenty I have a Dreamhost dedicated server with WP 3.2. I've tried two times to upgrade to WP 3.3 and both times I had the same issue. First time, I tried to upgrade directly from the admin panel. Everything seems to be OK but all the updates against the DB perform errors. Let say, I tried to write a new post and nothing was saved. I tried to change some options in a plugin a a message is displayed "Are you sure you want to to this?" without any button to continue... After a fresh installation of WP3.2, I get restore the content tables (not the wp_option) and everything works fine again. Few days ago I tried again to upgrade, but this time from console. I uncompress the wp zip file and in the instalation directory and then entered in the admin panel. A message saying some upgrade in the DB appeared. After pressing OK button, seems everything works fine until I tried again to publish something... The issue of posts disapearing happened again. Also, this time on every page change, the message "The DB needs to be upgrade" appeared again, but no these times, no change were needed. Everything seems too weird for me. And also, WP does not provides any log or information about what is happening. Could anyone help? Thanks a lot. Alberto


title: Fix permission error for deleting custom post from front-end?

text: I need both Admin and Editor role users to be able to delete a custom post type from the front-end. I found the code to create a post delete link, but whenever either role tries to delete there is an error: Forbidden You don't have permission to access /wp-admin/post.php on this server. Any ideas? Is it because this is a custom post type? The post delete code is included below. In function.php:               function wp_delete_post_link($link = 'Delete This', $before = '', $after = '')     {     global $post;     if ( $post->post_type == 'page' ) {     if ( !current_user_can( 'edit_page', $post->ID ) )     return;     } else {     if ( !current_user_can( 'edit_post', $post->ID ) )     return;     }     $link = "ID, 'delete-post_' . $post->ID) . "'>".$link."";     echo $before . $link . $after;     }      Inserted into page:               <?php wp_delete_post_link('Delete', ' ', ' ') ?>


title: When I use rewind_post() it shows menu items in my loop

text: I have code like below (I removed all the uneeded HTML and stuff for this post). The code is for my author.php page. So it shows some author data at the top of the page then runs `rewind_post()` so it can show the post's by that user. The problem is for the admin, it is showing all the menu items as post in this loop/list               <?php     get_header();          if (have_posts()) :         the_post();     ?>              View my website:<a href="<?php the_author_meta('user_url'); ?>">          <?php } ?>          <?PHP         rewind_posts();         while (have_posts()) : the_post();                  $format = get_post_format();             if ( false === $format ){                 $format = 'standard';             }             get_template_part( 'format', $format );              endwhile; /* rewind or continue if all posts have been fetched */ ?>          <?php get_sidebar(); ?>     <?php get_footer(); ?>      And the file included in the get_template_part is simply the basic stuff like `<?php the_content(__( 'read more...', 'vigilance' )); ?>`


title: Wordpress get current user data from external php page

text: I have a php page at the same level as the template / theme on wordpress. What I need it be able to get the current logged in user details from this page. I have tried this:               require_once($_SERVER['DOCUMENT_ROOT'] .'/wp-load.php');            global $current_user;       $current_user = wp_get_current_user();       var_dump($current_user);      But it's returning nothing ... 0 as user_id and nothing on the other fields. I'm I missing something? UPDATE: This is the result of the var_dump: [object Object]1object(WP_User)#79 (10) { ["data"]=> NULL ["ID"]=> int(0) ["id"]=> int(0) ["caps"]=> array(0) { } ["cap_key"]=> NULL ["roles"]=> array(0) { } ["allcaps"]=> array(0) { } ["first_name"]=> string(0) "" ["last_name"]=> string(0) "" ["filter"]=> NULL }


title: wp_mail script with jquery post

text: need to send an email from a page when a form is submitted. Thought i'd use jquery post but not really sure where to start. Would i use wp_mail? And if so how could it be called ? Sorry if that seems vague. Just trying to send an email to the client before a form posts its data to another site;               $('#donationForm').submit(function() {          // send email to client before moving onto worldpay payment form               //  send data to worldpay....     this.submit();          });      best, Dc


title: Including custom fields in search?

text: I use custom fields for lots of my content on both Posts and Pages, so that half of the text will be in the main post body and the other half in a custom field. Unfortunately, when doing this only the text in the post body is searchable. I want to have all the custom fields included in the search (just joined together as one). Preferably without installing a plugin, as all the plugins I have seen do not seem to be able to do this or they add loads of options I don't need. I just would like one search box, that uses WordPress's default search but finds words in custom fields as well as those in the main body. Is this possible?


title: How do I include the category next to the title of a post?

text:
On the main page in WordPress all I want is the category to come before the title of the article posted. So for example if it's a Review, I'd like the article name to be Review: Super 8. Okay so if you go to my site www.r3entertainment.org it displays the names of each of the articles on the main page. What I want, is for the name of the category the article is in to be placed before the title just on the main page there so people know what type of article it is. And by the names of the articles on the main page I don't mean the 'Latest Content' widget. I mean the boxes that appear below the huge slider box. Each box has a different article in it. I mean if you can get it to effect the latest content widget too that'd be cool. Didn't think about that. xD ## Thanks. The new code looks like this:                    $getCAT = get_the_category();     $firstCAT = $currentCat[0]->cat_name;<?php if(have_posts()): ?><?php while(have_posts()): ?><?php the_post(); ?>                 <div <?php post_class(); ?> id="post-<?php the_ID(); ?>">

<?php the_time('dS'); ?> <?php the_time('M'); ?><?php the_time('Y'); ?>

<a href="<?php the_permalink();?>"><?php the_title( $firstCAT,"",true ); ?>

by <?php the_author(); ?>
                     <?php the_content(); ?>                     <?php wp_link_pages('
'.__('Pages:').' ', '
', 'number'); ?>
       Did I do something wrong?


title: Migrating problem - featured images

text: I'm trying to migrate a WP install using default export and import tool. Everything is peachy except featured images. For my post thumbnails I'm using default Featured Image option with 7-8 predefined image sizes in my functions.php. Problem - after importing, Wordpress is just putting original picture in img src for thumbnail. Not resized one as is should be, but largest one which was uploaded originally. This is not even an option, because there are over 2000 posts, but I can't even fix this by setting featured image again by selecting image from media library -- I have to upload the image again, and then it works. I guess import/export tool doesn't save all the settings/metadata it should, but I can't figure out how to solve this. Image files (original and resized ones) are on server and in proper folder, and code is set up properly as well.


title: Like to store multiple passwords in db table wp_posts field post_password?

text: I like to have a multiple password access for a page. And i was thinking of just adding 200 passwords in post_password field but that's too simple and post_password is varchar(20). How else can i have multiple passwords?


title: Wp Enviroment problem with included file

text:
i have a file i am including across site to index.php, single.php etc. This file behaves really strage and acts like it not part of   wordpress Enviroment meaning: i get errors on get_bloginfo('template_url') and it won't   get the values from my options page. Any idea what this might happen? **Here is the include code i have in my index.php (somewhere mid page):**               <?php include(get_bloginfo('template_url') .'/extras/floater.php'); ?>      (it includes the file so problem aint there) **Here is the actuall "floater.php" code... :**               <?php         function establishParms() {         // get yes/no values and urls..         $facebook = get_option('sg_show_facebookfloater');         $twitter = get_option('sg_show_twitterfloater');         $mail = get_option('sg_show_mailfloater');                  // facabook             if($facebook == "Yes") {                 $facebook = '

';             }                   // twitter             if($twitter == "Yes") {                 $twitter = '

';             }                   // mail             if($mail == "Yes") {                 $mail = '

';             }          }     ?>

             <?php echo $facebook; ?>             <?php echo $twitter; ?>
<?php echo ''; ?>

<?php echo ''; ?>

        .   Nothing Special there also so.. i am left with no answer to think of. Also... had a nother weird problem with this site (which works great on localhost)   i have a function that did a simple thing inside function.php file:               function setPaths() {         $templateUrl = get_bloginfo('template_url');         $imagesUrl = get_bloginfo('template_url')."/images/";     }      But when trying to use $templateUrl in index.php file it gave me nothing.. Would love for your help :)   Cheers, Sagive _**REVISION:_** Here is an example of an error i got:               Fatal error: Call to undefined function get_bloginfo() in /home/workspac/public_html/sagive/wp-content/themes/sagive-spaceJunkie/extras/floater.php on line 29


title: How to add a date creation field when a custom taxonomy relationship is created?

text: I need to display a list of posts and order it by date. The date of when the taxonomy term relationship was created. Is this possible? If so, how can I approach it? Thank you. ## EDIT - SOLVED! Thank you to G. M. for helping me out. Here is what I did: For each set and remove action I give it a different meta_key with a user name as variable   * The meta_key with variable              $meta_key = '_category_relation_added_' . $user_name;        * To Remove term and meta              delete_post_meta($post_ID, $meta_key);     wp_remove_object_terms( $post_ID, $user_name, $taxonomy );        * To Add term and meta              wp_set_object_terms( $post_ID, $user_name, $taxonomy, true );     update_post_meta( $post_ID, $meta_key, time() );            * Then we query the posts with WP_Query              $meta_key = '_category_relation_added_' . $user_name;     $args = array(       // all your args here       'meta_key' => $meta_key,       'orderby'  => 'meta_value_num',       'order'    => 'DESC' // from more to less recent     );     $query = new WP_Query( $args );      ## UPDATE - To delete all postmeta related to the term when the term is deleted.               add_action( 'delete_term_taxonomy', function($tt_id) {              $term = get_term_by('term_taxonomy_id', $tt_id, 'favorite');             $user_name = $term->name;         $meta_key = "_category_relation_added_" . $user_name;         delete_post_meta_by_key( $meta_key );          }, 9, 1);


title: Custom background front page only ? is_front_page() issue?

text: > **Possible Duplicate:**   >  Custom background for the index page only? I need to get this right. What iam looking for is to change background image from wp-admin , for front page only. I get it work with add_custom_background(); in my functions.php. But that changes goes for the whole page. I ve been told that i should use, if_front_page but i dont get it to work. This is how far ive made it:                 if ( is_front_page() )     {        add_custom_background();     }


title: load styles and scripts in network admin not working

text: I am trying to load scripts on three different screens ONLY. I am getting the styles on the `ins-carrier-display` pages but they do not print on the `ins- carrier-edit` page. Am I missing something?               // Create admin page navigation listings     function bf_carrier_admin_network() {       global $bfc_admin_page;       $bfc_admin_page = add_submenu_page('settings.php', 'Carriers', 'BrightFire Carriers', 'edit_posts', 'ins-carrier-edit', 'carrier_admin_network');        }          function bf_carrier_admin_actions() {       global $bfc_admin_page;       if (current_user_can('manage_options')){         $bfc_admin_page = add_options_page('BrightFire Carriers', 'BrightFire Carriers', 'edit_posts', 'ins-carrier-display', 'carrier_admin');          }else{         $bfc_admin_page = add_menu_page('Carriers', 'Carriers', 'edit_posts', 'ins-carrier-display', 'carrier_admin','dashicons-products',58);       }     }          add_action('admin_menu', 'bf_carrier_admin_actions');     add_action('network_admin_menu', 'bf_carrier_admin_network');          //registser admin scripts     add_action('admin_enqueue_scripts', 'bfc_styles_scripts');     function bfc_styles_scripts(){       global $bfc_admin_page;            $bfc_admin_screen = get_current_screen();            if ( $bfc_admin_page == $bfc_admin_screen->id ) {         wp_enqueue_script('jquery');         wp_enqueue_script('jquery-effects-core');         wp_enqueue_script('jquery-effects-drop');         wp_enqueue_script('jquery-effects-highlight');         wp_enqueue_style( 'bfc_admin_style', plugins_url( 'css/admin.css' , __FILE__ ));         wp_enqueue_script('bootstrap', plugins_url('js/bootstrap.js', __FILE__), array('jquery'), '2.3.2');        }     }


title: Importing Wordpress Posts With Custom Meta Data As CSV Files Through PHPMyAdmin

text: I have been importing data records as posts with custom meta data directly into Wordpress via the CSV Importer plugin. It works okay, however, there are some issues with it. Issues: 1) It takes countless hours to import massive amounts of records (I have spent dozens of hours importing about 5,000 records, and still have about 150,000 records to go). 2) The plugin isn't supported anymore, so I have no idea of it's stability. My hope is that I can find a way to import these records that are in csv format into phpmyadmin directly. Here is what the posts contain... Post title Post content plus about 8 custom fields (which I make visible through some script that I add to the single-post.php file for my theme). So....does anyone know how to import these posts through phpmyadmin, so that I don't have to rely on a plugin to pull them into wordpress, which **then** inputs them into my mysql database and back into wordpress? I'd rather just import them directly into phpmyadmin which would shoot them directly into mysql, which I would think is the more intelligent and effective way to do things anyhow. Thanks in advance for anyone's input on this. I am much appreciative.


title: PHP Warning: preg_match() expects & PHP Warning: strip_tags()

text: I got this error log, do you know what is this and how can i fix this?               [31-Jan-2013 22:01:25 UTC] PHP Warning:  preg_match() expects parameter 2 to be string, array given in /home/xxx/public_html/wp-includes/formatting.php on line 608     [31-Jan-2013 22:01:25 UTC] PHP Warning:  strip_tags() expects parameter 1 to be string, array given in /home/xxx/public_html/wp-includes/formatting.php on line 968


title: Different markup for second page

text:
I'm pulling posts via ajax and I want to know how to get different html for the second page of posts.

                 <?php thing I want on the first page but not the second ?>
                       <?php if (have_posts()) : ?>                            <?php while ( have_posts() ) : the_post() ?>                                <?php if ( has_post_format( 'quote' )) {                          get_template_part( 'quote-post' );                     } elseif ( has_post_format( 'video' )) {                         get_template_part( 'video-post' );                     }elseif ( has_post_format( 'image' )) {                         get_template_part( 'image-post' );                     } else {                        get_template_part( 'standard-post' );                     }                      ?>                            <?php endwhile;?>                  <?php endif; ?>

       Problem is it's displaying the div profile-holder on all subsequent pages.


title: Wordpress multi user registration sites

text: For one of our customers we are currently creating a (mobile) news app which include the blogs of their WP multisite. We made an REST connection between the DB but are stuck at the following problem: We like to register people to the WP_user table but we have to give them access to 9 sites in total. Is it possible to dump all users in 1 pool to grant access to post comments on all sites? Thanks in advance,


title: Minimum Template Files for Theme Development

text: WordPress has minimum theme template files as   * style.css    * index.php and also some other files as listed here. If the theme developer wants to build theme with less bells and whistles, what are some of the template files which should be included at minimum? There isn't any guidelines in the WordPress docex. Only thing that you can find is what files and when to include them. For making use of most of the wordpress functions without any conflict, there doesn't seem to be specific number mentioned for number of template files. So how many files should be there when you build a theme from say raw html template?


title: Update field in database for users

text: I have made a frontend form for the admins where they can check a checkbox for each user and submit the form data by post. For all the users that are checked, a value should be changed in a field in the database. The slug for this field could be `payment_status`. What is a method to update or change the value of a field in the database for **a specific user**? I have looked at a question like this: Update some database fields when post is saved And have been trying with the options methods in wordpress. But I have trouble finding the way to change the value for the specific user. When this is possible for me, it might not be difficult to convert this into repeating the update process for every checked user in the post data.


title: Order a query by meta_value and then by post_date

text: I'm using the following query (mytheme/function.php) to sort posts by Custom Field(=admin_rate)               function sort_searchresult_by_admin_rate($k) {     if (!is_home()) {     $k->query_vars['meta_key'] = 'admin_rate';     $k->query_vars['orderby'] = 'meta_value';     $k->query_vars['order'] = 'DESC';     }     }     add_action('pre_get_posts','sort_searchresult_by_admin_rate');      For example I have 4 posts:               Title1  admin_rate=3    post_date=25 February 2014     Title2  admin_rate=4    post_date=26 February 2014     Title3  admin_rate=1    post_date=27 February 2014     Title4  admin_rate=1    post_date=28 February 2014      with sort_searchresult_by_admin_rate($k), I get the following results:               Title2  admin_rate=4    post_date=26 February 2014 (GOOD!)     Title1  admin_rate=3    post_date=25 February 2014 (GOOD!)     Title3  admin_rate=1    post_date=27 February 2014 (BAD!)     Title4  admin_rate=1    post_date=28 February 2014 (BAD!)      I want to Order posts by meta_value and then by date DESC same as:               Title2  admin_rate=4    post_date=26 February 2014 (GOOD!)     Title1  admin_rate=3    post_date=25 February 2014 (GOOD!)     Title4  admin_rate=1    post_date=28 February 2014 (GOOD!)     Title3  admin_rate=1    post_date=27 February 2014 (GOOD!)      is there a way? thanks.


title: wp_nav_menu_items - mobile problem

text:
I'm using the wp_nav_menu_items filter hook to add a subnav to the main navigation. It uses a child theme for 2013               function new_nav_menu_items($items) {         global $wpdb;               $localities_links = '';              $query = //etc         $localities = //etc              if( $localities ) {                   foreach( $localities AS $locality ) {                     $localities_links .= '
locality_slug . '/">' . $locality->locality_name . '
';                     }                  $items = str_replace('Localities
', 'Localities
'.$localities_links.'

', $items);         }              return $items;     }     add_filter( 'wp_nav_menu_items', 'new_nav_menu_items' );      The 'Localities' link ( and all the other links ) was created via Appearance > Menus. This works properly on laptops. But on mobile devices the links do not work. On iOS, the 'Localities' link does not work. On Android, the 'Localities' link shows the subnav, but the subnav links do not work. What is the recommended solution re main nav on mobile? Will I have to use wp_nav_menu to create the whole nav menu via code? And / or a custom walker?


title: Display all albums in nggallery on a page

text: I'm using the popular NextGen Gallery / nggallery plugin to handle photo albums and galleries on my site. I can arrange photos into a album and display it using a shortcode no problem, where I'm struggling is that I want to create a master "Photo Galleries" page which will show all of the photo Albums on the site. Any advice / ideas on how to do this? The only vaguely useful suggestion I've found online thus far is to re-arrange the albums so that I have a master albums which has everything else as a sub albums. This feels very suboptimal as each gallery / albums will need to be re-arranged on upload. I found a duplicate of this question elsewhere on the stack network - http://webmasters.stackexchange.com/questions/1858/how-to-show-all-albums-in- wordpress-nextgen-gallery but that one doesn't have an answer and hasn't been migrated to here. Thanks Jona


title: Quasi-custom API Call Plugin

text: Basically I am trying to display data from WordPress site #1 on WordPress site #2, and to get around the issue of trying to connect to the database, I thought it might be smarter to make an API-like plugin to return the information. My notion was to build a URL with a parameter which would be used to pull the information I need. Here's all I've got so far...               <?php          if ( isset( $_GET['post_id'] ) ) {              $post_id = $_GET['post_id'];              // use WordPress functionality to retrieve data with $post_id              echo $stuff;          }      Let's say the location of this code is `/wp-content/plugins/custom-api.php`. I want to be able to visit, for example, the URL `/wp-content/plugins/custom- api.php?post_id=420` and have it spit back some information on the page (like post title, thumbnail, whatever). The issue I'm having is that I don't know how to gain access to use the WordPress functions. I know normally with plugins you hook in a function, and then any WP functions you use will work. Here, I'm not trying to hook in; I'm trying to hook out. If I use any WordPress native function, it's not recognized as existing. I'm kind of stumped at the moment. Any suggestions or links to resources I could mull over would be much appreciated.


title: Plugin not localized properly

text: I am calling the `load_plugin_textdomain()` function within the `init` action hook the following way :               load_plugin_textdomain( 'my-plugin-domain', false,      dirname( plugin_basename( __FILE__ ) ) . '/i18n' );      I also tried to load it from the `plugins_loaded` action but the result was the same, the plugin doesn't get localized when I set `WPLANG` to `en_US`. I put my `my-plugin-domain-en_US.mo` file into `plugin_base_dir/i18n`. I have no idea why this isn't working. Any suggestion is most welcomed.


title: Problem with Bootstrap Carousel Integration

text:
HI there i want to show 4 items in one slide of slider it is working but i think i have done lot of hard coding can anyone give me better solution ? here is my code

                     <?php                         $prefix_posts = new WP_Query(                     array(                     'post_type' => 'prefix_portfolio',                          'tax_query' => array(                     array(                     'taxonomy' => 'prefix_portfolio_categories',                     'field'    => 'slug',                     'terms'    => array(                     'Initiatieffase',                 ),                 ),                 ),                 )                 );                      ?>                     <?php if ($prefix_posts->have_posts()): ?>               <?php while ($prefix_posts->have_posts()): ?>               <?php $prefix_posts->the_post(); ?>

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

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

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

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

                     <?php endwhile; ?>               <?php else: ?>
No Posts Found
             <?php endif; ?>            <?php wp_reset_postdata(); ?>


title: External WordPress API

text: I'd like to manipulate a WordPress website from another program/website. IS there an API already written that provides access, and authentication, to do this? Ideally, I'll be using a multi-site wordpress instance and I want an outside program to add new sites, send config options to plugins, etc.


title: How can I remove css from a child theme?

text: I am using the theme `twentyten` as a parent theme for my child theme. I have other stylesheets I want to use and so I'm trying to figure out how to `wp_deregister_style` for the `style.css` sheet that is printed out in the `head` section of the html. I have checked the global `$wp_styles` variable around the `shutdown` hook and I see the other styles but not `style.css` - how can I get my child theme to stop using it? I realize the theme name and info has to be stored here - I don't want to delete it, I just don't want it to be `enqueued`


title: How do you add a category to a post in code

text: We do a lot of post maintenance outside of the WordPress interface and as a result we need ways of categorising posts. Obviously Wordpress has categories (aka taxonomies) on posts and I plan on using them, but haven't found a way that I can do that in code. We also use custom post types extensively so the accepted answer may need to state how to incorporate categories into them.


title: How can I add a set featured image function to a theme that doesn't already have it built in?

text: I'm a relative newbie to WP and PHP in general, but now that I'm into it, I've caught the "WP fever" and have ditched asp.net. I finally found a quality theme that I like and I'm considering buying it; I have 4 blogs and counting, but I can't get the basic version of the theme to display the **set featured image** link in my WP admin when creating a post or page. Vanilla install, WP 3.5.1. The support forum isn't that good, and nobody's responded, but I'm quite sure they didn't build this function into their theme. Is it possible to add the **set featured image** function myself, even if I'm not a PHP junkie (yet)? Any guidance in this regard (whether I wanna hear it or not!) would be greatly appreciated!


title: File upload, uploads only file name

text: I am working on a simple front end image upload in Wordpress. With this piece of code I can upload to the wordpress media section but I only upload the name and url of the file then, no image. Does anyone know what I need to do to upload the image also? My form:               <form id="dash_action" method="post" enctype="multipart/form-data">             <input type="file" name="file" />              <input name="submit" type="submit" class="button" value="<?php _e( 'Save settings' ); ?>" />          </form><!--End dash_action-->      My PHP form handling:               if( isset( $_POST['submit'] ) ) {              $filename = $_FILES['file']['name'];         $wp_filetype = wp_check_filetype( basename($filename), null );         $wp_upload_dir = wp_upload_dir();         $attachment = array(             'guid' => $wp_upload_dir['subdir'] . '/' . basename( $filename ),              'post_mime_type' => $wp_filetype['type'],             'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $filename ) ),             'post_content' => '',             'post_status' => 'inherit'         );         $attach_id = wp_insert_attachment( $attachment, $filename, 37 );         require_once( ABSPATH . 'wp-admin/includes/image.php' );         $attach_data = wp_generate_attachment_metadata( $attach_id, $filename );         wp_update_attachment_metadata( $attach_id, $attach_data );            }


title: Is there a seamless solution for submitting plugins to wordpress.org SVN and GitHub?

text: > **Possible Duplicate:**   >  How-to: push a GitHub repo to the wordpress plugin servers I love WordPress, but I also love GitHub. Would love to know if there is a seamless solution to using both SVN and GitHub for plugin development?


title: Upgrade to 3.1.1 Fails

text: When doing an automatic upgrade, I get this: Downloading update from http://wordpress.org/wordpress-3.1.1.zip… Unpacking the update… Could not create directory.: /public_html Installation Failed All my wp files are in /public_html and the directory already exists. The FTP user I am logging in as owns all the Wordpress files, so it cannot be a chmod problem. Is there any reason why this error is occurring?


title: How to determine if post has widget content?

text: I've got a registered sidebar called "my-header" that affects the absolute positioning of elements below it in the markup. So I need to execute a query in header.php to determine if the sidebar is present for the current post, and write out a class identifier to my theme's body tag. I'll use this css class to adjust absolute positioning of elements accordingly. Is there a method that can be called, separately from the method that's used to display the sidebar, to determine if the post has widget content for the "my-sidebar" widget? For example, one that just returns true/false? After looking through widgets.php, I tried using is_active_sidebar('my- header') but it returns true for all pages. I need a function that accepts the post as an argument. Otherwise, if none exists, I suppose I'll create my own function.


title: Add menu page issues (permissions & position)

text:
OK, I have an issue with Sidebar Generator Plugin. This plugin creates subpage called "Sidebars" in WP-Admin. The point is, it is created as a child of "Appearance" page. And I don't want it here, I want "Sidebars" to be a subpage of my own Page named "my-page". I have found this line in the plugin's code:               function admin_menu(){         add_submenu_page('themes.php', 'Sidebars', 'Sidebars', 'manage_options', __FILE__, array('sidebar_generator','admin_page'));     }      And changed 'themes.php' to 'my-page'. Now "Sidebars" is being displayed under My-Page, but when I try to access it it shows: > You do not have sufficient permissions to access this page. Why does it happen and how to fix that? And additional question - the Sidebars subpage displays always at the top of my list of My-Page subpages, how to change that (in fact I want it to be the last subpage of My-Page). Original, full code:               <?php     /*     Plugin Name: Sidebar Generator     Plugin URI: http://www.getson.info     Description: This plugin generates as many sidebars as you need. Then allows you to place them on any page you wish. Version 1.1 now supports themes with multiple sidebars.      Version: 1.1.0     Author: Kyle Getson     Author URI: http://www.kylegetson.com     Copyright (C) 2009 Kyle Robert Getson     */          /*     Copyright (C) 2009 Kyle Robert Getson, kylegetson.com and getson.info          This program is free software; you can redistribute it and/or modify     it under the terms of the GNU General Public License as published by     the Free Software Foundation; either version 3 of the License, or     (at your option) any later version.          This program is distributed in the hope that it will be useful,     but WITHOUT ANY WARRANTY; without even the implied warranty of     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     GNU General Public License for more details.          You should have received a copy of the GNU General Public License     along with this program.  If not, see <http://www.gnu.org/licenses/>.     */          class sidebar_generator {              function sidebar_generator(){             add_action('init',array('sidebar_generator','init'));             add_action('admin_menu',array('sidebar_generator','admin_menu'));             add_action('admin_print_scripts', array('sidebar_generator','admin_print_scripts'));             add_action('wp_ajax_add_sidebar', array('sidebar_generator','add_sidebar') );             add_action('wp_ajax_remove_sidebar', array('sidebar_generator','remove_sidebar') );                  //edit posts/pages             add_action('edit_form_advanced', array('sidebar_generator', 'edit_form'));             add_action('edit_page_form', array('sidebar_generator', 'edit_form'));                  //save posts/pages             add_action('edit_post', array('sidebar_generator', 'save_form'));             add_action('publish_post', array('sidebar_generator', 'save_form'));             add_action('save_post', array('sidebar_generator', 'save_form'));             add_action('edit_page_form', array('sidebar_generator', 'save_form'));              }              function init(){             //go through each sidebar and register it             $sidebars = sidebar_generator::get_sidebars();                       if(is_array($sidebars)){                 foreach($sidebars as $sidebar){                     $sidebar_class = sidebar_generator::name_to_class($sidebar);                     register_sidebar(array(                         'name'=>$sidebar,                         'before_widget' => '
',                         'after_widget' => '
',                         'before_title' => '
',                         'after_title' => '
',                     ));                 }             }         }              function admin_print_scripts(){             wp_print_scripts( array( 'sack' ));             ?>                              <?php         }              function add_sidebar(){             $sidebars = sidebar_generator::get_sidebars();             $name = str_replace(array("\n","\r","\t"),'',$_POST['sidebar_name']);             $id = sidebar_generator::name_to_class($name);             if(isset($sidebars[$id])){                 die("alert('Sidebar already exists, please use a different name.')");             }                  $sidebars[$id] = $name;             sidebar_generator::update_sidebars($sidebars);                  $js = "                 var tbl = document.getElementById('sbg_table');                 var lastRow = tbl.rows.length;                 // if there's no header row in the table, then iteration = lastRow + 1                 var iteration = lastRow;                 var row = tbl.insertRow(lastRow);                      // left cell                 var cellLeft = row.insertCell(0);                 var textNode = document.createTextNode('$name');                 cellLeft.appendChild(textNode);                      //middle cell                 var cellLeft = row.insertCell(1);                 var textNode = document.createTextNode('$id');                 cellLeft.appendChild(textNode);                      //var cellLeft = row.insertCell(2);                 //var textNode = document.createTextNode('[Remove]');                 //cellLeft.appendChild(textNode)                      var cellLeft = row.insertCell(2);                 removeLink = document.createElement('a');                 linkText = document.createTextNode('remove');                 removeLink.setAttribute('onclick', 'remove_sidebar_link(\'$name\')');                 removeLink.setAttribute('href', 'javacript:void(0)');                      removeLink.appendChild(linkText);                 cellLeft.appendChild(removeLink);                       ";                       die( "$js");         }              function remove_sidebar(){             $sidebars = sidebar_generator::get_sidebars();             $name = str_replace(array("\n","\r","\t"),'',$_POST['sidebar_name']);             $id = sidebar_generator::name_to_class($name);             if(!isset($sidebars[$id])){                 die("alert('Sidebar does not exist.')");             }             $row_number = $_POST['row_number'];             unset($sidebars[$id]);             sidebar_generator::update_sidebars($sidebars);             $js = "                 var tbl = document.getElementById('sbg_table');                 tbl.deleteRow($row_number)                  ";             die($js);         }              function admin_menu(){             add_submenu_page('themes.php', 'Sidebars', 'Sidebars', 'manage_options', __FILE__, array('sidebar_generator','admin_page'));         }              function admin_page(){             ?>

Sidebar Generator

                     The sidebar name is for your use only. It will not be visible to any of your visitors.                      A CSS class is assigned to each of your sidebar, use this styling to customize the sidebars.

                     + Add Sidebar

                         Name	                         CSS class	                         Remove
                     <?php                     $sidebars = sidebar_generator::get_sidebars();                     //$sidebars = array('bob','john','mike','asdf');                     if(is_array($sidebars) && !empty($sidebars)){                         $cnt=0;                         foreach($sidebars as $sidebar){                             $alt = ($cnt%2 == 0 ? 'alternate' : '');                     ?>                     <tr class="<?php echo $alt?>">                         <?php echo $sidebar; ?>	                         <?php echo sidebar_generator::name_to_class($sidebar); ?>	                         <a href="javascript:void(0);" onclick="return remove_sidebar_link('<?php echo $sidebar; ?>',<?php echo $cnt+1; ?>);" title="Remove this sidebar">remove
                     <?php                             $cnt++;                         }                     }else{                         ?>
                             No Sidebars defined
                         <?php                     }                     ?>

Donate

                         Support the further development of this plugin.
                     <form action="https://www.paypal.com/cgi-bin/webscr" method="post">                     <input type="hidden" name="cmd" value="_s-xclick">                     <input type="hidden" name="hosted_button_id" value="9271055">                     <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">                                          </form>

             <?php         }              /**          * for saving the pages/post         */         function save_form($post_id){             $is_saving = $_POST['sbg_edit'];             if(!empty($is_saving)){                 delete_post_meta($post_id, 'sbg_selected_sidebar');                 delete_post_meta($post_id, 'sbg_selected_sidebar_replacement');                 add_post_meta($post_id, 'sbg_selected_sidebar', $_POST['sidebar_generator']);                 add_post_meta($post_id, 'sbg_selected_sidebar_replacement', $_POST['sidebar_generator_replacement']);             }                }              function edit_form(){             global $post;             $post_id = $post;             if (is_object($post_id)) {                 $post_id = $post_id->ID;             }             $selected_sidebar = get_post_meta($post_id, 'sbg_selected_sidebar', true);             if(!is_array($selected_sidebar)){                 $tmp = $selected_sidebar;                  $selected_sidebar = array();                  $selected_sidebar[0] = $tmp;             }             $selected_sidebar_replacement = get_post_meta($post_id, 'sbg_selected_sidebar_replacement', true);             if(!is_array($selected_sidebar_replacement)){                 $tmp = $selected_sidebar_replacement;                  $selected_sidebar_replacement = array();                  $selected_sidebar_replacement[0] = $tmp;             }             ?>

Sidebars

                         <input name="sbg_edit" type="hidden" value="sbg_edit" />
                             Select the sidebar you wish to display on this page, and which sidebar it will replace. (leave unselected to use the default sidebar everywhere)

                         <?php                          global $wp_registered_sidebars;                         //var_dump($wp_registered_sidebars);                                     for($i=0;$i<5;$i++){ ?>
Replace                                  <select name="sidebar_generator[<?=$i?>]">                                     <option value="0"<?php if($selected_sidebar[$i] == ''){ echo " selected";} ?>>WP Default Sidebar</option>                                 <?php                                 $sidebars = $wp_registered_sidebars;// sidebar_generator::get_sidebars();                                 if(is_array($sidebars) && !empty($sidebars)){                                     foreach($sidebars as $sidebar){                                         if($selected_sidebar[$i] == $sidebar['name']){                                             echo "<option value='{$sidebar['name']}' selected>{$sidebar['name']}</option>\n";                                         }else{                                             echo "<option value='{$sidebar['name']}'>{$sidebar['name']}</option>\n";                                         }                                     }                                 }                                 ?>                                 </select>                                  with                                   <select name="sidebar_generator_replacement[<?=$i?>]">                                     <option value="0"<?php if($selected_sidebar_replacement[$i] == ''){ echo " selected";} ?>>None</option>                                 <?php                                      $sidebar_replacements = $wp_registered_sidebars;//sidebar_generator::get_sidebars();                                 if(is_array($sidebar_replacements) && !empty($sidebar_replacements)){                                     foreach($sidebar_replacements as $sidebar){                                         if($selected_sidebar_replacement[$i] == $sidebar['name']){                                             echo "<option value='{$sidebar['name']}' selected>{$sidebar['name']}</option>\n";                                         }else{                                             echo "<option value='{$sidebar['name']}'>{$sidebar['name']}</option>\n";                                         }                                     }                                 }                                 ?>                                 </select>
                             <?php } ?>

                  <?php         }              /**          * called by the action get_sidebar. this is what places this into the theme         */         function get_sidebar($name="0"){             if(!is_singular()){                 if($name != "0"){                     dynamic_sidebar($name);                 }else{                     dynamic_sidebar();                 }                 return;//dont do anything             }             global $wp_query;             $post = $wp_query->get_queried_object();             $selected_sidebar = get_post_meta($post->ID, 'sbg_selected_sidebar', true);             $selected_sidebar_replacement = get_post_meta($post->ID, 'sbg_selected_sidebar_replacement', true);             $did_sidebar = false;             //this page uses a generated sidebar             if($selected_sidebar != '' && $selected_sidebar != "0"){                 echo "\n\n\n";                 if(is_array($selected_sidebar) && !empty($selected_sidebar)){                     for($i=0;$i<sizeof($selected_sidebar);$i++){                                                  if($name == "0" && $selected_sidebar[$i] == "0" &&  $selected_sidebar_replacement[$i] == "0"){                             //echo "\n\n";                             dynamic_sidebar();//default behavior                             $did_sidebar = true;                             break;                         }elseif($name == "0" && $selected_sidebar[$i] == "0"){                             //we are replacing the default sidebar with something                             //echo "\n\n";                             dynamic_sidebar($selected_sidebar_replacement[$i]);//default behavior                             $did_sidebar = true;                             break;                         }elseif($selected_sidebar[$i] == $name){                             //we are replacing this $name                             //echo "\n\n";                             $did_sidebar = true;                             dynamic_sidebar($selected_sidebar_replacement[$i]);//default behavior                             break;                         }                         //echo "\n";                     }                 }                 if($did_sidebar == true){                     echo "\n\n\n";                     return;                 }                 //go through without finding any replacements, lets just send them what they asked for                 if($name != "0"){                     dynamic_sidebar($name);                 }else{                     dynamic_sidebar();                 }                 echo "\n\n\n";                 return;                      }else{                 if($name != "0"){                     dynamic_sidebar($name);                 }else{                     dynamic_sidebar();                 }             }         }              /**          * replaces array of sidebar names         */         function update_sidebars($sidebar_array){             $sidebars = update_option('sbg_sidebars',$sidebar_array);         }                 /**          * gets the generated sidebars         */         function get_sidebars(){             $sidebars = get_option('sbg_sidebars');             return $sidebars;         }         function name_to_class($name){             $class = str_replace(array(' ',',','.','"',"'",'/',"\\",'+','=',')','(','*','&','^','%','$','#','@','!','~','`','<','>','?','[',']','{','}','|',':',),'',$name);             return $class;         }          }     $sbg = new sidebar_generator;          function generated_dynamic_sidebar($name='0'){         sidebar_generator::get_sidebar($name);           return true;     }     ?>