• hi, i m just trying to make a child of twentytwelve.

    in the post page i want the featured image to be outside the content box.
    So i made this in my content.php

    <?php the_post_thumbnail(); ?>
    	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    		<?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
    		<div class="featured-post">
    			<?php _e( 'Featured post', 'twentytwelve' ); ?>
    		</div>
    		<?php endif; ?>
    
    		<header class="entry-header">

    i reached my goal. the problem is that also in the index page the featured image is outside the content box while i want this to happen only on my post page.

    to resume the speech: i would like to have the featured image outside the box of content only on my post page. Which conditional form i ve to put, and where?

    thank you gentlemen ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • have you reviewed https://codex.www.ads-software.com/Conditional_Tags

    try to use is_singular() or is_single()

    Thread Starter ilmattiapascal

    (@ilmattiapascal)

    thank you , i read it and i m sure i ll get out of it..i asked here only because it’s been a week that i m trying to solve problems by myself and today i was a little tired ??

    can i ask you something more specific ? what i have to put in between the brackets if i want the propriety to be active for each last post published ?

    Thread Starter ilmattiapascal

    (@ilmattiapascal)

    i m trying to put the conditionals, but i don’t really understand how i put the sentence after the conditional (which i already knew it was is_single() ) i m in the content.php and i ve to say : if is_single put the featured image before entry content, else put it on the normal way..:(

    Thread Starter ilmattiapascal

    (@ilmattiapascal)

    ok, so i put

    <?php if (is_single() ) : ?>
    	<?php the_post_thumbnail(); ?>
    	<?php endif; ?>
    
    	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    		<?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
    		<div class="featured-post">
    			<?php _e( 'Featured post', 'twentytwelve' ); ?>
    		</div>
    		<?php endif; ?>

    and it works for the post page. but now my homepage has not the image. If i put the image in the content, then i ll have the same image twice, one upstairs where i want, and the other inside the content (and that’s weird)…someone can help me?

    <?php if ( is_single() ) the_post_thumbnail(); ?>
    	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    		<?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
    		<div class="featured-post">
    			<?php _e( 'Featured post', 'twentytwelve' ); ?>
    		</div>
    		<?php endif; ?>
    		<header class="entry-header">
    			<?php if ( ! is_single() ) the_post_thumbnail(); ?>
    			<?php if ( is_single() ) : ?>
    			<h1 class="entry-title"><?php the_title(); ?></h1>
    			<?php else : ?>
    			<h1 class="entry-title">

    this change in the original location of the thumbnail makes it show when it is ‘NOT’ a single post: <?php if ( ! is_single() ) the_post_thumbnail(); ?>

    Thread Starter ilmattiapascal

    (@ilmattiapascal)

    thanks as always. this solved my problem.

    i don’t want to open a new topic, so i try to ask you two more questions if it doesn’t bother you:

    1) how can i change the size of the featured image only for the single page? which sentence i ve to add in the conditional that you gave me?

    2) i know the if i put something into the brackets of is_single() the action will be reffered to a specific thing (single one, or even an array of elements). I would like to say, apply this only for the last post. what i ve to put?

    thank you really as always for your patience.

    1) how can i change the size of the featured image only for the single page? which sentence i ve to add in the conditional that you gave me?

    general information https://codex.www.ads-software.com/Post_Thumbnails
    https://codex.www.ads-software.com/Function_Reference/the_post_thumbnail

    for the single post, you would edit it in this line:

    <?php if ( is_single() ) the_post_thumbnail(); ?>

    I would like to say, apply this only for the last post. what i ve to put?

    there is no conditional tag for just the latest post of a site per-se; to get the first post in a loop (which is usually the latest post) on the front page, you can use:

    <?php if( $wp_query->current_post == 0 && !is_paged() ) : ?>
    latest post on front
    <?php endif; ?>
    Thread Starter ilmattiapascal

    (@ilmattiapascal)

    ok alchymyth, thank you again. you know, i feel like i made a long trip to find that what i had in mind was totally wrong.

    what i tried until now, thanks also to your help, was to get the image outside the content to resize it full size as a big main image of the post. But i realized that i got terribly wrong because anyway the featured image is linked to the content division, so if i resize the image, i will have problems with the rest of the content.

    Infact, i understood that what i need is to change the theme layout adding a new div class in content.php called, for example, “bigimage”. (am i right?) Place this div above the main content div, and also above the sidebars (with approximately the same conditional rules said before).

    the problem is that i don’t know how to create a div class of an object that it doesn’t exists yet..i suppose i ve to make :

    <?php if (is_single() ) : ?>
    	<div class="bigimage">
    	<?php the_post_thumbnail(full); ?>
    	</div>
    	<?php endif; ?>
    
    	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    		<?php if ( is_sticky() && is_home() && ! is_paged() ) : ?>
    		<div class="featured-post">
    			<?php _e( 'Featured post', 'twentytwelve' ); ?>
    		</div>
    		<?php endif; ?>
    
    		<header class="entry-header">

    how i define Bigimage?…then i will have to make a voice in the style.css to control margins, paddings and other stuff..

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Put the featured image outside the content’ is closed to new replies.