johndalton80
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Using in_category() or an equivalent in post.php?Basically I have a function(x) which I want to execute every time a post is created and is a certain category.
So i’ve place it in wp-admin/post.php, maybe there is an easier way to do this?
Thanks ??
Forum: Fixing WordPress
In reply to: Using in_category() or an equivalent in post.php?wp-admin/post.php.
Forum: Hacks
In reply to: Executing PHP in a Post to achieve static outputOk thanks, that makes sense.
Could you perhaps direct me to how I might learn to do that? Or post a sample? (writing to the WP database).
Thanks for your help, it’s MUCH appreciated.
IH
Forum: Hacks
In reply to: Executing PHP in a Post to achieve static outputOk so I added this to functions, notice that I just used an echo for testing.
function insert_stock_quote($new_status, $old_status, $post) { if ( 'publish' == $new_status && !in_array($old_status, array( 'publish', 'private', 'trash' )) ) { echo 'this goes at the top of the post'; } } add_action('transition_post_status', 'insert_stock quote', 10, 3);
and got these errors when I published or when I hit upgrade, and it doesn’t work:
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'insert_stock quote' was given in /home/bhgadmin/public_html/vannet/wp-includes/plugin.php on line 395 Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'insert_stock quote' was given in /home/bhgadmin/public_html/vannet/wp-includes/plugin.php on line 395 Warning: Cannot modify header information - headers already sent by (output started at /home/bhgadmin/public_html/vannet/wp-includes/plugin.php:395) in /home/bhgadmin/public_html/vannet/wp-includes/pluggable.php on line 890
Forum: Hacks
In reply to: Executing PHP in a Post to achieve static outputWouldn’t that only display text when I update the post then?
For example:
function insert_stock_quote($new_status, $old_status, $post) {
if ( ‘publish’ == $new_status && !in_array($old_status, array( ‘publish’, ‘private’, ‘trash’ )) ) {
echo get_quote();
}
}
add_action(‘transition_post_status’, ‘insert_stock quote’, 10, 3);Also where would I write this code to have it generate static content?
I’m a Newb at this so Thanks for your patience.
John