WordPress.org

Ready to get started?Download WordPress

Forums

Quick Help: Add Video Headline (6 posts)

  1. ambientecho
    Member
    Posted 5 years ago #

    I have a blog located here http://www.lautechgroup.com/blog
    It is currently running the arthemia theme and I have a quick question regarding the use of video in the headline. The way the blog is setup, any post that you categorize as "Headline", will populate on the front page in the "headline" section at the top. What I want to be able to do is create a separate category called "Video" and have a video populate in that same headline area if i create a video post and use that category. I am including a mockup here of what I am talking about http://www.flickr.com/photos/thirtytwopaths/3427959984/sizes/l/

    I know this is probably a simple matter of editing the php. Currently the headline functions through the following php code in index.php

    <div id="headline">
    		<img src="<?php echo get_option('home'); ?>/wp-content/themes/arthemia/images/headline.png" width="75px" height="21px" alt="" />
    		<?php query_posts("showposts=1&amp;category_name=Headline"); ?>
    		<?php while (have_posts()) : the_post(); ?>	
    
    	<div class="title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></div>
    	<div class="meta">[<?php the_time('j M Y') ?> | <?php comments_popup_link('No Comment', 'One Comment', '% Comments');?> | <?php if(function_exists('the_views')) { the_views(); } ?>]</div>
    	<?php $values = get_post_custom_values("Headline");?>
     	<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
    <img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/<?php
    $values = get_post_custom_values("Image"); echo $values[0]; ?>&amp;w=300&amp;h=275&amp;zc=1&amp;q=100"
    alt="<?php the_title(); ?>" class="left" width="300px" height="275px"  /></a>
    	<?php the_excerpt(); ?>
    	<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">Read the full story &raquo;</a>
    	<?php endwhile; ?>
    		</div>

    Any help or suggestions would be greatly appreciated.

  2. schulte
    Member
    Posted 5 years ago #

    So, are you populating the custom field named 'Image' with something like /wp-content/uploads/2009/04/newsite.jpg?

  3. ambientecho
    Member
    Posted 5 years ago #

    Schulte,

    Yes, that will create the thumbnail that you see for the post under headline (i.e. the gymnast under the title "parkettes gets a new site") What I am looking to do is eliminate all the text and just have the video show if i select a custom category such as "video" (like in the mockup here http://www.flickr.com/photos/thirtytwopaths/3427959984/sizes/l/

    I still want to retain the functionality as it is right now so that the headline can also be a post.

  4. schulte
    Member
    Posted 5 years ago #

    Something like this?

    <?php
    
            if ( is_category('Headline') ) {
                // Show the headline thumb and text.
            ?>
                	<div class="meta">[<?php the_time('j M Y') ?> | <?php comments_popup_link('No Comment', 'One Comment', '% Comments');?> | <?php if(function_exists('the_views')) { the_views(); } ?>]</div>
                	<?php $values = get_post_custom_values("Headline");?>
                 	<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
                <img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/<?php
                $values = get_post_custom_values("Image"); echo $values[0]; ?>&amp;w=300&amp;h=275&amp;zc=1&amp;q=100"
                alt="<?php the_title(); ?>" class="left" width="300px" height="275px"  /></a>
                	<?php the_excerpt(); ?>
                	<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">Read the full story &raquo;</a>
                	<?php endwhile; ?>
                		</div>
    
            <?php
    
            } elseif ( is_category('Video') {
                // Show the video.
                // Have you figured out how you're going to pull in the video?
    
            } else {
                // Nothing special here, move along.
            }	
    
            ?>
  5. ambientecho
    Member
    Posted 5 years ago #

    Schulte,

    Yes that looks pretty close, thanks! One thing that I did not explain well is that I still want the post Title to remain and all the text if the category is "Headline" (which basically means the original code would remain the same). The difference would be that if the "Video" category is chosen, the title would not appear. Not sure if there is a way to do if category='Video' do not display the title

    For the section:

    <?php
    
            } elseif ( is_category('Video') {
                // Show the video.
                // Have you figured out how you're going to pull in the video?
    
            } else {
                // Nothing special here, move along.
            }	
    
            ?>

    I am not quite sure how to create that code in order to embed the video. I am planning on pulling the video from Vimeo. Is there some sort of standard PHP embed script?

  6. schulte
    Member
    Posted 5 years ago #

    I think that's actually what I'm doing there. If it's 'Headline,' do this. If it's 'Video,' do something else. And if it's some other category, do another thing (the default). I wasn't sure what you're category structure was or post conventions.

    As far as pulling the video, it might be useful to explore these plugins and see if any will simplify matters.

    http://wordpress.org/extend/plugins/search.php?q=viddler

Topic Closed

This topic has been closed to new replies.

About this Topic