has_shortcode for content added after the content

For this, you’ll actually want to utilize the wp_enqueue_scripts action instead of wp_head. wp_enqueue_scripts is technically the proper way to add scripts and styles to your site. This action allows us to both register scripts and styles for later use (which is what we want here) and allows us to output scripts and styles to … Read more

How to hide and content from auto-generated excerpts?

To filter the content only when an auto-excerpt is generated you have to chain the hooks: Hook into get_the_excerpt and register a filter for the_content. In the second filter remove both elements and their content before the excerpt can see it. Sample: add_filter( ‘get_the_excerpt’, ‘t5_excerpt_clean_up’, 1 ); /** * Register handler for auto-generated excerpt. * … Read more

How to check if this is the nth instance of a given shortcode in a post

If you’re using a class, it would be class MyShortcode { static $instance = 0; function __construct($args = array()) { add_action( ‘init’, array(&$this, ‘init’) ); } function init() { add_shortcode(‘myshortcode’, array(&$this, ‘shortcode’)); } static function shortcode($atts) { //this is the code of your shortcode // you can increment your counter self::$instance++; } }

get_the_excerpt() not returning anything when post has no excerpt

Double check that you don’t have a check for has_excerpt() that’s hiding the “auto-generated” excerpt. Even if get_the_excerpt() returns something made from post_content, has_excerpt() still returns false if the excerpt is empty. If that’s not the case, see if there’s a function that filters on get_the_excerpt that could be effecting this. To answer your question, … Read more

get_the_content not working in loop?

echo $post->post_content; will echo your post content. Keep in mind though, it’s raw out of the database (same as get_the_content()). If you want to apply the same filters that the_content() receives, follow the instructions in the codex: <?php $content = apply_filters(‘the_content’, $content); $content = str_replace(‘]]>’, ‘]]>’, $content); ?>

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)