Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* Get custom circles */
- $args = array(
- 'post_type' => 'custom_circles'
- );
- $custom_circles = new WP_Query( $args );
- if( $custom_circles->have_posts() ) {
- while( $custom_circles->have_posts() ) {
- $custom_circles->the_post();
- // Get the link
- $link = get_custom_field( 'link' );
- //Add in "http://" if it isn't there already
- if ( strpos( $link, 'http://' ) === false ) {
- $link = 'http://' . $link;
- }
- // I don't know how to return something useful from
- // get_custom_field that'll let me know if no image
- // has been specified, so I'm doing this elongation:
- // Convert the image to an integer
- $image_id = (int) get_custom_field( 'image:wrapper');
- //If it's more than zero then it has matched
- if ( $image_id !== 0 ) {
- $thumb_id = get_custom_field( 'image' );
- $thumb = wp_get_attachment_image($thumb_id, 'home-post wp-post-image');
- }
- else {
- $thumb = '<span class="thumbnail-title no-thumbnail">' . esc_attr( the_title_attribute( 'echo=0' ) ) . '</span>';
- $postclass = 'no-thumbnail';
- }
- // Get the order field
- $order = get_custom_field( 'order' );
- // If the order has been set
- if ( !empty( $order ) ) {
- $order = "data-order='$order'";
- } else {
- $order = "";
- }
- ?>
- <article id="post-<?php the_ID(); ?>" <?php post_class( $postclass ); echo $order; ?>>
- <a href="<?php echo $link; ?>" title="<?php the_title() ?>" rel="bookmark">
- <?php echo $thumb; ?>
- </a>
- </article><!-- #post-<?php the_ID(); ?> -->
- <?php
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement