The server-side programming language that the WordPress core, plugins and themes are written in.

learn more… | top users | synonyms (1)

2
votes
1answer
1k views

wp_customize_image_control default value

I am trying to create a custom theme using Wordpress 3.4's customization options. I would like to create an option to change the theme's logo, but I would like to also display a default logo image. ...
2
votes
4answers
342 views

Filter link to existing content suggestion

How can i filter the link given in "link to existing content". Eg: As in the above image. I just want WSP BANNER TO BE SHOWN. where WSP BANNER & CALENDAR are custom POST types Any help will ...
2
votes
1answer
62 views

automated tests as a user?

I checked out (with svn) the code for Automated Testing. However, I want to run unit tests as a specific user. Is there a way to do that? That is, is there a way to loggin with php code alone?
2
votes
1answer
309 views

Wordpress Wysiwyg Content not being displayed

My Wordpress website really isn't working to how I want?! It was working fine, with nothing being touched, Then lately I find every-page is displaying the same content on each page. Not the ...
2
votes
1answer
1k views

How to strip non-alphanumeric characters, convert spaces to dashes, uppercase to lowercase in this context

I am using the Advanced Custom Fields plugin, which is very good. I am trying to take the output of one of the fields I created and give it the "permalink treatment", that is strip out ...
2
votes
2answers
374 views

sql query to put quotes around numbers in img tag

I have quite a few old posts that contain an img tag with height and width with no double quotes around the numbers. For example: <img height=319 alt="" ...
2
votes
1answer
730 views

How can I make the “Preview Post” button save and preview in the same window?

When you choose "Preview", which is actually a link, <a class="preview button" href="?p=52&amp;preview=true" id="post-preview" tabindex="4">Preview</a> the post is saved and the ...
2
votes
1answer
2k views

How can I see all the actions attached to an “add_action” hook?

I'm working with the admin bar and trying to debug some of the menus and their priorities. I know several callbacks get bound to actions, such as this one: add_action( 'admin_bar_menu', ...
2
votes
2answers
295 views

Getting the comment number relative to all the post's comments

Any ideas how to accomplish this? Something like this would work, but if there are threaded comments you get the wrong number, because pages with threaded comments have actually more comments than ...
2
votes
1answer
550 views

Apply class to every paragraph that holds image?

Hey guys, When adding an image to a page or post wordpress is automatically adding a paragraph tag as parent holding the image. since there is no parent selector in CSS I'd love to find a solution ...
2
votes
1answer
126 views

Help with a custom page template - listing contents of childpages?

hey guys, I have no idea how to solve the following problem. I'd love to have a page-template that lists all it's child-pages but with the content. e.g. Imagine I have a page called "WORK. And "Work" ...
2
votes
2answers
1k views

Auto-add paragraphs to custom field?

hey guys, is it possible to format text in a custom field input box automatically with paragraphs? e.g. like the normal text-widget that has the option to say "auto-add paragraphs" when there is a ...
2
votes
2answers
1k views

How to return the_excerpt (without echo)?

Hey all, I see that get_the_excerpt() echoes the post excerpt if it is manually set, but not if it is automatically generated (with just the 55 words, for example). [and its use is deprecated] ...
2
votes
2answers
1k views

Correct Approach for Validating Custom Field Input

I have a custom post type with several custom fields. I am looking to do some validation on these fields because they will be used downstream by other services. So, it is important that it can't be ...
2
votes
1answer
1k views

WP_Query with the “offset” argument

I'm making a custom query for posts using something like: $p = new WP_Query(); $p->query(array('offset' => 30, 'posts_per_page' => 10)); If I have 36 posts on the entire blog, ...
2
votes
4answers
93 views

Wordpress Ajax Data problem

I couldn't add selected data to a div using ajax. Here is my code: <?php function master_ajaxurl() { $myOpt = $_POST['option']; bringDetails($myOpt); } ...
2
votes
1answer
98 views

Check php version before theme activation

I've got theme that requires php 5.3+ version. If older - fatal error occurs with it. So what I need to do when user try to activate this theme is to check php version before going into theme code ...
2
votes
1answer
40 views

Edit category output

I am using the following to display all the categories from my custom post type. How can I edit it so instead of having the output of the categories in <ul><li> elements it has <a href ...
2
votes
3answers
98 views

Create WordPress pages with PHP

I'm using MongoDB to store separate data for a WordPress website and need to be able to create pages with the data from MongoDB rather than from manually created pages in the dashboard. I've searched ...
2
votes
2answers
119 views

How to use wp_insert_user on Wordpress Multisite?

I previously had a WordpressMU install, but this is deprecated and I'm trying to find my way around multisite. I need to programatically create a new user account for a particular site. ...
2
votes
1answer
147 views

Custom Meta Field - Youtube embed

I created a custom meta field and I want to use it to embed a youtube video into the post. It works but when I post a code like this: <iframe width="640" height="360" ...
2
votes
1answer
1k views

How to include checkbox in widget backend form?

I'm trying to include a checkbox in my widget back end. But I cannot get the value (on or off) after the user submits it. I thought the value would be stored in "esc_attr( $check )" (as it is when ...
2
votes
2answers
95 views

Unable to set right time in admin and frontend template

When I run a simple php file called test.php (placed in the root of the wp installation) that contains something like that: <?php echo date('H:i:s'); ?> The result is right: 15:30:00 and the ...
2
votes
1answer
51 views

WordPress plugin installation

I am using the simple add_filter function to output the content. add_filter('the_content', 'my_name'); function my_name( $content ){ // code return $content; } When I activate the plug-in ...
2
votes
1answer
1k views

Wp favorite posts get user favorites in profile using buddypress

Im currently encountering a problem i display user wp favorites posts fine, but the issue is i wont display them, once users are logged out it says " no posts have been made" while each user has ...
2
votes
4answers
4k views

How to stop form resubmission on page refresh

Hi I have a form that adds attachments to a post, however when the form posts it obviously doesn't show the post with the new attachment echoing "your file has been uploaded". When the user refreshes ...
2
votes
1answer
246 views

wordpress custom post type remove duplicate menu item

I've registered a new content type with following - register_post_type('news', array( 'labels' => array( 'name' => __( 'News'), 'singular_name' => __( 'News'), ...
2
votes
1answer
172 views

Restrict access to post if it is currently being edited

On a platform with many Editors, the problem that I am experiencing is that two editors proofread the same post simultaneously (and disregarding the warning notice about someone else currently editing ...
2
votes
1answer
595 views

Adding a custom line of text to php code

The below code is used to pull in my Tweets and post them as individual blog posts on my Wordpress site. I would like to add a "Follow me on Twitter link" after the tweet when it is displayed in the ...
2
votes
1answer
591 views

How can I get an XML export of my 1K+ posts WordPress instance?

I'd like to export my database to XML because the import script to my new blog already supports getting data from that. A database backup or wordpress clone is not that useful in this case. The ...
2
votes
1answer
105 views

Set a User as Author of all 'New Posts' posted

An Author 'XYZ' is need to be set as the Default author of all New Posts. Irrespective of the actual Author posting the content, the post should be saved by this author 'XYZ'. Is there a Plugin or ...
2
votes
2answers
907 views

Hide main div if wp_nav_menu is empty

I want to hide the div class "navmain2" if the menu is empty. See code below: <!-- Start main navigation --> <div class="navmain2"> <div id="logo"></div> ...
2
votes
1answer
440 views

Site Title and Tagline in Theme Options Page

I'm using the Options Framework Theme to put together an options page. The user(s) I'm building this for would like to be able to edit a few settings directly from this page, including of which - the ...
2
votes
2answers
492 views

If in parent category

I have this structure Category > Subcategory > Post I´m trying to display some content if the user it´s on a specific category, or in it´s subcategory or post. I´m using this code but it only works ...
2
votes
2answers
811 views

Renaming wp-content folder dynamically

Is it possible to rename the wp-content folder dynamically? I am building a custom framework to use on themes and it would be nice to set it up where it does everything on its own. I am using this ...
2
votes
1answer
422 views

Rewriting search and pagination base

After trying for weeks now how to find a working solution I got rid of most of my functions and trials and just left the pagination function underneath in my functions.phh file: /** * Pagination ...
2
votes
1answer
117 views

Bug in Stackoverflow styled badge system script

I have modified an old Stackoverflow inspired badge system script to work with the latest Wordpress version. You can view the code here (and please feel free to use it if you wish): ...
2
votes
2answers
2k views

woocommerce and is_user_logged_in() if not redirect to homepage

I am currently using woocommerce and would like to redirect none logged in users to the home page, however i am having a little trouble determining where i should implements this I have done research ...
2
votes
1answer
533 views

Add a Custom Class to Admin Menus

I am looking for a way to add some custom classes to the admin menus using PHP. For example, here are the li tag for Posts and Pages: <li id="menu-posts" class="wp-has-submenu ...
2
votes
1answer
1k views

Bulk Image upload and one image for each post?

I have around 3000 photos, want to upload on WordPress. Is there any way to bulk upload all the photos as one image for each post ?
2
votes
2answers
292 views

Create new category upon save based on post information

After finding a couple of leads on how to do this, I'm coming up blank. What I am trying to accomplish is to add the post to a new category based on camera name. If the category doesn't exist, then to ...
2
votes
1answer
783 views

Appending meta value onto post content in WordPress during save_post

The problem seems pretty straight forward: Once the save_post action is fired, I would like to append the value of a meta key onto the end of the post_content if it's not already found within the post ...
2
votes
1answer
50 views

Output data like WP's plugin installer/updater

I want to update my plugin and have proper feedback, like the WordPress update/upgrade mechanism. How is this effect done? Essentially I have a script I want to run that has lots of processing, and ...
2
votes
1answer
1k views

Why is my custom meta box input not saving

I've added the following function to functions.php to add a custom meta box enabling the end user to input a gallery shortcode. I then intend to use this to place a gallery in a specific place on the ...
2
votes
2answers
195 views

WordPress 2.8.5 & 'Responsive Twenty Ten' - error

So, According to the WordPress theme download page; the theme 'Twenty Ten' and it's child theme/plugin 'Responsive Twenty Ten' are compatible with 2.8+ I'm stuck with using 2.8.5 at work, I don't ...
2
votes
1answer
353 views

How to create Sub Sub domain Multi User blogs?

Hi to all I would like to create a big Wordpress network with this structure: sitename.com (Main website) cat1.sitename.com (sub website) cat11.cat1.sitename.com (sub-sub website) ...
2
votes
1answer
107 views

Wordpress and Custom PHP single SignOn

I have a Wordpress installation and some php pages (not related to Wordpress). I want to use the same login between Wordpress and My Php pages. When I login from my php, and go to wordpress, it ...
2
votes
3answers
942 views

How do I get a list of popular posts by views?

I am using the Jetpack plugin to get 'site stats' which shows the number of views for blog posts/pages. So I'm no expert or anything but I'm guessing there is a table that stores these views. Is there ...
2
votes
4answers
5k views

Get custom post type by category in a page template

I've created a custom post type with categories and sub categories, what I need to do is list out the post titles and images for a given sub-category or category in a page template. I've got as far ...
2
votes
3answers
1k views

wordpress inserting posts programatically through a url

I have to insert posts programatically in Wordpress. I want that I should be able to publish posts via a url. Something like ...