Forum Replies Created
-
So… I’m an idiot… After messing around with it for a while longer today, I realized that I actually don’t need to add any of my own code to get child pages to show an image to the left of the title, all I had to do was set the Featured Image… I have NO idea why I thought I had to modify it in some way… I think I assumed it wouldn’t work with the pages because it didn’t work for the posts…
After looking into Child Themes a bit more, I found out that part of my issue was that I didn’t have an action hook where I needed one… I replaced my original addition with <?php do_action(“child_page”); ?> and made a test function in a Child Theme like this:
<?php
add_action(“child_page”, “test_action”);
function test_action()
{
printf(“Test”);
}
?>
and that worked, but when I replace the print with the image, it screws up because I’m not sure how to pass the post title to function.php. Any ideas?
I tried figuring out Child Themes. It made a little sense, but I still couldn’t accomplish what I was trying to do, so I went an alternate route and found where the code that presented the Child Pages was located. I edited loop-children.php from
<?php /* The title */ ?>
<h2 class=”post-title”>
<.a. href=”<?php echo get_permalink($page->ID) ?>” rel=”bookmark” title=”<?php printf(esc_attr__(‘Permalink to %s’, ‘graphene’), $page->post_title); ?>”><?php if ($page->post_title == ”) {_e(‘(No title)’,’graphene’);} else {echo $page->post_title;} ?></.a.>
</h2>
to this:
<?php /* The title */ ?>
<h2 class=”post-title”>
<?php
if (@GetImageSize(“http://www.BytePen.com/wp-content/uploads/” .$page->post_title. “-Icon.png”))
{
printf(“
post_title. “-Icon.png’ height=’100′ width=’100′ style=’float:left;’>”);
}
?>
<.a. href=”<?php echo get_permalink($page->ID) ?>” rel=”bookmark” title=”<?php printf(esc_attr__(‘Permalink to %s’, ‘graphene’), $page->post_title); ?>”><?php if ($page->post_title == ”) {_e(‘(No title)’,’graphene’);} else {echo $page->post_title;} ?></.a.>
</h2>
As you can see from my website, this worked:
http://www.BytePen.com/OurApps/
However, whenever Graphene gets updated, I’ll have to reimplement that. Do you have any ideas on how I could avoid having to reimplement that whenever I update Graphene?
I forgot to mention, I apparently don’t need to remove those links, now that I’m using pages properly. That code did exactly what I was originally asking for though. Thank you.
Thanks again for all the help, Ken. A HUGE thanks goes to your article you linked me to. Turns out I’ve been using WordPress wrong since the day I started. >_< If anything, almost all my information should have been in pages, not posts.
I have messed around with php a little bit, but it’s all been copy and paste. It all seems simple enough, but I haven’t really given it a real try. I’ll look at that link and see what I can do.
I know next to nothing about PHP, but I’ll look into it and try to figure something out. Thanks.
I’ll read that article and decide what to do from there. The only reason I wanted to make the home page a post was just because I wanted everything to be a post for consistency, but after glancing at that article, it seems that doing that would be a bad way to do it.
Thanks for the welcome!
Viewing 6 posts - 1 through 6 (of 6 total)
