• Resolved ftpwp

    (@ftpwp)


    Hi @bueltge,

    Is there a predefined order for each item:
    – Title
    – Description
    – Date
    – Creator
    – Picture

    I need to set the date first, before the title.
    How can I do that?
    How can I choose the order of each item?

    Thanks!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter ftpwp

    (@ftpwp)

    Hi @bueltge,

    Any help to achieve it?

    Thanks!

    Plugin Author Frank Bueltge

    (@bueltge)

    The plugin haven’t any predefined settings, you should create it via the parameters there are documented inside the readme. Maybe use also the helping hands of CSS to to get your choice of design result.

    Thread Starter ftpwp

    (@ftpwp)

    Hi @bueltge,

    Thanks for your answer!

    The plugin haven’t any predefined settings

    That’s what I like with your plugin. We’re free to setup the design as we want.

    However, I can find any solution for the item order :-/

    you should create it via the parameters there are documented inside the readme

    That’s what I did.

    Here is my code…
    [RSSImport display="10" feedurl="https://www.aeromorning.com/rss/" date="true" date_format="Y-m-d" truncatetitlechar="100" truncatetitlestring="..." target="blank" displaydescriptions="false" use_simplepie="true"]

    The result is the following…

    Saft équipera l’avion régional MA700 du chinois AVIC 2019-06-20
    Bpifrance entre au capital de Sabena technics 2019-06-20
    International Airlines Group annonce son intention… MAX 2019-06-18
    Global Space, le nouveau rendez-vous de référence… 2019-06-18
    Siemens lance sa solution IPP&E pour le secteur… 2019-06-17

    But how do I place the date first?
    I would like…

    2019-06-20 – Saft équipera l’avion régional MA700 du chinois AVIC
    2019-06-20 – Bpifrance entre au capital de Sabena technics
    2019-06-18 – International Airlines Group annonce son intention…
    2019-06-18 – Global Space, le nouveau rendez-vous de référence…
    2019-06-17 – Siemens lance sa solution IPP&E pour le secteur…

    Any direction? (I’m not an expert of CSS) ??

    Thanks!

    • This reply was modified 5 years, 5 months ago by ftpwp.
    • This reply was modified 5 years, 5 months ago by ftpwp.
    Thread Starter ftpwp

    (@ftpwp)

    Hi @bueltge,

    Any direction to help me?
    Thanks!

    Plugin Author Frank Bueltge

    (@bueltge)

    I’m not sure, but I mean it is not possible with the plugin. Maybe you should change this order via CSS, so that the visual result is like your goal.

    Thread Starter ftpwp

    (@ftpwp)

    Ok, but can you give me a hint about how you can do it via CSS?
    You must have something in mind.
    I really don’t know how CSS can help split a string in smaller sub strings and re-order them ??

    • This reply was modified 5 years, 1 month ago by ftpwp.
    Thread Starter ftpwp

    (@ftpwp)

    Hi @bueltge,

    I really don’t know why this topic is tagged “Resolved” as obviously, so far it was not.
    Anyway…

    Maybe you should change this order via CSS, so that the visual result is like your goal.

    Are you sure this is even possible?
    Once again, I really don’t know how CSS can help split a string in smaller sub strings and re-order them. I would have appreciated a bit more support if you think it’s possible. I’ve asked my question 6 months ago now ??

    So I had no other option than to look into the code.
    Fortunately this plug-in is quite simple. Only 1 file. And I straight away found an easy solution :

    Search for those lines…

    $echo .= '<a' . $target . $rel . ' href="' . $href . '" title="' . $atitle . '">' . $title . '</a>';
    
    if ( isset( $pubDate ) && $date && '' !== $pubDate ) {
    	$echo .= $before_date . $pubDate . $after_date;
    }

    And replace them by those ones (to just move the date before the title)…

    if ( isset( $pubDate ) && $date && '' !== $pubDate ) {
    	$echo .= $before_date . $pubDate . $after_date;
    }
    
    $echo .= '<a' . $target . $rel . ' href="' . $href . '" title="' . $atitle . '">' . $title . '</a>';

    Then use the before_date & after_date parameters to adjust the design.

    That’s it. Done!
    It was really easy.

    Now, it’s a modification I have to do in the code of the plug-in. So it’s a pity as if a new update comes, it will be removed.

    So why not adding in the core of the plugin the possibility to order the 4 items that can be displayed?
    – Title
    – Date
    – Creator
    – Description

    Being able to get such combination or few others makes sense…

    2019-06-20 – Saft équipera l’avion régional MA700 du chinois AVIC
    2019-06-20 – Bpifrance entre au capital de Sabena technics
    2019-06-18 – International Airlines Group annonce son intention…
    2019-06-18 – Global Space, le nouveau rendez-vous de référence…
    2019-06-17 – Siemens lance sa solution IPP&E pour le secteur…

    It could just be one additional parameter, for example called “order”, with settings like this:
    order="date,title,creator,description"
    order="title,date,description,creator"
    – or even this order="date,description" with only 2 items to display

    Then in the code you just need to:
    – explode the value of “order” in an array…
    $order_array = explode(",", $order);
    – and for each value, run the appropriate code to build you HTML code in the right order…

    foreach ($order_array as $items) {
        switch ($items) {
            case "title":
                // Code to add the title
                $echo .= '<a' . $target . $rel . ' href="' . $href . '" title="' . $atitle . '">' . $title . '</a>';
                break;
            case "date":
                // Code to add the date
                if ( isset( $pubDate ) && $date && '' !== $pubDate ) {
    		$echo .= $before_date . $pubDate . $after_date;
    	    }
                break;
            case "creator":
                // Code to add the creator
                if ( isset( $creator ) && $creator && '' !== $creator ) {
    		$echo .= $before_creator . $creator . $after_creator;
    	    }
                break;
            case "description":
                // Code to add the description
    	    if ( isset( $desc ) && $displaydescriptions && '' !== $desc ) {
    		...
    	    }
                break;
        }
    }

    That’s it. Done!
    As simple as that.

    What do you think about this possible enhancement?
    Thanks.

    Plugin Author Frank Bueltge

    (@bueltge)

    Thanks for your enhancement solution. I don’t have any interesting to maintain the plugin or enhance it. The solution is old, should rewrite in more solid code. However maybe you will contribute the code so I would open this for you? Write to me about wp-Slack or mail if you have an interest.

    Thread Starter ftpwp

    (@ftpwp)

    Hi,

    Thanks but I’m currently not interested in developing, maintaining and supporting a WP plugin. I was just trying to help. Sorry.

    It’s sad though cause this plugin is simple but allows to do whatever we want without being forced to use not suitable designs imposed by most other plugins.

    I’ll keep using it as long as it’s still compliant with the last WP version.

    Thanks.

    Plugin Author Frank Bueltge

    (@bueltge)

    @ftpwp Okay, I have implemented this small change; maybe it helps also other users.

    Thread Starter ftpwp

    (@ftpwp)

    Thanks @bueltge !
    I’m sure it will.

    And I confirm, it works like a charm.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Date first, before title?’ is closed to new replies.