• Resolved dsgdesigns

    (@dsgdesigns)


    I am going to put up an ecommerce site with my products displayed on the homepage. Each product will have a title and it will be a link. Each product will be a unique post. Instead of the post title linking to the post page, I would like for it to link to a page of my choosing. Is this possible?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Yes, but you’ll have to hard-code each title link unless you want all post title links to go to the same page.

    Thread Starter dsgdesigns

    (@dsgdesigns)

    Can I do it with custom fields?

    Possibly, depending on what you’re trying to do. Without really knowing what you’re attempting, I think it would go something like this:

    When writing your post, create a custom field called “title_link” in the Name field and then add whatever URL you want in the Value field.

    Then in your template file you’d write something in the LOOP along the lines of:

    <?php while (have_posts()) : the_post(); ?>
    	<div class="post" id="post-<?php the_ID(); ?>"> <!-- post -->
    		<?php $titleLink = get_post_meta($post->ID, 'title_link', true); ?>
    		<h1><a href="<?php echo $titleLink; ?>"><?php the_title(); ?></a></h1>
    		<?php the_content(); ?>
    	</div> <!-- /post -->
    <?php endwhile; ?>
    Thread Starter dsgdesigns

    (@dsgdesigns)

    Can I email you some more specifics about what I am doing? I would prefer to keep it somewhat confidential.

    If you don’t want to post your email I understand. You can email me at daniel(at)dsg-designs(dot)com

    Of course. You can contact me though the contact form on my site, just follow the link next to my gravatar.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Change link on post titles’ is closed to new replies.