• Hello i’ve got php code

    <?php
    
    global $post;
    $postclass = '';
    
    if ( '' != get_the_post_thumbnail() ) {
    	$thumb = get_the_post_thumbnail( $post->ID, 'post-thumbnail', array( 'title' => esc_attr( get_the_title() ) ) ) . '<span class="no-thumbnail">' . get_the_title() . '</span>';
    }
    
    else {
    	$args = array(
    				'post_type' => 'attachment',
    				'numberposts' => 1,
    				'post_status' => null,
    				'post_mime_type' => 'image',
    				'post_parent' => $post->ID,
    			);
    
    	$first_attachment = get_children( $args );
    
    	if ( $first_attachment ) {
    		foreach ( $first_attachment as $attachment ) {
    			$thumb = wp_get_attachment_image( $attachment->ID, 'post-thumbnail', false, array( 'title' => esc_attr( get_the_title() ) ) );
    		}
    	}
    	else {
    
    		$postclass = 'no-thumbnail';
    	}
    }
    ?>
    
    <article id="post-<?php the_ID(); ?>" <?php post_class( $postclass ); ?>>
    	<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php echo $thumb; ?><?php the_title(); ?></a>
    </article><!-- #post-<?php the_ID(); ?> -->

    But i want to change only the color, alignament, … of the title but i don’t know how.
    In the css (style.css) i try to capture the title to change some parameters i use this in CSS:

    .blog .hentry a, .archive .hentry a, .search .hentry a .attachment-post-thumbnail a{
     position: absolute;
     font-family: Amatic SC;
     font-size: 24px;
     font-style: bold;
     color:#FFFFFF;
     z-index:1;
     top:-50px;
      }

    But this code not change only the tittle it change de image and the title, what i’m doing wrong?

    Thanks

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Little problem with variable in PHP’ is closed to new replies.