Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • I’m having this same issue. Default gravatars urls are printing as https://secure.gravatar.com/avatar/8787c0eb8a3add2408e3178ab0d35403?s=32&d=%2F%2Fwww.moneyunder30.com%2Fimages%2F2015%2F10%2FMU30_logo_green_200px_sq.png&r=g which should be secure, but that address redirects to http://i2.wp.com/www.moneyunder30.com/images/2015/10/MU30_logo_green_200px_sq.png which is insecure.

    The redirect is not happening on our server, so it has nothing to do with whether we have Jetpack installed (we don’t). Chrome sometimes doesn’t return a mixed content warning for these redirects, but sometimes does.

    Thread Starter ibhhvc

    (@ibhhvc)

    Ok, I’ve figured out a solution. Another plugin needed to run a newer version of jQuery. The plugin was not removing migrate, nor was it removing the wordpress version of jQuery. But just the fact that it was loading was causing the W3TC scripts to fail.

    The solution was to selectively load the newer version of jQuery only on the pages of the plugin that needed it.

    Thread Starter ibhhvc

    (@ibhhvc)

    Right, that would make sense. Except I’m not touching jQuery on the admin side and I get this in my console as well, before the errors:

    JQMIGRATE: Migrate is installed, version 1.4.0
    load-scripts.php?c=0&load[]=jquery-core,jquery-migrate,utils,plupload&ver=4.5:9
    Thread Starter ibhhvc

    (@ibhhvc)

    Looks great. I’m dropping this into single.php so don’t have to worry about the homepage.

    Here is my final version. The only change is adding do_shortcode to $content since it was stripping shortcode out:

    function disclosure_filter($content) {
    
    	if (! has_tag('Disclosure') || strpos($content,'</p>') == false) { // exclude any post without "Disclosure" tag or any '</p>'
    		$content = do_shortcode($content);
    		echo $content;
    		return;
    	}
    
    	if(is_singular() && is_main_query() && ! is_admin()) {
    
    		$content = do_shortcode($content);
    
    		$disclosure_content = "<div>This is my disclosure</div>";
    
    		$paragraph = explode ('</p>', $content); // separate post content into paragraphs
    		$firstp = $paragraph[0]; // select first paragraph
    
    		preg_match('/(<img.*?>)/', $firstp, $image); // select image tag in first paragraph
    		$disclosure = '<div class="show-more-wrap disclosure-wrap"><img class="show-more-button" src="'. home_url('/images/icons/warning2.svg') . "\"><p class='show-more-button'>Advertising Disclosure</p>{$disclosure_content}</div>"; // add disclosure content
    
    		$remainder = preg_split('/(<img.*?>)/', $firstp); // select first paragraph content after image
    
    		if ($image) { // if image exists in first paragraph
    		echo $image[0]; // print image
    		echo $disclosure; // print disclosure
    		echo '<p>'; // open new paragraph
    		echo $remainder[1]; // print remaining first paragraph content
    		}	
    
    		else { // if image does not exist in first paragraph
    			echo $disclosure; // print disclosure
    			echo $firstp; // print first paragraph
    		}
    
    		$therest = implode('', array_slice($paragraph, 1)); // select remaining post content
    		echo $therest; // print remaining post content
    	}
    }
    add_filter('the_content', 'disclosure_filter');
    
    genesis();
    ?>
    Thread Starter ibhhvc

    (@ibhhvc)

    I see. Thanks for those tips.

    I’ve replaced the first “if” construct with:

    if (! has_tag('Disclosure') || strpos($content,'</p>') == false) {
    		return $content;
    	}

    But now the filter does not display any content if this first construct evaluates as false. If I leave it as:

    if (! has_tag('Disclosure') || strpos($content,'</p>') == false) {
    		echo $content;
                    return;
    	}

    Then it does display content. What am I missing?

    Thread Starter ibhhvc

    (@ibhhvc)

    Thanks for the tip. Here’s what I ended up putting in single.php:

    function custom_filter($content) {
    	if (! has_tag('custom')) { // exclude any post without "custom" tag
    		echo $content;
    		return;
    	}
    
    	if(is_main_query() && ! is_admin()) {
    
    		$custom_content = 
    
    							'<div><p>content</p></div>';
    
    		$paragraph = explode ('</p>', $content); // separate post content into paragraphs
    		$firstp = $paragraph[0]; // select first paragraph
    
    		preg_match('/(<img.*?>)/', $firstp, $image); // select image tag in first paragraph
    		$custom = '<div>{$disclosure_content}</div>'; // add disclosure content
    
    		$remainder = preg_split('/(<img.*?>)/', $firstp); // select first paragraph content after image
    
    		if ($image) { // if image exists in first paragraph
    		echo $image[0]; // print image
    		echo $custom; // print disclosure
    		echo '<p>'; // open new paragraph
    		echo $remainder[1]; // print remaining first paragraph content
    		}	
    
    		else { // if image does not exist in first paragraph
    			echo $custom; // print disclosure
    			echo $firstp; // print first paragraph
    		}
    
    		$therest = implode('', array_slice($paragraph, 1)); // select remaining post content
    		echo $therest; // print remaining post content
    	}
    }
    add_filter('the_content', 'custom_filter');

    I wouldn’t even mind if the label was in incremental integers. I could then at least easily multiply it by my time unit. If my time unit was 30 seconds and the label was 8, it would be easy to look at that and think “4 minutes.” The way it is now, it reads 1:20 which I would then have to mentally translate to 8 units of 10 seconds, then multiply by my time unit.

    Of course actual time readings would be great, but this would be a very useful intermediate fix.

    Thanks for the plugin and for all your hard work on it.

    Thread Starter ibhhvc

    (@ibhhvc)

    I put the post ID into the shortcode and it pulled all the rest of the data correctly. The other weird thing is that blank box where the thumbnail should be actually links back to the CURRENT page I’m on, not to the page with the post ID I put in the shortcode.

    And yes, the post ID does refer to a post with a thumbnail, although the post I’m pasting it into does not have a thumbnail.

    Thread Starter ibhhvc

    (@ibhhvc)

    That’s actually really helpful. For some reason, it’s not able to pull the actual thumbnail. There’s just a blank box where the image should be. But I’m sure I can figure it out.

    Thanks so much!

    I am trying to resolve the same issue. I have installed the ImageMagick Engine WordPress plugin, but it has not helped. Am I doing this wrong?

Viewing 10 replies - 1 through 10 (of 10 total)