• Resolved tom373

    (@tom373)


    Hello,

    in the single.php I added the custom field contents into my posts like this

    <div class="entry-content">
      <?php the_content(); ?>
      <ul>
        <?php if ( get('CUSTOM_FIELD_NAME1',TRUE) ) {
         echo "<li>Custom Field Name1: ", get('CUSTOM_FIELD_NAME1'), "</li>";
         }
        ?>
        <?php if ( get('CUSTOM_FIELD_NAME2',TRUE) ) {
         echo "<li>Custom Field Name2: ", get('CUSTOM_FIELD_NAME2'), "</li>";
         }
        ?>
      </ul>
    </div><!-- .entry-content -->

    This all works fine for the single post view. However, on my front page (showing full posts, not excerpts) the content of the custom fields is not displayed.

    What is my mistake?

    I am using WP3 with the Twenty Ten theme.

    Thanks for any help!

    https://www.ads-software.com/extend/plugins/magic-fields/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter tom373

    (@tom373)

    Plugin Author hunk

    (@hunk)

    which is the line number where you are putting get? in loop.php

    Thread Starter tom373

    (@tom373)

    hunk, thx! I had it in the single.php only – now I put the get in the loop as well (the_content) and everything is fine ??

    I’m having a problem with Magic Fields: it only shows some fields values (I tested with numbers) in single.php and in loop.php it does not show any field value.

    I’m using twentyten theme also.

    Here is a piece of loop.php with my code. I have another echo there to debug. I can send the whole theme if necessary.

    <?php /* How to display all other posts. */ ?>
    
        <?php else : ?>
            <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    
                <div class="entry-meta">
                    <?php twentyten_posted_on(); ?>
                </div><!-- .entry-meta -->
    
        <?php if ( is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
                <div class="entry-summary">
                    <?php echo 'xj'.get('Text');//get('Text',1,1,1,get_the_ID())
                    echo get('Pret');//F:
                    ?>
                </div><!-- .entry-summary -->
        <?php else : ?>
                <div class="entry-content">
                    <?php echo 'xi'.get('Text');
                    echo get('Pret');//F:
                    //F: the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
                    <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
                </div><!-- .entry-content -->
        <?php endif; ?>

    I’ve checked if WP sees the fields with the_meta() function. I got the complete list of custom fields and their values, but I cannot list the texts (in this application Pret is supposed to be a number and it works even if they inserted a string in the field).

    It also works with images (I have an image and it lists the link to that image).

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Magic Fields] Display Custom Fields Content’ is closed to new replies.