Community Forums › Forums › Archived Forums › General Discussion › Featured Image issues on 404.php
Tagged: 404.php, featured image, is_404
- This topic has 8 replies, 2 voices, and was last updated 9 years, 10 months ago by
Brad Dalton.
-
AuthorPosts
-
August 15, 2016 at 6:24 am #191288
MooseintheUK
MemberSo im currently adapting the genesis 404.php file [not the parent file of course], but ive run into an issue with the featured image. Its pulling in the blog pages feature which i dont want. Now usually i would change this by calling on the page id from the body class if the page doesnt have a wordpress page, but the 404 page doesnt get a page-id-#. I tried using the .error404 class, but to no this has not worked.
Anyone have a solution to this? Much appreciated if you do.
August 15, 2016 at 6:59 am #191289Brad Dalton
ParticipantAugust 15, 2016 at 7:26 am #191292MooseintheUK
MemberAlas, i dont want to remove it. Well, my boss doesnt want me to remove it.
August 15, 2016 at 7:38 am #191293Brad Dalton
ParticipantAugust 15, 2016 at 8:05 am #191295MooseintheUK
MemberUmmmm, the featured image... The 404.php page is using the same featured image as the blog page.
August 16, 2016 at 2:49 am #191363MooseintheUK
Memberfor example, since for some reason i cant set the featured image from the wordpress page itself, im using this loop:
<?php
if (is_home()) {
?>
[image tag]<?php
}
else {
echo the_post_thumbnail('post-image');
}
?>but its displaying the above image on the 404 page as well. Last time i checked, is_home doesnt apply to anything other than the blog page.
August 16, 2016 at 2:55 am #191365Brad Dalton
ParticipantAugust 16, 2016 at 3:19 am #191367MooseintheUK
Member1) the featured image on the 404 page is the SAME as the BLOG page.
2) according to the code this should NOT be happening. [see above comment for code]
3) Usually in similar situations i would use the page-id-# to do this, BUT the 404 page DOESN'T have a page-id-#, instead it has the class of .error404 which doesn't work. EG:
eg: // this works if page has an id-#
<?php if ( is_page( '#' ) ) { ?>// so i tried this
<?php if ( is_error404()) { ?>// & this
<?php if ( is_page( 'error404' ) ) { ?>// neither works, so you cant use that class like you can front_page or home.
4) I DO NOT want to remove the featured image from the 404 page COMPLETELY.
5) I want to change the featured image on the 404 page to its own image, preferably being able to incorporate it into my existing code for featured images to keep things tidy.I literally cant spell it out any plainer than that.
August 16, 2016 at 3:45 am #191368Brad Dalton
Participant -
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.