Special Recent Posts
Using same css in other theme files (11 posts)

  1. syrus33
    Posted 3 years ago #


    Love the way this script displays the recent posts within my page. It looks really nice & tidy.

    Is there a simple way to modify my themes category.php, tag.php, author.php, search.php & archive.php files in order to use the same css to display the posts?

    Would like the posts to display in the same format as I have currently setup on a my home page using shortcodes eg, Thumbnail, post title, post date & excerpt.



  2. Luca Grandicelli
    Plugin Author

    Posted 3 years ago #

    It already does that!

  3. syrus33
    Posted 3 years ago #

    Unfortunately it doesn't with my theme, no thumbnail shows when you click on tags or the archive as the code isn't included in the template files.

    I have had to resort to manually adding the date & thumbnail, etc

    The css however is totally different as the shortcode isnt included in the template file & because I dont use a widget the plugin isnt executed on the page.

    Can you please explain how I can get it to do that?


  4. syrus33
    Posted 3 years ago #

    *duplicate post*

  5. Luca Grandicelli
    Plugin Author

    Posted 3 years ago #

    Date, thumbnail?? Wait please...
    First of all, you can include the plugin in a template file just by adding the generated PHP code you get from any widget instance.
    Once you paste that code, you have another instance completely customizable.
    If this is what you intend to do, you only have to provide different css ids/classes in order to apply different styles to each widget.

    The style, is unique for every widget instance and you can override the plugin's one just by writing your own rules in your theme's stylesheet.

  6. syrus33
    Posted 3 years ago #

    Cheers for the reply, believe I understand what you mean.

    To Clarify: I want to keep the same SPR style throughout the entire site. I currently have only 1 instance of SPR which is shortcode on the main page & am happy with the default css in css-front.css - assigning id/s and classes shouldn't be required. What im trying to achieve is all posts in tags / author / categories to be dislay in the same format (current theme layout for the pages is totally different and doesnt include post time or thumbnail)

    So in order to have the tag/category/author/etc urls eg websiteurl.com/tags/<tag names> to display all posts in the same style as my main page - i can paste the php from a SPR widget into the themes tag.php which will display all posts relating to that tag in the same style as on the main page?

    Now this may be (another) stupid question - How do I obtain the php code from the widget? I need to display the content within the pages content & not in the widget area.

    If that doesnt make sense am I able to post the url as a visual example?

  7. Luca Grandicelli
    Plugin Author

    Posted 3 years ago #

    Yes, you have to paste the generated PHP code into the tags.php, author.php and category.php.
    In a widget instance, set all the options you need, hit save and then copy the code you'll find under the "Code Generator" tab.

    P.S: always provide a link.

  8. syrus33
    Posted 3 years ago #

    I was only using free version so therefore these options were not visible. Seen some screenshots of additional options on code canyon and purchased. Works perfectly now and money well spent, thanks.

    2 other quick questions though as im new to php/wordpress :)

    1) Using the php generator to insert code into theme files, how can I make the post string break bold? I tried adding <b> as a allow tag which doesn't work - I know im going about it the wrong way.

    eg. from template:
    "allowed_tags" => "<b>","string_break" => "<b>[Read More]</b>",

    2) Kinda a feature request this one. Would like to add an advertisement within the special recent posts output. Like after every 5 posts displayed. Would be neat to have the ability to add shortcodes from other scripts/php and allow users to specify after how many posts it appears. If that makes sense

    Thanks for your help

  9. Luca Grandicelli
    Plugin Author

    Posted 3 years ago #

    1 - You have to make it bold via css. Add this rule to your theme's stylesheet.
    a.srp-widget-stringbreak-link {
    font-weight: bold;

    2 - I'll take note, thank you :)

  10. syrus33
    Posted 3 years ago #

    Cheers Luca,

    1 final question before you can mark post as resolved.

    The php from code generator (inserted into categories) works fine.
    see http://digifixit.co.uk/tutorials/category/windows/

    However am unable to get it to show any posts when same php is posted in tag.php, i've played with the options but still cant get anything to display. I can get the tags to display with the default themes code tho.


    Code used:
    $args = array(
    "widget_title_hide" => "yes","post_limit" => "50","post_content_length" => "30","post_content_length_mode" => "words","post_author_url" => "no","post_category_link" => "no","string_break" => "[Read More]","category_autofilter" => "yes","vf_everything" => "no","vf_allcategories" => "yes");

    Could you please advise if this is possible?


  11. Luca Grandicelli
    Plugin Author

    Posted 3 years ago #

    Maybe your tag pages are not handled by the tag.php
    Otherwise it is quite strange because the code works within any page template.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic


No tags yet.