Forums

[resolved] [Plugin: SidePosts Widget] SidePosts and Date (16 posts)

  1. bluebird2
    Member
    Posted 8 months ago #

    Is there any way to remove the date from SidePost?

    http://wordpress.org/extend/plugins/sideposts/

  2. Txanny
    Member
    Posted 8 months ago #

    By now the date and the posts format is hardcoded in the plugin. If you need to remove the date, you have to edit the plugin file and comment this lines:

    echo '<span class="sideposts_date">';
    	the_date();
    	echo ' | ';
    	the_time();
    echo '</span>';

    These are lines 236 to 240 (For 1.4.2 version). Will consider this for a next version, but don't want to complicate the plugin with lots of options.

  3. bluebird2
    Member
    Posted 8 months ago #

    Thanks.

  4. Txanny
    Member
    Posted 8 months ago #

    Just have to remember: If you update the polugin to a newest release, you will lose this changes.

  5. bluebird2
    Member
    Posted 8 months ago #

    What lines should I comment out to remove "Read full post ยป" from the sidebar?
    I think this is not necessary since the title of the post is already a link.

  6. bluebird2
    Member
    Posted 8 months ago #

    Never mind. I found it. I wish these features had an option page, or check-mark options within the widget.

    Thanks for all the help.

  7. Txanny
    Member
    Posted 7 months ago #

    About this. The development version (to be released as 1.5) now includes a filter for the date called 'sideposts_date'.

    To remove the date, just write a filter like this:

    function my_sideposts_date( $date ) {
        return '';
    }
    add_filter('sideposts_date', 'my_sideposts_date');

    Of course, I recommend not to write this on the plugin's file, as it will be lost when updating.

  8. bluebird2
    Member
    Posted 7 months ago #

    Excuse my lack of PHP knowledge, but where should I place this code?

  9. Txanny
    Member
    Posted 7 months ago #

    Normally I set this in my functions.php file in the themes folder. Or just as a personal plugin with all my custom filters ;)

    To create a plugin to hold this is really simple, here the file:

    <?php
    /*
    Plugin Name:	My Custom Filters
    Plugin URI:	http://alkivia.org
    Description:	Just a plugin to hold my personal custom filters.
    Version:	1.0
    Author:		Txanny
    Author URI:	http://alkivia.org
    */
    
    function my_sideposts_date( $date ) {
        return '';
    }
    add_filter('sideposts_date', 'my_sideposts_date');
    ?>

    Just call the file how you want (I call it my-filters.php) and set it in the plugins folder. Activate it as a normal plugin.

    With filters you have not to worry, if you deactivate the SidePosts plugin, this filter will no run, so you will broke nothing on your site ;)

  10. bluebird2
    Member
    Posted 7 months ago #

    Thanks. It worked perfectly.

    Would you tell me what I should add there to remove RSS and "Read the full post" links? All I need is the title and the excerpt.

  11. chavahn
    Member
    Posted 5 months ago #

    Hi!
    I am in the same situation than bluebird2. I would like to remove the "Read full post" and the RSS icon from the widget. Actually I would like to keep only the title of the post and the thumbnail. How can I remove the excerpt? Thank you.

    The plugin is amazing, thank you so much!

  12. Wee Beastie
    Member
    Posted 5 months ago #

    Hello,
    I was able to achieve this by making some small edits to the widgets.php file. Bear in mind that I am no php guru, so proceed at your own risk:

    I commented out lines 151 and 152 to get ride of the date.

    $date_string = '<span class="sideposts_date">'. mysql2date(get_option('date_format'), $post->post_date) . ' | ' . get_the_time() .'</span>';
    					echo '<br />' . apply_filters($this->ID . '_date',  $date_string);

    To get rid of the READ MORE link, I changed line 158 from this

    the_content('<p>' . __('Read more &raquo;', $this->ID) . '</p>');

    to this

    the_content('','true','');

    I hope this helps out. Someone may have a better suggestion, but this worked for me.

    @ Dev: This is a great plugin! It seriously helped me provide the needed functionality to a client, which is huge. So thank you very much!

    I think if you had the plugin generate classes and/or id's for all of the key elements, that could make it easier for users to customize the appearance. For instance: span.sideposts_date is generated dynamically, so that makes it very easy for a user like me to get rid of that element if I don't want it using CSS instead of messing with your code.

    span.sideposts_date {display:none}

    And it's gone! Thanks again for the great plugin

  13. lilatovcocktail
    Member
    Posted 3 months ago #

    Txanny,
    I created a filters file to remove the date just as you suggested post #9, and I uploaded it to /public_html/wp-content/plugins/sideposts. But I'm not seeing a difference. Is there a step I missed?

    Since we're talking about options, I'd love to see the date, archive link and RSS button become optional. In my current use of the plugin (on http://theagnonschool.org), none of that is needed right now and just creates clutter.

    (Oh, and can you also make the plugin do my dishes and answer my email?) ;-)

  14. Txanny
    Member
    Posted 3 months ago #

    Because what I've shown in that post is how to write a plugin to do it, you have to upload the file to the plugins folder, and activate it as a regular plugin. You've wrote a custom plugin, and it will act as a plugin: Have to be uploaded to plugins folder and activate it on plugins page.

  15. lilatovcocktail
    Member
    Posted 3 months ago #

    Ah, of course. Thank you Txanny.

  16. Club6
    Member
    Posted 2 months ago #

    Hello Txanny

    Sorry to ask but could you kindly complete your "my custom filter" file so that your (great) plug-in doesn't show the "readmore" link ?

    Can I change the name of the "Archives" link. It's in English and my readers are French.

    Hope this is not too much to ask, thank you for your time & your nice work anyway

Reply

You must log in to post.

About this Topic

Tags