roptech
Forum Replies Created
-
Forum: Hacks
In reply to: Adding post Custom Field to content.phpI actually managed to figure it out myself from trial/error/looking at other working code.
For anyone interested:
<?php $key = 'SCurl'; $themeta = get_post_meta($post->ID, $key, TRUE); ?> <?php if($themeta != '') : ?> <div class="entry-single-info"> <span><strong>Soundcloud:</strong> <a href="http://soundcloud.com<?php $scurl = get_post_meta( get_the_ID(), 'SCurl', true); if( ! empty( $scurl ) ) { echo '' . $scurl . ''; } ?>" target="_blank"><?php $scurl = get_post_meta( get_the_ID(), 'SCurl', true); if( ! empty( $scurl ) ) { echo '' . $scurl . ''; } ?></a></span> </div> <?php else : ?> <?php endif; ?>This shows, e.g. “Soundcloud: /soundcloudlink (<< that being a link to the soundcloud) if the custom field named SCurl exists and has data. There is probably a cleaner way to do this, but it works for me π
Forum: Hacks
In reply to: Adding post Custom Field to content.phpAny clue, anyone?
Forum: Hacks
In reply to: Adding post Custom Field to content.phpIs it possible to put in place an if statement that says if there is a custom field with the name of RoR, then show X?
Like:
IF {custom field name} exists
{content here}
ENDIF
Forum: Hacks
In reply to: Adding post Custom Field to content.phpAbsolutely brilliant, thanks!
Forum: Plugins
In reply to: Category archive posts as excerpts – baffledI think I may have cracked it in my own way… is there a better way than doing this? Changed a section in content.php to:
<?php if ( is_single() ) : // Only display Full post for single ?> <div class="entry-content"> <?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentythirteen' ) ); ?> <?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?> </div><!-- .entry-content --> <?php else : ?> <div class="entry-summary"> <?php the_excerpt(); ?> </div><!-- .entry-summary --> <?php endif; ?>So only the full post on it’s own page shows anything but the excerpt.
Am I missing a very easy way of adding “…” and “read more” for the excerpt?