• Resolved crzyhrse

    (@crzyhrse)


    Hello,

    I’ve made some changes to excerpt styles by creating a intelliwidget directory in my theme and uploading the intelliwidget.css and adjusting/adding there… It works fine for what I need regarding styles…

    I also wanted to do some things with the ellipses at the end of excerpts… I have been able to do what I need by changing line 308 in the class-widget-intelliwidget.php file… Changing it to this… $excerpt .= ' ?. . . "'; So that I get spaces between the dots, and a quote at the end… There is also a hard space in front of the first dot…

    I tried putting the php file into the intelliwidget directory with the style css but didn’t affect, so made the changes in the actual file in the plugin, which gives me what I wanted…

    So my question is, is there a way to do this, another place/way to put the change, so I don’t loose the change when the plugin is updated…?

    Kind regards,

    John.

    https://www.ads-software.com/plugins/intelliwidget-per-page-featured-posts-and-menus/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author lilaeamedia

    (@lilaeamedia)

    There is a filter for this purpose.

    Add this to your theme functions file:

    function my_intelliwidget_trim_excerpt($excerpt, $instance) {
        // .. do what you want with the excerpt, instance contains the
        // intelliwidget options ...
        return $excerpt;
    }
    
    add_filter('intelliwidget_trim_excerpt', 'my_intelliwidget_trim_excerpt', 15, 2);
    Plugin Author lilaeamedia

    (@lilaeamedia)

    Another note:

    There is already an internal filter that truncates the excerpt to the length specified in the options. To modify the result AFTER this, set the priority higher than 10.

    To modify the excerpt BEFORE it is truncated, set the priority lower than 10.

    To space the elipses, you can do something like this in your function:

    $excerpt = preg_replace("/\.\.\./", ' . . . ', $excerpt);

    or the more efficient str_replace:

    $excerpt = str_replace('...', ' . . . ', $excerpt);

    Then set the priority to something higher:

    add_filter('intelliwidget_trim_excerpt', 'my_intelliwidget_trim_excerpt', 15, 2);

    Thread Starter crzyhrse

    (@crzyhrse)

    Thanks for this… And., there is an assumption that I wish I deserved, but don’t, which is that I understand more than I do in regards to php, etc… Finding the ellipses was easy, and I was fortunate that what I tried worked… And the css was relatively easy once I saw what is already there, knew where to put it from your docs, and then played with the possibilities…

    If you might show the completed code to go into the functions file, I could both go ahead and get it to work in that way, as well as then compare it with what you are saying in both posts above, study the differences and similarities a bit, and thereby probably learn a little bit more about all of this…

    What I am reaching for (and have accomplished though it will be lost the next time the plugin is updated) is as in my first post, a space in front and between the dots, another space after, then a quote… I used hard spaces (option/space) in front and behind because regular spaces there did not show… I could modify some of it if need be, once I saw the completed code that would go into the function file…

    I do appreciate what is possible with this plugin as well as your great support, that is for sure…

    Regards,

    John.

    Plugin Author lilaeamedia

    (@lilaeamedia)

    Combine the two like this:

    function my_intelliwidget_trim_excerpt($excerpt, $instance) {
       $excerpt = str_replace('...', ' . . . ', $excerpt);
       return $excerpt;
    }
    
    add_filter('intelliwidget_trim_excerpt', 'my_intelliwidget_trim_excerpt', 15, 2);
    Thread Starter crzyhrse

    (@crzyhrse)

    Thank you very much, this works perfectly…

    Much, much gratefulness,

    John.

    Plugin Author lilaeamedia

    (@lilaeamedia)

    Thread Starter crzyhrse

    (@crzyhrse)

    Thank you… I will explore…

    Kind regards…

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘A change in php…’ is closed to new replies.