Check if first paragraph is an image, then show custom code right after it?

How about a few simple lines With jQuery? jQuery(document).ready( function ($) { if ($(“.entry-content:first-child”).has(‘img’).length) //this check for the img tag $(“.entry-content:first-child”).after(“<div>MY CUSTOM CODE</div>”); else $(“.entry-content:first-child”).before(“<div>MY CUSTOM CODE</div>”); }); Update: Here is a simple solution using php’s native DOMDocument add_filter(‘the_content’,’add_code_before_afterImage’); function add_code_before_afterImage($content){ $MYCODE = ‘<div>this is my custom code</div>’; $doc = new DOMDocument(); @$doc->loadHTML(‘<?xml encoding=”‘.get_bloginfo(‘charset’).'”>’.$content); $ps … Read more

how to create a conditional content_width for a wordpress theme?

No, its not possible. $content_width is a theme-wide constant, and its set in functions.php before any of the query conditionals are set. $content_width is used to determine the intermediate image sizes in image_send_to_editor. The “large” image size will be set to the value of $content_width. If you need to modify those sizes on a per-category … Read more

Loading scripts only if a particular shortcode or widget is present

You can use the function is_active_widget . E.g.: function check_widget() { if( is_active_widget( ”, ”, ‘search’ ) ) { // check if search widget is used wp_enqueue_script(‘my-script’); } } add_action( ‘init’, ‘check_widget’ ); To load the script in the page where the widget is loaded only, you will have to add the is_active_widget() code, in … Read more

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