Search code examples
phpwordpressarchivecustom-wordpress-pagespost-format

WordPress get post format archive link


I want to get the archive of a category based on a post format (example: video post format) I tried to get a sample URL using this function: get_post_type_archive_link

But I couldn't get the link and I got false for returning that How can I get some example links for archive of specified post format in a category?

Can you please let me know how is a sample link of a custom post format for a category ?

I put this line in index.php of theme:

var_dump( get_post_type_archive_link('video') );

Created a video post type, but nothing display for that value! just false

Thank you very much


Solution

  • I was finding a way to list all POST FORMATS in a category, Post type is something else

    Core WordPress post types are:

    1. Post (Post Type: 'post')
    2. Page (Post Type: 'page')
    3. Attachment (Post Type: 'attachment')
    4. Revision (Post Type: 'revision')
    5. Navigation menu (Post Type: 'nav_menu_item')

    WordPress Post Formats:

    1. aside - Typically styled without a title. Similar to a Facebook note update.
    2. gallery - A gallery of images. Post will likely contain a gallery shortcode and will have image attachments.
    3. link - A link to another site. Themes may wish to use the first tag in the post content as the external link for that post. An alternative approach could be if the post consists only of a URL, then that will be the URL and the title (post_title) will be the name attached to the anchor for it.
    4. image - A single image. The first tag in the post could be considered the image. Alternatively, if the post consists only of a URL, that will be the image URL and the title of the post (post_title) will be the title attribute for the image.
    5. quote - A quotation. Probably will contain a blockquote holding the quote content. Alternatively, the quote may be just the content, with the source/author being the title.
    6. status - A short status update, similar to a Twitter status update.
    7. video - A single video or video playlist. The first tag or object/embed in the post content could be considered the video. Alternatively, if the post consists only of a URL, that will be the video URL. May also contain the video as an attachment to the post, if video support is enabled on the blog (like via a plugin).
    8. audio - An audio file or playlist. Could be used for Podcasting.
    9. chat - A chat transcript, like so:

    To list the archive of a post format we can use something like this: http://sitename.com/type/image