• Resolved daus-prompt

    (@daus-prompt)


    So basically I want to show the page content if it exists, and if not use a preformed “demo” page that I have set in the template page its using.

    So something like this below, only so that it shows the page content not custom field content:


    <?php $image=get_post_meta($post->ID, 'webimg', true); ?>
    <?php if ( $image ) : ?>
    <img src="<?php echo $image; ?>" alt="">
    <?php else : ?>
    <p> No Image Exists. </p>
    <?php endif; ?>

    Thanks in advance!

Viewing 1 replies (of 1 total)
  • Thread Starter daus-prompt

    (@daus-prompt)

    In case anyone is wondering how to do this, check the code below:


    <?php
    $cc = get_the_content();
    if($cc != '') { ?>
    <?php the_content(); ?>
    <?php } else { ?>
    // Do something //
    <?php } ?>

Viewing 1 replies (of 1 total)
  • The topic ‘If Page Content Exists’ is closed to new replies.