• Resolved floo08

    (@floo08)


    Hi there,

    I want the featured image to be above the header on mobile and under the header on desktop. How to do it with css?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Theme Author Tom

    (@edge22)

    Hi there,

    You would need to use GP Hooks or functions with add_action.

    If you want to use GP Hooks, you’ll need to ask over in our forums as these ones are only for the free theme: https://generatepress.com/support

    If you want to use functions let me know and I can write something up for you.

    Please include a link to a page with the featured image either way ??

    Thread Starter floo08

    (@floo08)

    Please write a function ??
    IT-Antwort.de

    Theme Author Tom

    (@edge22)

    So for example, on a page like this: https://it-antwort.de/2016/06/29/empfehlung-dualshock-4-ladestation/

    You want the picture of the controllers above your logo on mobile?

    Thread Starter floo08

    (@floo08)

    No, in/on the achieve (it-antwort.de) there is the featured image on the left and the title on the right. And I want, that the titlte is above and under it, there is the featured image on the left and the text on the right. (I only want: Customize -> Blog -> featured image -> under the header). And the image should ONLY BE under the header on desktop. On mobile, it should be above the header.

    Theme Author Tom

    (@edge22)

    By default, the featured image should show above the titles on mobile.

    In your case, they’re continuing to float left because you’ve added this custom CSS:

    @media (max-width: 768px) {
        .post-image-aligned-left .post-image {
            margin-right: 20px !important;
            float: left !important;
        }
    }

    If you remove that custom CSS, then your featured images will float left on desktop, and will be centered on top of the title on mobile.

    Thread Starter floo08

    (@floo08)

    Sorry, but you dont understand what i mean :

    On mobile everything is okay. No change.
    And on Desktop, I want the featured Image to be under the Header and float left. But when i change it (Customize-Blog-featured Image) it also changes on mobile and i dont want this.
    Thanks for your patience ??

    Theme Author Tom

    (@edge22)

    That’s a tough question! ??

    Try this..

    add_action('wp','generate_customize_post_images');
    function generate_customize_post_images()
    {
    	$generate_settings = wp_parse_args(
    		get_option( 'generate_blog_settings', array() ),
    		generate_blog_get_defaults()
    	);
    
    	if ( 'post-image-above-header' == $generate_settings['post_image_position'] ) :
    		add_action( 'generate_after_entry_header', 'generate_blog_post_image' );
    		add_action( 'generate_before_content', 'generate_blog_post_image' );
    
    		if ( function_exists('generate_page_header_post_image') ) :
    			add_action( 'generate_after_entry_header', 'generate_page_header_post_image' );
    			add_action( 'generate_before_content', 'generate_page_header_post_image' );
    		endif;
    	endif;
    }

    Adding PHP: https://generatepress.com/knowledgebase/adding-php-functions/

    .inside-article > .post-image:first-child {
        display: none;
    }
    .entry-header + .post-image {
        margin-top: 2em;
    }
    
    @media (max-width: 768px) {
        .inside-article > .post-image:first-child {
            display: block;
        }
        .entry-header + .post-image {
            display: none;
        }
    }

    Adding CSS: https://generatepress.com/knowledgebase/adding-css/

    Thread Starter floo08

    (@floo08)

    It works!
    Thank you very much!

    Theme Author Tom

    (@edge22)

    You’re welcome ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Select the position of the features image’ is closed to new replies.