Need Help Regards Realistic Theme
Topics related to Realistic theme goes here.

Mr John

Member Rank
Posts: 3
Joined: Sun Jan 29, 2017 10:05 am
Display Name: Mr John

Need Help Regards Realistic Theme

linkPost by MrJohn » Sun Jan 29, 2017 10:13 am

Hello,

I am using Realistic theme on my site https://FullStuff.co
I want to edit few things Please help

1) On mobile devices in header, I want to show Text logo not img logo [Note: Only in mobile]
2) I want to show full-size thumbnails but in 300x300 dimension


thanks in advance
User avatar
Asmi Khalil

Site Admin Rank
Posts: 781
Joined: Fri Jun 26, 2015 7:13 am
Display Name: Asmi Khalil
Location: Tunisia

Re: Need Help Regards Realistic Theme

linkPost by admin » Sun Jan 29, 2017 10:54 pm

HI Mr John,
Thanks for using our theme Realistic :D
1) On mobile devices in header, I want to show Text logo not img logo [Note: Only in mobile]
To do this, we need to edit the header.php file ( located in theme folder ). Simply open it with a code editor of your choice and replace this line of code ( line 26 ):
<?php realistic_logo(); ?>
With this code:
<?php if ( !wp_is_mobile() ) {
    realistic_logo();
} else {
    printf( '<a href="%s rel="home">%s</a>', esc_url( home_url( '/' ) ), bloginfo( 'name' ) );
} ?>
Note that the "wp_is_mobile" function works by testing the User Agent. So even if you reduce your browser resolution on your desktop, you will still get image logo. You need to test this on a real mobile phone or tablet or use a browser plugin to change the User Agent.
2) I want to show full-size thumbnails but in 300x300 dimension
First, you need to change thumb size inside functions.php file. Open it and change this code from ( line 148 ):
if ( function_exists( 'add_theme_support' ) ) { 
    add_theme_support( 'post-thumbnails' );
    add_image_size( 'featured', 218, 181, true ); 	//featured image
    add_image_size( 'small', 120, 120, true ); 		//small thumb
    add_image_size( 'tiny', 70, 70, true ); 		//tiny thumb
}
To:
if ( function_exists( 'add_theme_support' ) ) { 
    add_theme_support( 'post-thumbnails' );
    add_image_size( 'featured', 300, 300, true ); 	//featured image
    add_image_size( 'small', 120, 120, true ); 		//small thumb
    add_image_size( 'tiny', 70, 70, true ); 		//tiny thumb
}
Note that here we changed the "featured" thumbnail size from 218X181 to 300X300.
Now you need to Regenerate Thumbnails. Don't freak out, there is a plugin that make the whole process a piece of cake :D https://wordpress.org/plugins/regenerate-thumbnails
Here is a guide from our Support page: https://themient.com/support/migrating-wp-theme
Final step is to open /template-parts/content.php file and edit as follow:
Change line 15 from:
<img width="218" height="181" src="<?php echo realistic_get_thumbnail( 'featured' ); ?>" class="attachment-featured wp-post-image" alt="<?php the_title_attribute(); ?>">
To:
<img width="300" height="300" src="<?php echo realistic_get_thumbnail( 'featured' ); ?>" class="attachment-featured wp-post-image" alt="<?php the_title_attribute(); ?>">
And change line 13 from:
<div class="post-img mdl-cell mdl-cell--4-col-desktop mdl-cell--4-col-tablet mdl-cell--4-col-phone">
To:
<div class="post-img mdl-cell mdl-cell--5-col-desktop mdl-cell--8-col-tablet mdl-cell--4-col-phone">
And change line 20 from:
<div class="post-data mdl-cell mdl-cell--8-col-desktop mdl-cell--4-col-tablet mdl-cell--4-col-phone">
To:
<div class="post-data mdl-cell mdl-cell--7-col-desktop mdl-cell--8-col-tablet mdl-cell--4-col-phone">
Here is the full edited content.php code in case you messed up your file:
<?php
/**
 * Template part for displaying posts.
 *
 * @package Realistic
 */

?>
<article id="post-<?php the_ID(); ?>" <?php post_class('post-box mdl-card mdl-shadow--2dp mdl-grid mdl-cell mdl-cell--12-col'); ?>>
    <?php if ( is_sticky() ) {
        echo '<div class="featured"><i class="icon icon-star"></i></div>';
    } ?>	
    <div class="post-img mdl-cell mdl-cell--5-col-desktop mdl-cell--8-col-tablet mdl-cell--4-col-phone">
        <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">		
            <img width="300" height="300" src="<?php echo realistic_get_thumbnail( 'featured' ); ?>" class="attachment-featured wp-post-image" alt="<?php the_title_attribute(); ?>">
            <?php $format = get_post_format( $post->ID );
            realistic_post_format_icon( $format ); ?>
        </a>
    </div>
    <div class="post-data mdl-cell mdl-cell--7-col-desktop mdl-cell--8-col-tablet mdl-cell--4-col-phone">

        <?php if ( current_user_can( 'edit_posts' ) ) { ?>
            <button id="post-actions<?php the_ID(); ?>" class="post-actions mdl-button mdl-js-button mdl-button--icon">
                <i class="material-icons">more_vert</i>
            </button>	
            <ul class="post-actions-menu mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect" for="post-actions<?php the_ID(); ?>">
                <?php edit_post_link( __( 'Edit', 'realistic' ), '<li class="mdl-menu__item">', '</li>'); ?>
                <?php $post_type = get_post_type($post);
                $delLink = wp_nonce_url( admin_url() . "post.php?post=" . $post->ID . "&action=delete", 'delete-' . $post_type . '_' . $post->ID); ?>
                <li class="mdl-menu__item">
                    <a href="<?php echo $delLink; ?>"><?php _e( 'Delete', 'realistic' ); ?></a>
                </li>
            </ul>
        <?php }

        the_title( sprintf( '<h2 class="entry-title post-title mdl-card__title-text"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>

        <?php realistic_archives_meta( $post->ID ); ?>
        <div class="entry-content post-excerpt">
            <?php /* translators: %s: Name of current post */ ?>
            <span class="mdl-typography--font-light mdl-typography--subhead">
                <?php archives_excerpt(); ?>
            </span>
        </div><!-- .entry-content -->
        <div class="moretag">
            <a class="mdl-button mdl-js-button" href="<?php the_permalink(); ?>"><?php _e( 'View article...', 'realistic' ); ?></a>
        </div>
    </div><!-- .post-data -->
</article><!-- #post-## -->
I think there is a world market for maybe five computers. - IBM chairman Thomas Watson, 1943
Mr John

Member Rank
Posts: 3
Joined: Sun Jan 29, 2017 10:05 am
Display Name: Mr John

Re: Need Help Regards Realistic Theme

linkPost by MrJohn » Tue Jan 31, 2017 2:33 pm

Really Thanks @Asmi Khalil

one more thing I wanted ask but forgot about it, How to disable breadcrumb and "In" Category from single post
User avatar
Asmi Khalil

Site Admin Rank
Posts: 781
Joined: Fri Jun 26, 2015 7:13 am
Display Name: Asmi Khalil
Location: Tunisia

Re: Need Help Regards Realistic Theme

linkPost by admin » Wed Feb 01, 2017 11:59 pm

Well, this is pretty easy to achieve; We just need to edit /template-parts/content-single.php and remove:
<div class="breadcrumb mdl-color-text--grey-500" xmlns:v="http://rdf.data-vocabulary.org/#"><?php realistic_breadcrumb(); ?></div>
And:
_e(' in ', 'realistic');
Be careful here; if you add or leave anything even a semicolon you will receive a PHP error. Make sure to delete the whole line ( line 14 ).
I think there is a world market for maybe five computers. - IBM chairman Thomas Watson, 1943
Mr John

Member Rank
Posts: 3
Joined: Sun Jan 29, 2017 10:05 am
Display Name: Mr John

Re: Need Help Regards Realistic Theme

linkPost by MrJohn » Thu Feb 02, 2017 1:55 am

You’re so helpful. Thanks for your guidance and support.
User avatar
Asmi Khalil

Site Admin Rank
Posts: 781
Joined: Fri Jun 26, 2015 7:13 am
Display Name: Asmi Khalil
Location: Tunisia

Re: Need Help Regards Realistic Theme

linkPost by admin » Thu Feb 02, 2017 2:14 am

Most welcome :D
I am glad that I helped you!
I think there is a world market for maybe five computers. - IBM chairman Thomas Watson, 1943

Who is online

Users browsing this forum: No registered users and 1 guest

It is currently Sun Aug 25, 2019 4:51 am