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

learn more… | top users | synonyms (1)

2
votes
1answer
993 views

Fatal error: Call to undefined function wpsc_cart_item_count()

-- I've just done a fresh install of Wordpress 3.4 -- I've downloaded and uploaded this new free eCommerce wordpress theme suggested by smashing magazine. { ...
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
4k views

How to validate WordPress generated password in DB using PHP?

I am working with site that is done with WordPress, and I need to add some parts that are outside WP, and to check user login, Logging users outside WP. I tried with md5 of password but it's not... ...
2
votes
1answer
2k views

Can't use get_results() in ajax query

I'm using a jquery ajax call to get certain data from wpdb and I'm getting the following message: <b>Fatal error</b>: Call to a member function get_results() on a non-object in ...
2
votes
1answer
1k views

Publish pending article from front end with a button?

Is it possible to take the blue publish button in back end of the wordpress and place it in the frontend near the post in my index.php. I need a way to publish the pending article without going to ...
2
votes
1answer
99 views

First wordpress blog, should I make my own theme for maximum customizability?

I am, although still extremely n00by, a semi-competent web designer and developer and I have decided to start a blog. I have heard all about this WordPress phenomena and I am really excited to give ...
2
votes
1answer
1k views

How to make alert for new version on theme options?

Let say my theme host on my server. User download my theme and use it. Now I want notify @ alert for new version of my theme. Example to show "New version has been release. Please download at ..." ...
2
votes
2answers
2k views

Alter query on edit.php

What's the best way to alter the query being run on the Posts Edit screen (edit.php)? The current method I'm using is by passing an argument to the global $wp_query like so: $wp_query->query( ...
2
votes
2answers
69 views

WP_User_Query order by meta_key that is an array

I have set a user metadata named achievements which is an array containing various numeric values. Using WP_User_Query, I want to order the list by a specific key within this array named points. The ...
2
votes
2answers
84 views

How to stop PHP code running when in a child theme

I understand you can add extra CSS on top of the parent theme, but how do you remove PHP code from functions.php? I want to remove the Masonry plugin in twentyfourteen theme, and have located the ...
2
votes
2answers
152 views

How can i get the last post from wp multisite?

I have to get the last post from my Multisite network on WordPress. For now I use this code for display the last updated post after a cycle on each blog_id: <?php $blogs = get_last_updated(' ', ...
2
votes
1answer
193 views

is_page() not working from within a plugin

In my plugin I'm doing: function get_user_strains() { $userID = get_current_user_id(); $args = array( 'post_type' => 'strain', 'orderby' => 'post_date', ...
2
votes
1answer
2k 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
3k views

How can i remove all html tags from get_the_content()?

i want to remove all html tags from content like <p>, <br>, <img>, <a> i tried strip_tags() also tried $content = get_the_content(); $content = apply_filters('the_content', ...
2
votes
1answer
232 views

What is <# code #> in media-template.php, and how does it work?

I'm checking /wp-includes/media-template.php and just found this: <# if ( data.compat && data.compat.meta ) { #> {{{ data.compat.meta }}} <# } #> Never seen <# #> or ...
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
368 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
328 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
386 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
768 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
2answers
1k views

problem with ajax and the path to the php page

i would like to call a php page from an Ajax method : the alert works fine, the code as well has been tested outside of wordpress, but here it seems that the php page is never called. I found some ...
2
votes
1answer
572 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
127 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
2answers
89 views

Should I store my Facebook access tokens?

I've built a custom login page for a Wordpress site which uses Facebook for authentication. Is there any reason to store the Facebook access token in my WP database, or does it make more sense to use ...
2
votes
4answers
103 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
127 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
43 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
106 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
154 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
176 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
2answers
102 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
4answers
6k 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
297 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
186 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
738 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
690 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
134 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
1k 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
493 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
174 views

queries inside of a class

I'm building a plugin and I'm quite new to wordpress I have a class what has couple of methods what should execute database queries. The class look as it follows class MyClass{ private ...
2
votes
2answers
598 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
861 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
475 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 ...