Video post format, extra content breaks video embed

If you don’t know what the content is, use a regular expression to test if there is an URL. Sample code: $content = get_the_content(); $pattern = ‘~([^”\’])?(https?://.*\.(flv|aac|mp4|mov|m4a|f4a|ogg|oga|mp3))([^”\’\?])?~i’; if ( preg_match( $pattern, $content, $matches ) ) { $parsedUrl = parse_url( $matches[ 0 ] ); // create the vidoe markup } else { // echo $content or … Read more

How to Render Post Types in RSS Feed?

Write a small custom plugin wich a function, that enhance the default query for feeds. The example below add all custom post types via get_post_types()to the default feed. // add custom post type to wp post-feed add_action( ‘request’, ‘fb_add_to_feed’ ); // add to post-feed function fb_add_to_feed ( $request ) { if ( isset( $request[‘feed’] ) … Read more

Add specific custom fields to post formats

your options are this: http://wordpress.org/plugins/advanced-custom-fields/ and this http://wordpress.org/plugins/types/ Both will allow you to add different custom fields depending on which custom post type you like the field to appear.. (Though I prefer the first one because it is more flexible for me)

Conditional for Post Format

There is no “default” post format type, though internally in core, a post that has no post format assigned is usually referred to as standard. So, your first conditional will return false using post-format-normal because there is no such post format – but would still return false using post-format-standard. You could reverse the conditional, and … Read more

Wrap posts p tags in div

You need to add it to a JS file and then enqueue it in your functions.php jQuery(document).ready(function($){ $(‘p’).wrap(‘<div class=”post-txt” />’); }); If you already have a js file, you can add it to that file and you’re done. Else, save the above snippet in a new file. Put that file in a folder called js … Read more

How to create Page templates for showing Blog posts in different layouts?

I wouldn’t use custom page templates merely for changing the layout of the blog posts index. Using page templates for the blog posts index bypasses the core handling for display of the blog posts index (which per the template hierarchy uses either home.php or index.php to render). Edit I never…said that I want to change … Read more

Use different post formats on different post types

This should get you going in the right direction. Not my solution, slightly modified from here. You’ll need to swap out your-post-type for the post type you’re using. function adjust_post_formats() { if (isset($_GET[‘post’])) { $post = get_post($_GET[‘post’]); if ($post) $post_type = $post->post_type; } elseif ( !isset($_GET[‘post_type’]) ) $post_type=”post”; elseif ( in_array( $_GET[‘post_type’], get_post_types( array(‘show_ui’ => … Read more

Post archive for certain post format

Post formats are actually terms of the taxonomy post_format. I have done a post about this what taxonomies are and their hierarchies which you can check out here To get a list of all terms under the taxonomy post_format, simply use get_terms and var_dump() the result $terms = get_terms(‘post_format’,’hide_empty=0′); ?><pre><?php var_dump($terms); ?></pre><?php This will print … Read more

Make tag archive display post are ordered by post format

You’re right. It isn’t a good structure. You are running three queries on the page– the two you are creating plus the main query that is being completely ignored (plus ancillary queries). You are also clobbering the main query halfway through the page load when you overwrite $wp_query, which can cause unexpected and unpredictable results … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)