WordPress.org

Ready to get started?Download WordPress

Forums

Simon WP Framework
Change Link Color (1 post)

  1. aled2305
    Member
    Posted 10 months ago #

    Hello, I'm building a WP theme and am making a home page. If you visit http://beta.techyoucation.com/ you will see box in the top left with a purple top. The content in that is the latest post, which I got using

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
          <?php
        // Fetch most recent posts, limit to 1
    		$latest_posts = get_posts( array(
    			'posts_per_page' => 1,
    		) );
        // get first and only item in array
    		$latest_post  = $latest_posts[0];
    	?>
    
    	<h3><a href="<?php echo get_permalink( $latest_post->ID ); ?>"><?php echo $latest_post->post_title; ?></a></h3>
    	<?php if ( has_excerpt( $latest_post ) ) : ?>
    	<p><?php echo $latest_post->post_excerpt; ?></p>
    	<?php else : ?>
    	<?php echo strip_shortcodes(wp_trim_words( $latest_post->post_content, 50 )); // '250' is number of words ?>
    
    	<?php endif; ?>

    Now the title "Coming Soon" is green like every other link on the site, but I would like this one to be purple like the box?

    How would I do this

    Thanks in advance

    Aled

Reply

You must log in to post.

About this Theme

About this Topic