• Hi. I think this plugin is awesome however, I am wondering if there’s a way to customize the results page when shared to social media (esp. Facebook) rather than just seeing the points results?

    For example:
    A personality test and the results are related to animals personality. Is there a way to display the animals picture with its personality description when shared to Facebook? Rather than just the result points?

    Looking forward to any help. Thanks 🙂

    https://wordpress.org/plugins/quiz-master-next/

Viewing 2 replies - 1 through 2 (of 2 total)
  • I will tell you how I solved it Ganessa. put this in the results text and it will redirect them to another page.

    <meta http-equiv="Refresh" content="0; url=http://webpage/">

    It is an ugly fix but it seems to be working. Then just ad your own sharebutton. here is an example of mine. Replace My url with yours.

    <a href="http://www.facebook.com/share.php?u=http://acrossfrommarty.com/Viral/fun-quizzes/what-family-guy-character-are-you/peter-griffin/">
    <img src="http://Acrossfrommarty.com/acrossfrommarty/images/icon/Social/Share-on-Facebook.png" alt="Facebook" /></a>

    here is an example on my quiz
    Use facebook debugger to check your share image and Excerpt. Click it a few times to see it all. If you want to update the image, rename it or facebook will keep using the old one for a long time without updating the cache.

    I just realised this only works for me cause I added some code to my template header. This way when people share it and someone clicks it it redirects them to the top of the quiz. You would have to add he results page to a category called Share Redirect.

    <?php ///////////////////////////////////////////////////////
    $ref = $_SERVER['HTTP_REFERER'];
    $host = $_SERVER['HTTP_HOST'];
    $parent = $post->post_parent;
    $parent_url = get_permalink($parent);
     ?>
        <script>
         var parent_url = <?php echo json_encode($parent_url); ?>;
        </script>
    <?php
    
    if ( in_category('Share Redirect') )
    	{
    		$donkey = $_GET["areacode"];
    		if ($donkey == '90210')
    			{
    			echo "<script type='text/javascript'>
    			window.location.replace(parent_url);
    			document.location = parent_url;
    			location = parent_url;
    				</script> 
    
    			<meta http-equiv='Refresh' content='0; url=".$parent_url."'>";	 
    
    			}
    	if(strpos($ref,$host)===0 || strpos($ref,$host)<=15)
    		{ // yes, three '='
    
    		// echo $parent_url.'<br/>You came from AFM'; 
    
    		}
    
    		else
    		{
    
    		echo "<script type='text/javascript'>
    
       window.location.replace(parent_url);
       document.location = parent_url;
    	location = parent_url;
    	</script> 
    
    		<meta http-equiv='Refresh' content='0; url=".$parent_url."'>";	
    
    // echo $parent_url.'<br/>You came from AFM'; 
    
            }
    	}

    Now when you share the link you add ?areacode=90210 to the end and it when they come from that link it will redirect them.
    The if(strpos($ref,$host)===0 || strpos($ref,$host)<=15) “<=15” is just saying if you came from anywhere that doesnt have my site address in the first 15 possitions. http://www.acrossfrommarty.com That number could be smaller but at 15 that seems to work. It was working by itself but some people on their phones were not being redirected correctly so I changed it to the area code thing. I left the if(strpos($ref,$host)===0 || strpos($ref,$host)<=15) part in as well because it will still redirect most people who just share the url and don’t click the share button. Or get there from someone sharing the link in a forum or from a google search

    I realize this code is messy and ugly and probably no help to beginners but will help someone who understands some javascript and php.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Result Page When Shared In Social Media’ is closed to new replies.