WordPress.org

Ready to get started?Download WordPress

Forums

jQuery Archive List Widget
Change the url path of the news (3 posts)

  1. alfa.alex
    Member
    Posted 8 months ago #

    Hello,

    in the page "Settings -> Permalink" of WordPress I've set the custom structure for the url, which is: /news/%post_id%

    The plugin has a default structure which is: /news/date/*YEAR*/*NUM_MONTH*

    *YEAR* and *NUM_MONTH* are my exampled keys, but they correspond to the year and month number of the news.

    How can I change the url path of the plugin to make it similar to /news/%post_id% ?

    I've found the part of code, where the link to the montly news is created:

    foreach ($months as $month) {
     $month_url = get_month_link($years[$i]->year, $month->month);
    
     $style = $currentYear || $instance['expand'] == 'all'? 'list-item' : 'none';
     $html.= "\n\t<li class=\"jaw_months\" style=\"display:{$style};\">";
     $html.= "<a href="{$month_url}">";

    but I'm not able to change correctly the logic of this code.

    Could help me or give me some kind of advice?

    Thank you very much.

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    http://wordpress.org/plugins/jquery-archive-list-widget/

  2. alfa.alex
    Member
    Posted 8 months ago #

    [update]

    Hello again.

    Observing deeper the code and trying to understand the real working of the plugin, I've undesrtood that the link to which the month-x of the year-y links to the archieve of that month.

    In fact the month_url redirect to the archieve page accorded to the selected month... but this is a little bit limited to my "business" I think.

    I've chosen form the permalink page to map the urls with a logic designed around the post ID.
    So I need to change the montlhy url month_url, according to the post ID.
    I've found the get_permalink(); function and tryed to substitute it.
    But the result is not the desidered one, 'cause the get_permalink links only to the last written post.
    So I need to map the url, from the monthly archieve to the selected post listed...

  3. Miguel Useche
    Member
    Plugin Author

    Posted 8 months ago #

    What i recommend you is to modify the URL according to your format, look the difference between wp archive's link and your format, then with regex, change it to your format and add the POST's ID.

Reply

You must log in to post.

About this Plugin

About this Topic