Featured Images in pages

Posted in: Newspaper
Post count: 19

Hello, i am very fresh to this theme but managed nearly all I needed so far. BUT I would like to show the featured image on my pages as I do on posts, I use post template 9 for it. Now when copying these lines

<?php
// override the default featured image by the templates (single.php and home.php/index.php - blog loop)
if (!empty(td_global::$load_featured_img_from_template)) {
echo $td_mod_single->get_image(td_global::$load_featured_img_from_template);
} else {
echo $td_mod_single->get_image('td_1068x0');
}
?>

into my child’s page.php, it gives me an error, and as i saw in the breadcrumbs, they are called different for pages then for posts, so I guess also here I need a differnent code.

How can I solve this?

Thanks for this amazing theme
Sofian

Post count: 7909

Hi,

Unfortunately you will need custom work to create a custom page template and display the featured image like you want, not so simple. Theme page template were designed to work with Visual Composer and to display Visual Composer elements.
I suggest to get someone to help you as we cannot provide any type of custom work for the moment, sorry!

Thanks!

Post count: 19

The VC has nothing to do here, because it doesnt need to show up of course on pages that are build with VC.
I need somthing for the ELSE section, so no VC used. I succeeded now with regular WP onboard tools, adding in the else section my featured image. Might not be up to the programming level your framework is set in, but it works 🙂 Actually the longer I look into your theme, the more it feels that from good old WP not much is left … it looks like its complete own system. Hope I’ll find my way into it. Is there also a documentation for theme-tweakers like me, one that is not about the panel, but about how to adapt the theme beyond? What all these functions are for? About the API?

}
...
else {

//no page builder detected, we load a default page template with sidebar / no sidebar
?>

<div class="td-main-content-wrap">
<div class="td-container <?php echo $td_sidebar_position; ?>">

<?php
if ( ( is_singular() || is_home() ) && current_theme_supports( 'post-thumbnails' ) ) :
echo get_the_post_thumbnail( $post->ID, 'td_1068x0' ); ?>
" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" class="header-img" alt="" />
<?php endif;?>
...

Post count: 780

Hi,

the code looks like it should work but I think it requieres the constants HEADER_IMAGE_WIDTH and HEADER_IMAGE_HEIGHT to be defined.

Yes… a lot of the functionality is custom made, the system is designed to be easy to maintain because we will now maintain api compatibility for at leas a year… all that while adding new features and optimizing all the slow performing/ugly parts. We are also working hard to finish the theme api documentation, it should be complete in 1-2 weeks. https://forum.tagdiv.com/the-theme-api/

Post count: 19

Sounds great. The code I posted is actually working on a live site, so it does the job, even if for sure it would not look like this if you would have done it (but more like something cleaner with td_something::something 🙂

I don’t know much about all these functions, I am tweaking only in HTML and CSS and know a bit about PHP and that’s it. But if in time I find my way to reach my desired output as well in your “system”, I will stay one more happy client for you. For me it is important that I can change all the things that I like to be different, and while some can be solved with CSS, for others I will need to ask you, especially in the beginning.

Thanks for your answers, abia astept for the documentation…

Viewing 5 posts - 1 through 5 (of 5 total)
The forum ‘Newspaper’ is closed to new topics and replies.