CMB2-Post-Search-field icon indicating copy to clipboard operation
CMB2-Post-Search-field copied to clipboard

Include archive URLs in found select options.

Open sebask opened this issue 8 years ago • 7 comments

Currently it's not possible to select "pages" like an post archive page. Any way to accomplish this?

sebask avatar May 24 '17 08:05 sebask

Sure it is, use the 'post_type' field parameter like in the example in the readme, but replace 'post' with 'page'.

jtsternberg avatar May 24 '17 12:05 jtsternberg

Sorry for not describing this more clearly in my initial post. I meant an archive page as in the "system" archive page for i.e.: posts (archive.php), or CPT (archive-{post_type}.php).

I guess the problem is these are not really registered with an post id.

sebask avatar May 24 '17 12:05 sebask

If I'm following correctly, those would just be the template files chosen to display the results of the query made for that archive. Not quite sure how they'd tie into this search field extension in this case.

tw2113 avatar May 24 '17 13:05 tw2113

The creative solution we've come up with to this issue is to create link format pages that are basically a redirect over to the archive page URL. We can then select the link page and it acts like a pointer over to the CPT archive page.

clovepod avatar May 24 '17 13:05 clovepod

Ahhh, @clovepod clued me in on what @sebask was looking for. They wanted to be able to select archive URL from the dropdown.

tw2113 avatar May 24 '17 14:05 tw2113

Indeed, we often use those pages to display all post in our custom post types. Btw, Wordpress does show these archive pages in the Menu selector (see screenshot). Maybe that could be useful. screen shot 2017-05-26 at 13 09 11

@clovepod Thanks! Sounds like a great quick fix.

sebask avatar May 26 '17 11:05 sebask

The biggest hickup I could potentially see is that the field returns IDs, not archive urls. May get a bit hairy trying to juggle between the display types and also saving of the intended option between the two possible values.

tw2113 avatar May 26 '17 14:05 tw2113