Tagged: x
-
AuthorPosts
-
December 31, 2016 at 7:13 pm #1311271
ashikaiParticipantOkay, so I’m trying to dynamically pull the featured image of a PAGE and set it as the background to a <HEADER> or a <DIV>… Problem is doing anything like <header style=”border:1px solid red;”> doesn’t work at all. Which is bizzare because it should work and works in other themes.
I’m customizing ICON’S content-page.php file with the following:
<?php if ( has_post_thumbnail() ) : ?> <header class="entry-header" style="background-image:url('<?php echo get_the_post_thumbnail_url(); ?>'); > <?php endif; ?>What am I missing about X that’s making this so difficult?
Thank you!
January 1, 2017 at 2:43 am #1311455
ChristianModeratorHey there,
Please give us the code of your customized content-page.php so we could try it on our test site.
Thanks.
January 1, 2017 at 12:49 pm #1311766
ashikaiParticipantThe only lines I added were the ones I listed in my last post, but here it is again in context:
<?php // ============================================================================= // VIEWS/ICON/CONTENT-PAGE.PHP // ----------------------------------------------------------------------------- // Standard page output for Icon. // ============================================================================= $disable_page_title = get_post_meta( get_the_ID(), '_x_entry_disable_page_title', true ); ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <div class="entry-wrap"> <div class="x-container max width"> <?php if ( is_singular() ) : ?> <?php if ( $disable_page_title != 'on' ) : ?> <header class="entry-header"> <h1 class="entry-title"><?php the_title(); ?></h1> </header> <?php endif; ?> <?php else : ?> <?php if ( has_post_thumbnail() ) : ?> <header class="entry-header" style="background-image:url('<?php echo get_the_post_thumbnail_url(); ?>'); > <?php endif; ?> <h2 class="entry-title"> <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ); ?>"><?php x_the_alternate_title(); ?></a> </h2> </header> <?php endif; ?> <?php x_get_view( 'global', '_content' ); ?> </div> </div> </article>January 1, 2017 at 8:32 pm #1312063
Rue NelModeratorHello There,
Thanks for updating in! The code is invalid. Please your code updated and make use of this code instead:
<?php // ============================================================================= // VIEWS/ICON/CONTENT-PAGE.PHP // ----------------------------------------------------------------------------- // Standard page output for Icon. // ============================================================================= $disable_page_title = get_post_meta( get_the_ID(), '_x_entry_disable_page_title', true ); ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <div class="entry-wrap"> <div class="x-container max width naa ra"> <?php if ( is_singular() ) : ?> <?php if ( $disable_page_title != 'on' ) : ?> <header class="entry-header"> <h1 class="entry-title"><?php the_title(); ?></h1> </header> <?php endif; ?> <?php if ( has_post_thumbnail() ) : ?> <header class="entry-header" style="min-height: 320px; background-image:url('<?php echo get_the_post_thumbnail_url(null, 'full'); ?>'); background-size: cover;"> <h2 class="entry-title"> <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ); ?>"><?php x_the_alternate_title(); ?></a> </h2> </header> <?php endif; ?> <?php else : ?> <?php if ( has_post_thumbnail() ) : ?> <header class="entry-header" style="background-image:url('<?php echo get_the_post_thumbnail_url(); ?>')"> <?php else : ?> <header class="entry-header"> <?php endif; ?> <h2 class="entry-title"> <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ); ?>"><?php x_the_alternate_title(); ?></a> </h2> </header> <?php endif; ?> <?php x_get_view( 'global', '_content' ); ?> </div> </div> </article>We would loved to know if this has work for you. Thank you.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1311271 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
