• Resolved archane

    (@archane)


    Hi all, im trying really hard to add a custom field so that I can have the image assocaited with an article display before the title, text and everything else.

    To see waht i mean look at: http://www.archane.com/

    I have the <?php the_meta(); ?> in the right place and it is displaying the picture as intended, however I need to remove the whole thing from the unordered list in which it is nestled so that I can remove the indent and stop the “key” field from being displayed. This would leave the picture displaying on its own and it would be perfectly left aligned as intended.

    Is it possible to remove the “.post-meta” information from the <UL></UL> or is there a better method for trying to do what i am doing?

    I appreciate any support that people can give me and if anyone gets technical on me then please go slow and explain in lots of detail cus im a bit of a newb to php 😀

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter archane

    (@archane)

    Ok after learning a little more it seems that what i need to find the location of is the function that determines the output of <?php the_meta (); ?>

    If anyone can help with locating where the information for this function kept that that should solve my problem

    Thanks

    Nick

    Thread Starter archane

    (@archane)

    Oh well, no need, it just takes some good CSS to remove the offending “key” and remove the indent, just took me a while to get it right.

    To check out the result go to the link posted in post #1.

    agh! I was having the same problem. I’ve even followed directions in several other threads (which are now closed to discussion, including:
    http://wordpress.org/support/topic/26064?replies=4 )
    as well as the codex page on custom fields:
    http://codex.wordpress.org/Using_Custom_Fields

    and yet, I’m still stuck with an indented bullet next to my custom field key. What gives?

    I’ve checked and double-checked to make sure that I’m actually modifying the stylesheet for the right page. I can make the text big, green, bold, italic… but I cannot get the <UL> unordered list tag off of the post-meta code.
    (I was running other tests to make sure that the css style I was writing was actually modifying that piece of code and it was)

    here are variants of the css styles that i’ve used:
    `.post-meta, .post-meta-key {
    list-style: url(none) none outside;
    font-style: normal;
    line-height: normal;
    }

    ul.post-meta {
    /* classes used by the_meta() */
    list-style:none;
    }

    .post-meta {
    list-style-type: none;
    }

    In standard form, I spend 2 hours researching and 15 minutes writing a post for help and then I find a solution.

    So… even though I was including all this CSS to unlist the post-meta, those tags were being plugged into the source to still cause them to be listed.

    (I still can’t figure out how anyone else solved the problem purely with CSS since the problem appears to be the code that writes the the_meta tag.)

    I did a search in my wordpress folder of the_meta()
    and found this page:
    wp-includes/post-template.php

    and there was the little bugger:

    function the_meta() {
    	global $id;
    
    	if ( $keys = get_post_custom_keys() ) {
    		echo "<ul class='post-meta'>n";
    		foreach ( $keys as $key ) {
    			$keyt = trim($key);
    			if ( '_' == $keyt{0} )
    				continue;
    			$values = array_map('trim', get_post_custom_values($key));
    			$value = implode($values,', ');
    			echo "<li><span class='post-meta-key'>$key:</span> $value</li>n";
    		}
    		echo "</ul>n";
    	}
    }
    

    I yanked the
    <ul> tag and changed it to a <span> tag
    and then I just knocked out the
    <li></li>
    tags and blammo, problem solved.. I didn’t need all that CSS junk. And if I wanted to go back and make it an unordered list, I could simply do it in the stylesheet and not have to fuss with this page again.

    So there! hah! I figured it out! hah!

    okay… gonna go take a deep breath now.
    that was at least two hours of my time.

    agh.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom Fields – Can they be ‘unlisted’?’ is closed to new replies.