Print url to default featured image

I would say you can’t, not possible. There is no filter for get_the_post_thumbnail_url() or get_post_thumbnail_id(). However you could apply a filter to get_metadata() which get_post_thumbnail_id() uses, and return the id of another attachment that you want to use as the default thumbnail. But I don’t recommend this it’s a bit hacky. I think you should … Read more

Set post featured image to author image

If you use the save_post hook, every time content is published or updated, the featured image will be refreshed. Note: make sure ACF is set to return an image ID, which is not its default. add_action( ‘save_post’, ‘wpse_set_featured_image’ ); function wpse_set_featured_image($post_id) { // get author id $author_id = get_the_author_id($post_id); // get author’s image $author_image_id = … Read more

get_the_archive_title hook unwanted changes!

You could do something like this to see where it was called from: add_filter(“get_the_archive_title”, function($val) { $backtrace = debug_backtrace(); foreach($backtrace as $level) { if(array_key_exists(“file”, $level) && preg_match(“!that-file\.php$!”, $level[“file”]) && array_key_exists(“function”, $level) && $level[“function”] == “get_the_archive_title” ) { return “works: $val”; } } return “test: $val”; }, 10, 1); You’ll have to adapt the regexp (“that-file.php”) … Read more

Cutting off excerpt with first sentence

Try the solution by @Pieter Goosen i found for me it was the best solution, and it easy to customise. if ( ! function_exists( ‘pietergoosen_custom_wp_trim_excerpt’ ) ) : function pietergoosen_custom_wp_trim_excerpt($pietergoosen_excerpt) { global $post; $raw_excerpt = $pietergoosen_excerpt; if ( ” == $pietergoosen_excerpt ) { $pietergoosen_excerpt = get_the_content(”); $pietergoosen_excerpt = strip_shortcodes( $pietergoosen_excerpt ); $pietergoosen_excerpt = apply_filters(‘the_content’, $pietergoosen_excerpt); … Read more

Apply a filter str_replace on specific caracters array in the_content()

You could obtain what you need like this: function str_replace_special_caracter($content) { // My array of special caracters to get <sup> $specialCaracters = array(‘®’, ‘™’); foreach( $specialCaracters as $character ){ $content = preg_replace( ‘@(‘ . preg_quote( $character, ‘@’ ) . ‘)@i’, “<sup>\\1</sup>”, $content ); } // Return return $content; } add_filter( ‘the_content’, ‘str_replace_special_caracter’, 99 );

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