Forums

Using get_post_meta for categories/front page view (2 posts)

  1. batters22
    Member
    Posted 2 weeks ago #

    I have a wordpress post which includes some links to javascript resources (actually to render a font with Cufon). I have done this by adding the links as custom field called "link" on the post and then retrieving them in header.php via:

    <?php if(get_post_meta($post->ID, 'link', false))//see if there's any link custom fields
    	{
    	foreach(get_post_meta($post->ID, 'link', false) as $link)//loop through 'em
    		{
    		echo $link;//print 'em
    		echo "\n";
    		}
    	}
     ?>

    This works flawlessly on the "single post" page but doesn't work on the categories/blog front page. Any suggestions?

  2. batters22
    Member
    Posted 2 weeks ago #

    Just to clarify this somewhat, the code above includes links to javascript in the <head> of the document in the format:

    <script src="/javascript/cufon-yui.js" type="text/javascript">

    I can make this work on the front page and categories page by including the <script> tags in the body of the post, but was trying to avoid this by including them in the header instead.

Reply

You must log in to post.

About this Topic