• I have written a plugin using CURL to fetch HTML from a file and publish it to a page/post or widget using a shortcode. I also have a Facebook “like” button and the Twitter button installed and activated with settings to publish before (at the top) of posts and pages.

    When I use the shortcode the content publishes before the Twitter/Facebook pushing them to the bottom of the page just about the comments section. If I use the shortcode in a widget the TITLE publishes beneath the content in the sidebar instead of on top of it. Ideas?

    function get_data($url)
    {
    	$curl_handle=curl_init();
    	curl_setopt($curl_handle,CURLOPT_URL,'sometext.txt');
    	curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
    	curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
    	$buffer = curl_exec($curl_handle);
    	curl_close($curl_handle);
    
    		if (empty($buffer))
    	{
    		print "New data is unavailable but coming soon!<p>";
    	}
    	else
    	{
    		print ("<p>$buffer</p>");
    	}
    }
    
    add_shortcode('content-ddk', 'get_data');

The topic ‘CURL fetched content publishing in wrong location?’ is closed to new replies.