Will
  • Member for 9 years, 6 months
  • Last seen more than a month ago
Find out who deleted a page or post?
Accepted answer
5 votes

By default, no, WordPress doesn't keep track of who changes post statuses (at least that I can see). you can hook into transition_post_status and log the user id. add_action( '...

View answer
Run function at specific time
Accepted answer
5 votes

you can absolutely use wp_cron to specify a time: add_action( 'my_scheduled_event', 'prefix_my_scheduled_event' ); /** * On the scheduled action hook, run a function. */ function ...

View answer
How to extract translatable (double underscores and _e) strings?
Accepted answer
3 votes

One way is to use the WordPress i18n tools. I had to checkout WordPress trunk to make it work. On the command line: svn co http://develop.svn.wordpress.org/trunk once you have trunk somewhere, you'...

View answer
Using get_query_var() from a plugin
Accepted answer
3 votes

Hook into parse_query instead: add_action( 'parse_query', function() { add_rewrite_rule( 'go/([^/]+)/?$', 'index.php?redirect_to=$matches[1]', 'top' ); add_rewrite_tag( "%redirect_to%", '([^&...

View answer
How to get this JavaScript working with get_permalink
Accepted answer
3 votes

Probably the best way to do this is as suggested above by using wp_localize_script. You haven't mentioned how you're including the javascript - but I'm going to assume you're doing it the WordPress ...

View answer
Pagination is not working wp_query custom fields values
Accepted answer
3 votes

you need to add global $paged and then in your array that is being passed to WP_Query you need to add 'paged' => $paged global $paged; $temp = $wp_query; $wp_query = null; ...

View answer
Create a plugin with Calendar picker
2 votes

The jQuery UI datepicker is included in WordPress. While not really a 'dropdown' calendar picker, it should meet your needs and can be easily configured to reflect localizations of wherever it is ...

View answer
get_posts() forcing ignore sticky posts on main loop
1 votes

From the function reference for get_posts(): For full parameters list see WP_Query. From the WP_Query reference: ignore_sticky_posts (boolean) - ignore sticky posts or not (available with ...

View answer
How to access global variable $menu inside a class function
1 votes

You need to hook into some action that happens after the global $menu has been set. as an example: class adminMenus { public function getWPdefaultmenus(){ global $menu; return $menu; ...

View answer
set post author depending on condition via frontend post submit
1 votes

The wp_insert_post_data filter is the right approach. I would do something like this: add_filter( 'wp_insert_post_data', 'some_handler' ); function some_handler( $data )//$data is an array of ...

View answer
Form submission to another page returning 404 error
Accepted answer
1 votes

you're using name='name' for your first input. That breaks it. Change the name to something else as suggested above, prefix everything. name='my-prefix-name'

View answer
Prerequisites Skills to learn WordPress
1 votes

"learn WordPress" is a bit vague.... but if you mean develop for wordpress, then, yes, absolutely PHP is a needed skill. javascript is another skill that is handy.

View answer
How can I display all values of a custom field from posts with a certain value of another custom field or from certain post types?
1 votes

take a look at the reference docs for the WP_Query class: http://codex.wordpress.org/Class_Reference/WP_Query something like this: $args = array( //some key/value pairs...whatever '...

View answer
anyone can help me to know whats going wrong?
1 votes

best guess is that you're using a theme that's based off of twentyten or twentyeleven and aren't including the twentyten_comments() function from twentyten/functions.php into your functions file.

View answer
Remove custom posts that match taxonomy value
1 votes

something along these lines should do it: $args = array( 'post_type' => 'listings', 'posts_per_page'=> -1, 'post_status' => 'any', 'tax_query' => array( ...

View answer
Manipulate retrieved ajax data in php
0 votes

when form (or other) data is submitted via AJAX, it can be accessed via the $_POST or $_GET variables depending on the method used. In your case, you are using the post method so you can access your '...

View answer
User count only for role frontend vendor
0 votes

to get the number of authors who are assigned a particular role the get_users() function should do it: $args = array( 'role' => 'frontend_vendor',//substitute your role here as needed 'fields' =&...

View answer
Change the date and time in wordpress
0 votes

Edited because perhaps I misunderstood the question. the date_i18n filter is probably what you want. add_filter( 'date_i18n', 'wwm_date_i18n' ); function wwm_date_i18n( $d = '' ) { return '03-21-85 ...

View answer
Echo only gives me the first part of string
Accepted answer
0 votes

Edit your code thusly: $meta_key = 'agency_email'; $agency_emails = $wpdb->get_col( $wpdb->prepare( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key ) ); var_dump( $...

View answer
Which filter/hook to use for styling comments?
0 votes

the comments_form function that outputs the contact form has two actions that could be used to accomplish what you want. add_action( 'comment_form_before', 'wwm_comment_form_before' ); function ...

View answer
Is it possible in WordPress
Accepted answer
0 votes

Use the project name in the meta key field & the amount donated as the meta value, and I would suggest using update_user_meta rather than add_user_meta because reasons. Something like this: $...

View answer
WP_Query fails despite having 1 post
0 votes

Try calling have_posts() and the_post() with the object operator. Edit your code thusly: $wp_query = new WP_Query( $args ); if ( $wp_query->have_posts() ) : //... while ( $...

View answer
Using file extensions in image titles
0 votes

The PHP function pathinfo() will work to get the extension for files. If your theme is just using the attachment post title for its title, then loop through all post types of 'attachment', and/or post ...

View answer
Dynamically adding Captions to images
0 votes

The media uploader wraps the image and caption in the [caption] shortcode. There is a filter called img_caption_shortcode that can do what you want. The caption itself is passed as part of an array to ...

View answer
Trying to see if page is category or single and displaying title with appropriate heading tag
Accepted answer
0 votes

aha...white screen of death. I don't know how I missed it. Your if statement lacks parenthesis. Try this: public function title() { if ( is_category() ) { echo '<h2 class="post_title">';...

View answer
Restrict CSS on one page
0 votes

use a conditional template tag when you enqueue the css. add_action( 'wp_enqueue_scripts', 'wwm_enqueue_scripts' ); function wwm_enqueue_scripts() { //is_front_page() may or may not be the ...

View answer
Show author name not the author ID
0 votes

Well, since you now have the author's ID, you can use get_the_author_meta to get their name. borrowing from your code above: $author_id = get_post_field('post_author', $product_page->ID ); //...

View answer
Shortcode: display list of created shortcode in popup
0 votes

shortcodes get added to the global $shortcode_tags array as they are registred/added. Therefore you can access them thusly: global $shortcode_tags; foreach( $shortcode_tags as $shortcode ) { //do ...

View answer
Site no longer working following server crash - how to restore it
0 votes

Since you do have ftp access, edit your wp-config.php add these lines: @ini_set('display_errors',0); define('WP_DEBUG', true); // Turn debugging ON define('WP_DEBUG_DISPLAY', false); // Turn forced ...

View answer
Create a link to full-sized image attachment?
0 votes

The way I read your question I believe you're after wp_get_attachment_link. http://codex.wordpress.org/Function_Reference/wp_get_attachment_link

View answer