WordPress.org

Ready to get started?Download WordPress

Forums

WP Symposium Blog Post
[resolved] WP-Symposium Blogpost-unable to use it (21 posts)

  1. Pinaz
    Member
    Posted 1 year ago #

    Hi developers,
    I have just installed on WP-Symposium the latest available version of Blogpost (Version 0.0.14). Unfortunately it does not create the page and therefore the menu item as per your instructions.
    I have manually created the menu item (in the horizontal feature) and the 2 posts i previously created using Word press became visible. I did also create a page called blogpost and inserted the shortcode [symposium-blogpost] and i couldn't visualize nothing, except my the written shortcode. I can see in the Installation that there is a record of Blogpost but there is no page linked to it.
    Please can you help me?
    Thank you for the great work :)

    http://wordpress.org/extend/plugins/wp-symposium-blogpost/

  2. Guillaume Assire
    Member
    Plugin Author

    Posted 1 year ago #

    Hi
    Sorry for the late reply, I'm not following this forum as I should...
    There's no need to create a page, and the shortcode you mention doesn't exist. It's the WP Symposium profile page which will hold the list of blog posts for a given author, under a dedicated menu item. You then have the ability to display the WPS profile page defaulting to that list of blog posts.
    When switching to a horizontal menu, you need to manually add the line "Blog Posts=blogpost" to the profile page menu items, both for "your page" and "other members", where you can give it your preferred title. For a vertical menu, the item is added automatically, but not for a horizontal one.
    Hope everything is clear... Feel free to ask any further question if it isn't, I'll do my best to answer ASAP, I promise !...
    Thanks for your interrest,
    AG

  3. lildragn
    Member
    Posted 1 year ago #

    Hi AlphaGolf... is it possible to expand this to show custom post types instead? And possibly a thumbnail? This would be great and a feature I would heavily utilize.

    Thanks!

  4. Guillaume Assire
    Member
    Plugin Author

    Posted 1 year ago #

    Have a look at developers.txt in the plugin folder (and equally in the zip file). This file describes the hooks of the plugin, which hopefully should make your day...
    - The hook 'symposium_blogpost_query_hook' allows you to replace the default query with the post_type you want
    - The hook 'symposium_blogpost_row_hook' allows you to add anything you need to each post row

    FYI Next release is planned in the coming weeks, in sync with next release of WP Symposium. Feel free to forward any request and I'll see what I can arrange in this timeframe.

  5. lildragn
    Member
    Posted 1 year ago #

    Excellent thanks. Will test this right now. Been looking for a way to do this for awhile now :)

    Cheers

  6. Guillaume Assire
    Member
    Plugin Author

    Posted 1 year ago #

    Eh-eh, and all this has been available since last Summer or so ;)

    Don't forget to turn WP Symposium in debug mode if this doesn't give you the expected result... Dashboard, WP Symposium > Manage > Settings, bottom of page, and it'll dump the query at the WPS profile page, blog post menu.

  7. lildragn
    Member
    Posted 1 year ago #

    Yeah, I'm just in the process of migrating my site from Mingle to WPS :) WPS is a bit trickier to handle but it's definitely better.

  8. lildragn
    Member
    Posted 1 year ago #

    Hi AG, this worked great, just changed the post_type to my custom name and it's displaying those rows nicely. So as far as displaying thumbnails to the right of each row, how would I accomplish this?

    Thanks much for your help

  9. lildragn
    Member
    Posted 1 year ago #

    So I tried a variety of ways to display the thumbnails without success, so hopefully you'll reply with a solution when you have a moment.

  10. Guillaume Assire
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Little Dragon, sorry to read that. For each post, the hook sends both the small bit of HTML that defines the row, and the post ID. You can then either add what you want or replace the row completely.

    I'm not too familiar with post thumbnails, but for each post I would get the thumbnail id with get_post_thumbnail_id($post_id) then its URL with wp_get_attachment_image_src($thumb_id). From then I would return to the hook something like $html . < img style="height;width;" src="$url" > eventually made clickable. This is untested, but should work...?

  11. lildragn
    Member
    Posted 1 year ago #

    Hi AG, sorry to be such a bother, I really appreciate your help, and your plugin so far makes an excellent addition on my site.
    Below is what I'm adding to my functions.php and unfortunately doesn't return anything. I'm not that great with PHP at the moment but learning, so maybe you could help me with this block of code so I know where my error is here?

    function symposium_blogpost_row_action ( $html, $post_ID ) {
    
    	$post = get_post_thumbnail_id($post_id);
    	$url   = wp_get_attachment_image_src($thumb_id);
    	$html .= '<div class="symposium_blogpost_excerpt">';
    	$html .= '<img style="height;width;" src="$url">';
    	$html .= '</div>';
    
    	return $html;
    }
    add_filter ( 'symposium_blogpost_row_hook', 'symposium_blogpost_row_action', 10, 2 );

    Thanks again

  12. Guillaume Assire
    Member
    Plugin Author

    Posted 1 year ago #

    Ah, sorry I was too synthetic, assuming you would decode my previous message. If you look at the doc in the Codex for wp_get_attachment_image_src you'll see it returns an array. So you should put something like:

    function symposium_blogpost_row_action ( $html, $post_ID ) {
    
    	$thumb_id = get_post_thumbnail_id($post_id);
    	$image_attributes = wp_get_attachment_image_src($thumb_id);
    	$html .= '<div class="symposium_blogpost_thumbnail">';
    	$html .= '<img src="' . $image_attributes[0] . '" width="' . $image_attributes[1] . '" height="' . $image_attributes[2] . '">';
    	$html .= '</div>';
    
    	return $html;
    }
    add_filter ( 'symposium_blogpost_row_hook', 'symposium_blogpost_row_action', 10, 2 );

    Note that I have renamed your class to match its content, but this is strictly up to you. You will also have to play with CSS to align it to the right.

    Thanks for your nice words, appreciated.

  13. lildragn
    Member
    Posted 1 year ago #

    Yup this looks much better than mine haha. Unfortunately though nothing returned with it. Let me know if you can see this profile http://videogame-art.com/my-profile/ForestWolf/ and take a look at Gallery uploads. Remembering this is a custom post type called "Portfolio" where users create their entries. I'll try a little more tonight to see what else I can tinker with as well.

    Cheers!

  14. Guillaume Assire
    Member
    Plugin Author

    Posted 1 year ago #

    I can see the added div to each row, it contains img height="" width="" src="" which would indicate that wp_get_attachment_image_src returned an empty array. Isn't your thumbnail stored as a post attachement ?

  15. lildragn
    Member
    Posted 1 year ago #

    So it is working, just not pulling the image, interesting. Ok so i'm using the featured image feature to "attach" images to posts, so they're not inserted into the description field if you know what I mean?

  16. Guillaume Assire
    Member
    Plugin Author

    Posted 1 year ago #

    Odd... Re-reading the Codex, this seems to corresponds exactly to the functions used above, so it *should* work... But then as I already stressed I'm not an expert regarding thumbnails.

    I would, either:
    1) Investigate the above by dumping the $thumb_id, with a basic 'echo $thumb_id;' right after get_post_thumbnail_id, to check if this actually "Returns the ID of the featured image attached to the post"...?

    2) Alternatively, use get_the_post_thumbnail which returns the whole HTML img element:

    function symposium_blogpost_row_action ( $html, $post_ID ) {
    
    	$html .= '<div class="symposium_blogpost_thumbnail">';
    	$html .= get_the_post_thumbnail($post_ID, 'thumbnail');
    	$html .= '</div>';
    
    	return $html;
    }
    add_filter ( 'symposium_blogpost_row_hook', 'symposium_blogpost_row_action', 10, 2 );

    Let me know if any of these allows you to move forward...?

  17. lildragn
    Member
    Posted 1 year ago #

    AlphaGolf you're a scholar and a gentleman. Recheck the link now, works like a charm! This really elevates my site to where I wanted it to be. Thanks for all your help. Maybe add this example to future docs :)

    Cheers!

  18. Guillaume Assire
    Member
    Plugin Author

    Posted 1 year ago #

    Nice indeed :) More than happy I could contribute to your site, it looks great, already bookmarked ;)

    If one day you think the thumbnails are self-sufficient, remember the content of a row can be completely *replaced*. Also I would make these thumbnails clickable, by encapsulating the get_the_post_thumbnail inside a '<a href="'.get_permalink($post_ID).'">' and its closing tag. Last, ever thought of displaying the thumbnails two by two or three by three ? By playing with the CSS width you should achieve this, see developers.txt.

    As for the doc, I'm thinking of adding these few lines to this small txt file, if you don't mind.

    All the best wishes to VG-A !

  19. lildragn
    Member
    Posted 1 year ago #

    Awesome, very flexible indeed. I added them 2 up and like this a lot better. Kept getting a parse error with the clickable code, so I left that out for now. Tried using

    '<a href="'.get_permalink($post_ID).'">'get_the_post_thumbnail($post_ID, 'thumbnail')'</a>';

    Amongst other variants :)

  20. Guillaume Assire
    Member
    Plugin Author

    Posted 1 year ago #

    What about this variant ;)
    $html .= '<a href="' . get_permalink($post_ID) . '">' . get_the_post_thumbnail($post_ID, 'thumbnail') . '</a>';

  21. lildragn
    Member
    Posted 1 year ago #

    *smacks head* forgot the concatenation haha. *learning... :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic