• Resolved mnasmark

    (@mnasmark)


    Trying to figure out how to display magazines (post type “tidningar”) from a specific year. The manual does not give a proper example of how such a statement should be written. The code below does not work properly, it just shows al magazines.

    [raw]
    [for type=tidningar year=2019][loop orderby=date][link]
    [field image size=thumbnail]
    <h4>[field title]</h4>
    [field date] | [field excerpt words=25]…<br>[/link]
    [/loop]
    [/for]
    [/raw]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Why are you using the [for] shortcode?

    This should work:

    [loop type=tidningar year=2019 orderby=date][link]
     [field image size=thumbnail]
     <h4>[field title]</h4>
     [field date] | [field excerpt words=25]…<br>[/link]
    [/loop]
    Thread Starter mnasmark

    (@mnasmark)

    You are right @peterpolow , the [for] is not necessary.
    However, it still shows magazines from all years.

    I am pretty sure I am not using the “year” correctly.

    The documentations is not very complete.

    —–

    Published date
    year, month, day – display posts by specific year, month, day

    this – for example: month=this will show posts from this month
    before – display posts before a relative or specific date

    Example: before=today, before=2015-02-01
    after – display posts after a date

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

    (@mnasmark)

    Is should have payed more attention to the creation date of the different magazines. Turned out the client had put them all in 2019. No wonder they were all in 2019… Doh!

    The above code works.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Display posts from a specific year’ is closed to new replies.