• Resolved Designer023

    (@designer023)


    Hi,

    I am using the shortcode to get the template to render out:

    [wdgpo_activities limit=’9′ template=’template’] and I have the template file: wdgpo-activities-template.php which works ok. I can see any code I put in myself such as <p>Test</p> shows up as a para tag on the page so I know the template is being called…

    However I can’t get the loop of posts to show. I tried copying the whole of the activities.php from the plugin folder but nothing shows. Can somebody explain or document the code I need to get this to work please? If someone has a demo of a template that I can use that would be great.

    Thanks,

    Carl

    https://wordpress.org/plugins/google/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi Carl,

    Thank you for your question.

    [wdgpo_activities limit=’9′ template=’template’] and I have the template file: wdgpo-activities-template.php which works ok.

    You will need to have a file named wdgpo-activities-TEMPLATE.php (where TEMPLATE is the value of this argument) in your theme directory.

    Kind Regards,

    Thread Starter Designer023

    (@designer023)

    Hi,

    Thanks for getting back to me. I have the code above…and the template file in my folder. It is definatly loading the wdgpo-activities-TEMPLATE.php page. I know this because in my template I put some text and this shows up ok.

    Sorry, my question was not really clear. What code do I need in the wdgpo-activities-TEMPLATE.php file to make the posts appear? I tried copying the whole of your activities.php in there but it shows nothing? Do you have a sample wdgpo-activities-TEMPLATE.php that I could use please?

    Thanks again

    Carl

    Hi Carl,

    Could you please try using the following code in your template file?

    $query = new WP_Query(array(
    	'post_type' => array('post', 'wdgpo_imported_post'),
    	'meta_key' => 'wdgpo_gplus_feed_id',
    	'meta_value' => $feed_id,
    	'posts_per_page' => (int)$limit,
    ));
    echo "<ul class='wdgpo_gplus_posts'>";
    	foreach ($query->posts as $post) {
    		$url = ('wdgpo_imported_post' == $post->post_type) ? get_post_meta($post->ID, 'wdgpo_gplus_item_id', true) : get_permalink($post->ID);
    		echo "<li>";
    		echo '<a class="wdgpo_gplus_post_title" href="' . esc_url($url) . '">' . esc_html($post->post_title) . '</a>';
    		echo "</li>";
    	}
    echo "</ul>";

    Best Regards,

    Thread Starter Designer023

    (@designer023)

    Hi,

    That is perfect. Thank you for letting me know. It’s not 100% clear what is needed from the docs but putting this in my templates works perfectly.

    Cheers,

    Carl

    Hi Carl,

    You are most welcome, if I can be of any further assistance please don’t hesitate to ask 🙂

    It needs basic WP_Query loop to display Google plus activities.

    Cheers.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Explain how the template works’ is closed to new replies.