• Resolved 3Plumes

    (@3plumes)


    I’m building a custom theme, and have a custom field for storing text on pages. To display the text in the page templates, I use <?php the_meta(); ?>

    However, when I’m displaying the blog, single.php, 404.php and so forth, nothing is displayed since these aren’t used for pages.

    Is there a way that I can display the custom field values (from pages) randomly? Get_post_meta maybe?

Viewing 3 replies - 1 through 3 (of 3 total)
  • You can probably find the answer here.

    http://codex.wordpress.org/Custom_Fields

    Looks like this might do it

    http://wordpress.org/extend/plugins/get-custom-field-values/

    Find a custom field for the current post, a specified post, a recent post, or randomly.

    Thread Starter 3Plumes

    (@3plumes)

    Thanks for the ideas Jonas. I unfortunately ran out of time and had to do something that was far from ideal:

    <?php
    	if(is_home()) {
    		echo 'custom testimonial goes here';
    	} elseif(is_single()) {
    		echo 'custom testimonial goes here';
    	} elseif(is_category()) {
    		echo 'custom testimonial goes here';
    	} elseif(is_archive()){
    		echo 'custom testimonial goes here';
    	} elseif(is_search()) {
    		echo 'custom testimonial goes here';
    	} elseif(is_404()) {
    		echo 'custom testimonial goes here';
    	} else {
    		the_meta();
    	}
    	?>

    I’ll revisit your suggestions later and see if I can get them to work.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘the_meta()’ is closed to new replies.