WordPress.org

Ready to get started?Download WordPress

Forums

The Google+ plugin
[resolved] Explain how the template works (6 posts)

  1. Designer023
    Member
    Posted 6 months ago #

    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/

  2. WPMU DEV
    Member
    Posted 6 months ago #

    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,

  3. Designer023
    Member
    Posted 6 months ago #

    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

  4. WPMU DEV
    Member
    Posted 6 months ago #

    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,

  5. Designer023
    Member
    Posted 6 months ago #

    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

  6. WPMU DEV
    Member
    Posted 6 months ago #

    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.

Reply

You must log in to post.

About this Plugin

About this Topic