• Resolved robgnyc

    (@robgnyc)


    Just installed the plugin and works as advertised. I’m using it on a custom post type called “News”. However when I select the year it takes me to /blog/2022 and when I look at the codes I see that’s what the value is of the option pulldown.

    I know WordPress has issues with you having both a blog and a custom post type with year style archives.

    What is the best way to work around this so that my results appear at /news/2022.

    Not sure if I should be looking at filters, re-directs, etc. Realize it will probably take some PHP and custom code which is fine, just want to be pointed in the right direction.

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Contributor twinpictures

    (@twinpictures)

    are you using the shortcode, or the sidebar widget?
    there should be no problem to use this on a custom post type.
    can you share an example of the shortcode, or a screenshot of the widget settings you have going on?

    fret not, we’ll get you sorted out, quick like a monkey.

    Thread Starter robgnyc

    (@robgnyc)

    Here is the shortcode:

    [archives type=”yearly” format=”option” post_type=”news” /]

    Plugin Contributor twinpictures

    (@twinpictures)

    I trust that those quotes are true quotes (") and not ‘curly quotes’ (”), yes?

    [archives type="yearly" format="option" post_type="news" /]
    
    • This reply was modified 2 years, 10 months ago by twinpictures.
    Thread Starter robgnyc

    (@robgnyc)

    Yes. You can see it working here:

    https://rubioslivedev.wpengine.com/press/

    Plugin Contributor twinpictures

    (@twinpictures)

    ah yes! I seem to remember this being an issue on some themes.
    I’ll look into the wayback machine and get back to you in the morning (it’s already tomorrow here).
    I seem to remember there was a solution, but it could not be implemented for everyone because…. that part I don’t remember.
    Hold tight for a beat, we’ll get back to you.
    No, really, we will.

    Plugin Contributor twinpictures

    (@twinpictures)

    Ah! one last test.
    to make sure there is not another plugin using the same shortcode, can you try using arcpromat like so:

    [arcpromat type="yearly" format="option" post_type="news" /]

    joy, no joy?

    Plugin Contributor twinpictures

    (@twinpictures)

    OK, back up to speed on this issue.
    First, you might want to install the 1.6.0 RC from GitHub:
    https://github.com/baden03/annual-archive

    The RC has an option to use_cpt_archive which generates the archive links using https://developer.www.ads-software.com/reference/functions/get_post_type_archive_link/

    This will work if you have the correct permalink structure setup up for your cpt archives, however, depending on your theme and permalink settings you will most likely still need to add your own rewrite rules (this get pretty deep, pretty quick):
    https://developer.www.ads-software.com/reference/functions/add_rewrite_rule/

    Anyway, scan your peepers over that info and get back to us if you get stuck, have further questions, or if by some magical twist everything works with the RC!

    Thread Starter robgnyc

    (@robgnyc)

    The 1.6 upgrade didn’t help but don’t worry about it.

    I can figure it out and play with the re-writes. I’m using the Avada theme at the client’s request and god knows what it does to the URL structure.

    Basically, not your problem. I appreciate your help. If I get it figured out and it seems like something that will benefit others, I will post the solution here for future users.

    Thanks for the quick and thorough response.

    Plugin Contributor twinpictures

    (@twinpictures)

    You need to activate the cpt_archives in the options page, or use the use_cpt_archive attribute in the shortcode.

    [archives type="yearly" post_type="news" use_cpt_archive="true" /]
    
    Thread Starter robgnyc

    (@robgnyc)

    I checked the box, saved, re-saved the permalinks (just in case), cleared the cache on WPEngine. Also tried adding use_cpt_archive=”true” to the shortcode.

    Still no change.

    I think it’s something in how Avada handles re-writes. Will have to do some research.

    Plugin Contributor twinpictures

    (@twinpictures)

    Interesting! OK, do keep us posted. If we can implement a solution to make your, and by extension, the rest of our lives easier, we want to make that happen.

    Thread Starter robgnyc

    (@robgnyc)

    I figured out the issues. I had set my custom permalink structure to:
    /blog/%postname% in order to get my blog posts to appear under /blog.

    This works and my Press post still appear under /press.

    However the Annual Archive then ends up going to /blog/2022/?post_type=press.

    My category archives also end up under /blog/press-category.

    If I take the /blog out of my redirects, Annual Archive works correctly but then my blog posts go back to being located at /postname.

    In any case it seems like an issue unique to my setup, not a problem with the plugin. I will need to sort it out with some more complex re-directs I suspect.

    Plugin Contributor twinpictures

    (@twinpictures)

    Yeah, there is an art to rewrite urls.

    gets pretty deep, pretty quick

    Glad you are pointed in the right direction. Ping back, should you run into a roadblock.

    Issue marked as resolved for now… could be reopened at a later date.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Change URL of results to /custom-post-type/year’ is closed to new replies.