How would I got about calling a php file every time someone publishes a new post?
add_action(‘publish_post’, ‘call_my_php_file’); function call_my_php_file($post_id){ require_once(“path/to/file.php”); }
add_action(‘publish_post’, ‘call_my_php_file’); function call_my_php_file($post_id){ require_once(“path/to/file.php”); }
I find using custom post types in WordPress is the easiest way to achieve this. I have used them on quite a few websites and on a major record label website I am currently working on to create multiple carousels with relationships throughout the site. I would recommend a post type UI tool like Easy … Read more
Here’s a simple solution. Append the ratings to the end of the post content: add_filter(‘the_content’, ‘add_ratings_to_content’, 4); // remove ratings from excerpts add_filter(‘get_the_excerpt’, create_function(”, ‘remove_filter(“the_content”, “add_ratings_to_content”, 6); return;’), 5); function add_ratings_to_content($content){ global $post; if(is_single()) $content .= the_ratings($post->ID); return $content; } Displays the current rating: function get_current_rating($post_id){ $votes = get_option(“votes_{$post_id}”); // handle your rating format here … Read more
Hi @Саша Стефано: Maybe I’m missing something but at first glance it looks like you just need to add a return statement (I’ve not tested this code so if that’s not it let me know and I’ll dig in to figure it out): function get_youtube_kod($post_id=null) { // Get the post ID if none is provided … Read more
I think what you are looking for was answered here: Theme Activate Hook
Had you tried to output link and verify it is correct? Also you should call die(); right after redirect.
do_feed_* are not filter hooks, they are action hooks. Their purpose is not to modify generated markup, but only to call function that loads template. It is highly recommended to only have single function hooked to these. So correct way to use this: Remove native function that loads feed template. Create your tweaked template. Add … Read more
make sure that the post as a customfield named ‘location’ and the page you are viewing is using the_content() or if you want this to work on categories and archives then add: add_filter(‘the_excerpt’, ‘show_popup’); hope this helps
i needed something similar to this so i added a rewrite rule to the same author.php file and there i added a redirect based on the user role, so to put this in your use case: First redirect editor to your theme author.php file by adding this rewrite rule function my_rewrite_rules_098( $wp_rewrite ) { $newrules … Read more
Here’s a trick that wp-includes/media.php uses for the embed shortcode: first remove all shortcodes, then add a specific shortcode back to the system, filter your content for it, then re-register the original shortcodes. Try this: function etdc_tab_group( $atts, $content ){ global $shortcode_tags; $GLOBALS[‘tab_count’] = 0; // save the shortcode registrations $orig_shortcode_tags = $shortcode_tags; // remove … Read more