WordPress.org

Ready to get started?Download WordPress

Forums

Spun
Make a circle with an image not link to anything (6 posts)

  1. GeraldW
    Member
    Posted 1 year ago #

    I have two types of circles on my site, ones with images and ones with just text.

    I only want the circles with text in them to link to anything. Currently I'm using a plugin to redirect those circles to a subdomain on my site, this works perfectly.

    BUT as the circles with images in them are only there as "decoration" and don't link to any content or a new domain I don't want them to behave like they link somewhere (when you hover they take the cursor away and give you a hand) so it looks like they link to new content. Currently I have those circles re-direct back to the main page (where they are located) so it is a clumsy work around. It refreshes the page and nothing new appears.

    is there a way of removing the .blog .hentry a. attachment-post-thumbnail area of the styles sheet so that those circles don't link to anything?

    Thanks!

  2. Caroline Moore
    Member
    Theme Author

    Posted 1 year ago #

    This is possible with some coding. You could check to see if a featured image is present in the post with an IF statement and if so, do not output a link, and if no featured image is present, just output the post title and link.

    This is an advanced customization so I can't write the code for you, but you can see how similar IF statements are written within content-home.php and adjust them within a child theme to work for your purposes. Good luck!

  3. GeraldW
    Member
    Posted 1 year ago #

    Hi Caroline,

    I was given this piece of code:

    <?php if ( has_post_thumbnail()) { ?>
    <?php } else { ?>
    	<?php the_title(); ?>
    <?php } ?>

    but I'm not sure where to put it. I stuck it into a content-home.php file in my child theme but that broke everything on the site!

    Is there a particular spot in the original content-home.php that I should be looking at?

  4. Caroline Moore
    Member
    Theme Author

    Posted 1 year ago #

    As long as you put it outside any opening/closing PHP braces or existing IF statements in content-home.php, it should not break anything. But it's not a complete piece of code from what I can tell -- it will output the post title if the post does not have a Featured Image assigned.

  5. GeraldW
    Member
    Posted 1 year ago #

    Where as I want the opposite... sort of.

    As outputing a post title link is on by default, this is only confirming it?

    Where as I want it to remove what is on by default, but only if the post has a featured image...

    So the code in its current form won't work =\

  6. soulint
    Member
    Posted 1 year ago #

    Could anyone elaborate on this issue, please? I have exactly the same problem.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

Tags

No tags yet.