• I’m writing a plugin to list media post types within the context of a page using a shortcode.

    This is what I have so far for “my-plugin” (for example):

    * shortcode named “my-list”
    * page called “my-page” containing “[my-list]” to use the shortcode
    * post in “my-list” CPT page called “my-post”

    When I go to “my-page” to see “my-list” generated, it lists “my-post” on the page with a link to “/my-page/my-post”. When I click on the link, it goes to “/my-plugin/my-post” (which makes sense).

    What I would like is for it go to “/my-page/my-post”. In fact, what I it’s not complicated, what I really want is for it to go to “/my-page/%year%/%month%/my-post”.

    The most promising post to address this was this:

    https://vocecommunications.com/blog/2010/11/adding-rewrite-rules-for-custom-post-types/

    The only thing is that this seems overly complicated for what I want.

    Is there a better answer to this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ivorydrops

    (@ivorydrops)

    Just to clarify. When I go to “my-page” which uses “my-list” shortcode, I want to see the listing of links I created use the permalinks rules for where the posts are. In other words, when I use WP_Query and generate a listing using get_page_link(get_the_ID()), how can I have this link be the rewrite rules link in the form of “/my-page/%year%/%month%/my-post”?

    I don’t know why this is so complicated for me.

    Maybe the reality is that I don’t understand what is going on in WP when custom post types are looked up and associated with the rules for generating permlinks

    Any help here would be greatly appreciated.

    Thread Starter ivorydrops

    (@ivorydrops)

    moving to coding page. Closing this.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Shortcode, CPT, and ReWrites’ is closed to new replies.