Roman
  • Member for 10 years, 10 months
  • Last seen more than a month ago
  • Switzerland
How to get an array of post data from wp_query result?
Accepted answer
93 votes

You should read the function reference for WP_Query on the WordPress codex. There you have a lot of examples to look at. If you don't want to loop over the result set using a while, you could get all ...

View answer
Different Language for Frontend vs Backend
20 votes

You can do the following: Get the the language pack (e.g. de_DE.mo) from wordpress.org. If the language pack isn't available as a standalone download, you could also use the .mo file which is bundled ...

View answer
Possible to change the URL for the regular post type without affecting the URL of other custom post types?
Accepted answer
15 votes

You could do this on custom post type registration. 1) Set your default permalink in the WordPress admin to your desired structure e.g.: /blog/%postname% 2) Add the "slug" and "with_front" ...

View answer
How To Remove The "+ Add New Category" Link From A Category Metabox
Accepted answer
14 votes

The default metaboxes are registred in the file wp-admin/includes/meta-boxes.php. There you can find the function post_categories_meta_box() which will generate the taxonomy metabox. Currently there ...

View answer
WordPress as XML-RPC client?
Accepted answer
13 votes

WordPress already has a XML-RPC client class implemented. It's in the same file as the server part: class-IXR.php located in wp-includes. The following code will generate a new post. You could wrap ...

View answer
How to disable page delete
10 votes

You can remove the capabilites delete_pages, delete_others_pages and delete_published_pages from the role which the user is assigned to. This will prevent the complete user role from deleting pages. ...

View answer
Why is my working Custom Taxonomy not in get_taxonomies array?
Accepted answer
10 votes

The Invalid Taxonomy error will be raised by the function get_terms(). You're registring your taxonomy on the init action hook. Therefore you have to call your get_terms() function on the same or a ...

View answer
What do you think about custom designed plugin/theme options UIs?
10 votes

The problem with custom UIs are: They look different from plugin to plugin. If you're using a customized Themeframework with integrated plugins, this could be ok. But training a customer in using a ...

View answer
Is there a way to set default custom fields when creating a post?
Accepted answer
9 votes

The action hook save_post is called on save, but i don't know if you can add metadata at this time. But it should be possible to create/update your meta data after the post was saved with the action ...

View answer
How to show 'login error' and 'lost password' on my template page?
Accepted answer
9 votes

Yes it's possible. You have to create three filters for this. Admin stuff inside a class class WPSE29338_Admin { public static function setup() { add_filter('login_url', array(__CLASS__, ...

View answer
Extending xml rpc - best practice
8 votes

If I have lots of custom methods what is the best approach to handling this? Instead of filtering xmlrpc_methods, you could extend the wp_xmlrpc_server class and set your class as default with the ...

View answer
Pagination with custom post type not working
Accepted answer
8 votes

The pagination works only, if the paged attribute in the the global $wp_query variable is set. You could store your query manually in this global or just use query_posts() instead of new WP_Query(). ...

View answer
Disable revisions for a specific post type only?
Accepted answer
7 votes

Remove the revisions property inside the supports parameter of register_post_type(). Example $args = array( // ... 'supports' => array('title','editor','thumbnail','comments','revisions') ...

View answer
trying to list users & display first - last name
Accepted answer
7 votes

first_name and last_name are stored in the usermeta table. Therefore you have to use get_user_meta() to return these data. Try this code snippet: $users = get_users(array( // blog_id is not ...

View answer
Proper way to get page content
6 votes

Just to clarify: You mixed two things here. qTranslate stores the different languages in the same post. If you call get_content(), $post->content or an other direct query, you will get the whole ...

View answer
Can't get drafts with WP_Query using post_status parameter
6 votes

Try passing it as an array. For example $args = array( 'p' => 1234, 'post_type' => 'any', 'post_status' => array('draft') ); Or for all types $args = array( 'p' => ...

View answer
How to debug WordPress "Cron" wp_schedule_event
6 votes

You could use the plugin Cron-View. There you can see if your job is a) registered and b) what the next due time is. In addition, you could add a lower schedule-timer to your event (e.g. every 2 min) ...

View answer
How to structure a plugin
5 votes

We're using a mix of all methods. First of all, we're using the Zend Framework 1.11 in our plugins and therefore we had to use a similar structure for the class files because of the autoload mechanic. ...

View answer
Do you clean up your self-written plugins' at deactivation?
4 votes

You shouldn't cleanup the database on the deactivation hook. As @Darhazer said, use the uninstall hook or create an uninstall.php inside the plugin folder. What you can do is to create an export ...

View answer
Googles jQuery: Are There Avantages to Using It?
Accepted answer
4 votes

The big advantages are the Google CDN and the client side caching of the library. Your visitor will probably have a version of the jquery library in the browsers cache already, so he doesn't have to ...

View answer
Variable from a plugin into a theme
Accepted answer
4 votes

Your webhost has disabled register_globals in the php.ini, so you have to "register" your variables manually everytime you want to use it. For example: <?php global $xavi; echo $xavi; ?> ...

View answer
How to link external JavaScript files?
Accepted answer
4 votes

From my point of view, this should be working. Maybe you can post your custom.js file here. It could be possible that this file has a syntax error or something similar. You could also test if the ...

View answer
wp_enqueue_style with style.php and Wordpress functions
3 votes

Look at the answers of these questions: How do I add CSS options to my plugin without using inline styles? Best way of adding CSS which can be manipulated by the user via theme option panels? Best ...

View answer
Problem with Create Post using metaWeblog.newPost or wp_insert_post
3 votes

Probably because your post is saved as draft. Try to set the post status to publish inside your $content array. E.g. $content['post_status'] = 'publish';

View answer
Hook any php file into the wordpress api
Accepted answer
3 votes

You mean something like this? <?php require 'path/to/wordpress/wp-blog-header.php'; bloginfo('url'); ?>

View answer
Create cron job without a plugin?
Accepted answer
3 votes

Just look at the examples in the WordPress Codex for: wp_schedule_event wp_schedule_single_event

View answer
How to hide child categories from displaying
Accepted answer
2 votes

wp_list_cats is deprecated. You should switch to the "newer" version wp_list_categories which also supports some additional options. For example the depth option, which is probably what you're looking ...

View answer
WP E-Commerce VS Shopp VS WooCommerce VS JigoShop
2 votes

I'm also in the process of creating an ecommerce website for a customer. I've used Magento in the past, but wanted a simpler way for this small project. I've tested WP e-Commerce and WooCommerce so ...

View answer
Can a child theme based on Starker theme be released as free to use theme for public use?
2 votes

Just looked in the _LINCESE.txt file inside the theme folder. The theme is using the GPLv2 license and is also free available to everyone. Therefore you should not get any problems here.

View answer
HowTo to add my rewrite rules at the beginning, redirect to the right page and flush the rules on plugin activation?
Accepted answer
2 votes

Parameter in add_permastruct() The third parameter of add_permastruct() is for the is_front parameter. This is a basename, which you can add to the default permalink structure of all your posts in ...

View answer