Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Montezuma Theme (http://forum.bytesforall.com/forumdisplay.php?f=53)
-   -   Working With Postformats (http://forum.bytesforall.com/showthread.php?t=23419)

flyboy Feb 18, 2016 03:04 PM

Working With Postformats
 
I want to create a postformat for podcast type of posts, and I am 100% clear on how to do that in Montezuma. What I don't know is how to give a user the ability to mark his/her post as a podcast postformat in the WYSIWYG interface when creating a post.

Custom postformats I created simply do not get listed anywhere in the interface, so how is Montezuma to know that a given post is of a custom postformat? (the reason this is needed is because the homepage was designed to display a single post of each custom postformat I created)


CrouchingBruin Feb 18, 2016 05:52 PM

I've looked into this before, and I don't think you can define your own post formats, you are limited to the 9 special ones, i.e., Wordpress is only going to look for the presence of one of those nine, and if it doesn't find one, it defaults to the standard postformat.php. Are you using the audio post format for anything? If not, then you can create a subtemplate called postformat-audio.php and have your users pick Audio for podcasts.

flyboy Feb 18, 2016 06:54 PM

Based on what is documented in the theme itself (image below) I'm pretty sure that can be done.

However the documentation doesn't provide any instructions for what needs to be done to have the described custom postformats appear in the interface.

The ability to create custom postformats without the handle to call them into a post would be kind of pointless, so I'm sure there is a way to do it. I'm just not having much luck in finding it


CrouchingBruin Feb 18, 2016 07:00 PM

Scroll all the way down to the bottom of that same page and read the paragraph labeled Including Post Format templates. So you can create a template called myformat-video.php, but not myformat-podcast.php, because it won't look for podcast as one of the nine special formats.

flyboy Feb 18, 2016 07:22 PM

No cigar =(

I just created this postformat:


Yet, this is still all I see in the "add a Post" interface (no new custom type of video is listed, so no way to call it in):


juggledad Feb 19, 2016 07:33 AM

Wordpress doesn't allow new formats (see http://codex.wordpress.org/Post_Formats)
Quote:

The Post Formats feature provides a standardized list of formats that are available to all themes that support the feature. Themes are not required to support every format on the list. New formats cannot be introduced by themes or even plugins. The standardization of this list provides both compatibility between numerous themes and an avenue for external blogging tools to access this feature in a consistent fashion.

flyboy Feb 19, 2016 10:10 AM

Thanks JD.

I must admit I am a little puzzled what the Custom Postformats feature is for in that case (specifically the stuff in the screenshot below)

http://i.imgur.com/RqnfVbR.jpg

CrouchingBruin Feb 19, 2016 10:25 AM

Read the section again under Including Post Format templates. The way to get your new myformat-video.php to be used is to modify the index.php file (or whatever customized index main template you may have created) so that instead of this:
Code:

<?php bfa_loop( 'postformat' ); ?>
You call this:
Code:

<?php bfa_loop( 'myformat' ); ?>
Now Wordpress will look for myformat-video.php instead of postformat-video.php if the post format of the post is Video. You will probably need to create a myformat.php as the default post format template (I don't know if it will go back to the postformat.php subtemplate if myformat.php isn't found).

flyboy Feb 19, 2016 11:03 AM

Got it, but that still leaves me with the same question - what is the purpose of custom sets of postformats (such as myotherformat, myotherformat-video, myotherformat-audio, etc) if we can simply create a set of files that are named postformat-video, postfoirmat-audio etc?

I was under the impression that naming them things other than postformat-video gives us new sets of postformats. In fact, it's in the documentation - the big question is how are those sets called into New Post interface?

And if they aren't, how/what are the new sets used for?

.

juggledad Feb 19, 2016 05:01 PM

I would say it is to give you options.

Lets say you create a category called 'podcasts' and you have added a post which contains the audio of the podcast. In addition, you want a aside for the podcast. You could use a basename of 'podcast' and create a podcast.ausio.php and a podcast-aside.php which would display the contents as you define them.

You could also have other 'aside' and 'audio' posts - which do not have the category 'podcast' - and they woulod be displayed a different way on their category page.

This is one of those - your imagination will come up with a use theat Flynn probably never thought of - things

flyboy Feb 19, 2016 05:50 PM

Quote:

Originally Posted by juggledad (Post 113396)
You could also have other 'aside' and 'audio' posts - which do not have the category 'podcast' - and they would be displayed a different way on their category page.

Thank you JD.

One last question - how would a user set one post as podcast-audio while another as thingamajig-audio? Both being ___-audio items, there wouldn't be a way to choose one over another when posting, would it?

juggledad Feb 19, 2016 06:27 PM

I'd base it on the category since the post formats will only apply on multi post pages, but you could also create separate post main templates and the user would just choose them from the 'Virtual Template' section in teh post editor.

CrouchingBruin Feb 21, 2016 06:44 PM

So here's an example of how I implemented two different post formats: Lady Eagles Basketball. I created the following postformat subtemplates from postformat.php:
  • postformat-image: displays a full-size featured post at the top, followed by the post excerpt.
  • postformat-gallery: subtemplate for my posts which display a gallery. The subtemplate displays the post excerpt and at the bottom is a full size featured image.
  • post-format-video: displays the entire post content using a call to the_content instead of the_excerpt. I wanted the embedded video to show up on the home page, which is why I decided to display the entire post content for those posts.

On the home page, the first post is an Image post type, the second post is a Gallery post type, and the 4th through 10th posts are Video post types.

However, I didn't want all of the images and embedded videos to show up when the user does a search. That is, by default, if you don't define a search.php main template, then index.php gets used, and the search results will look like the home page. Instead, I just wanted a plain list of posts.

So I first created a search.php main template, and instead of calling postformat in bfa_loop, I call searchformat instead, and created a searchformat.php by copying postformat.php and removing the thumbnail code (plus I removed the post footer). Then I created searchformat-video.php, searchformat-gallery.php, and searchformat-image.php subtemplates, removing any thumbnail calls and, in the case of searchformat-video.php and searchformat-gallery.php, adding a Font Awesome icon before the post title that indicates either a video post or a gallery post. So if you do a search on the word varsity, for example, the search results look different that what you would see on the home page: no thumbnails/images, no full post contents, and icons indicating gallery and video posts.

So the user only has to set the post format once (i.e., Video), and it can get displayed differently depending upon what type of index page it is being displayed: home page, search results, category page, etc., or some other custom index page.


All times are GMT -6. The time now is 04:01 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.