WordPress.org

Support

Support » Themes and Templates » [Resolved] Adding hyperlinks in home page widgets

[Resolved] Adding hyperlinks in home page widgets

  • Hi

    I am trying to make the links in the widgets at the bottom of the homepage (contact, studio, blog) on marrubio.com into clickable hyperlinks.

    When I insert the URL into the widget it just comes out as if it were normal text.

    Does anyone have any idea how I can change this?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Did you try to write it enclosed with <a></a> tag?

    In your case, that would be:

    For email:
    <a href="mailto:mailmarrubio@gmail.com" title="Email">mailmarrubio@gmail.com</a>

    For studio:
    <a href="http://www.caminoartanddesign.com" title="Studio">www.caminoartanddesign.com</a>

    For shop:
    <a href="http://www.caminoshop.bigcartel.com" title="Shop">www.caminoshop.bigcartel.com</a>

    Hi Xaliber

    Thanks for the reply.

    Iยดm not 100% sure where to put that tag. In functions.php this is the code for the blog widget.

    // **** PRODUCTION - BLOG LIST START ****
    
    class prod_blog extends WP_Widget {
    
    	function prod_blog() {
    		parent::WP_Widget(false, 'Architekt - Blog');
    	}
    
    	function widget($args, $instance) {
                    $args['blog_title'] = $instance['blog_title'];
    		prod_func_blog($args);
    	}
    
    	function update($new_instance, $old_instance) {
    		return $new_instance;
    	}
    
    	function form($instance) {
                    $blog_title = esc_attr($instance['blog_title']);
    ?>
                    <p><label for="<?php echo $this->get_field_id('blog_title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('blog_title'); ?>" name="<?php echo $this->get_field_name('blog_title'); ?>" type="text" value="<?php echo $blog_title; ?>" /></label></p>
    <?php
    	}
     }
    function prod_func_blog($args = array(), $displayComments = TRUE, $interval = '') {
    
    	global $wpdb;
    
            //echo $args['before_widget'] . $args['before_title'] . $args['title'] . $args['after_title'];
            echo $args['before_widget'] . $args['before_title'] . $args['blog_title'] . $args['after_title'];
            $port_args = array(
                         'category_name' => 'blog',
                         'post_type' => 'post',
                         'posts_per_page' => 5
                         //'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1),
                         );
            query_posts($port_args);
            echo '
    <ul>';
            while (have_posts()) : the_post(); ?>        
    
    <li><a>"><?php the_title(); ?></a></li>
            <?php endwhile; ?>
            <?php
            echo '</ul>
    ';
            echo $args['after_widget'];
            wp_reset_query();
    
    }
    register_widget('prod_blog');  
    
    // **** PRODUCTION - BLOG LIST END ****

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. Or better still – use the pastebin. As it stands, your code may now have been permanently damaged/corrupted by the forum’s parser.]

    You said that,

    When I insert the URL into the widget it just comes out as if it were normal text.

    Where do you insert those URL?

    If my presumption is correct, the place where you insert those URL is the same place where you should put the <a></a> I have given above. ๐Ÿ™‚

    Ah yes!

    You are a legend Xaliber. Thanks a lot for your speedy help ๐Ÿ™‚

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Adding hyperlinks in home page widgets’ is closed to new replies.
Skip to toolbar