• Resolved MyLifeGameRU

    (@mylifegameru)


    My functions.php and My Theme Newspaper

    /*  ----------------------------------------------------------------------------
        thumbnails
     */
    
    //the image sizes that we use
    add_theme_support( 'post-thumbnails' );
    
    //featured image
    $td_crop_features_image = td_util::get_option('tds_' . 'crop_features_image');
    if ($td_crop_features_image == '') {
        add_image_size('featured-image', 700, 0, true);
    } else {
        add_image_size('featured-image', 700, 357, true);
    }
    
    //the small thumbnails
    set_post_thumbnail_size(          100, 65, true );
    add_image_size('art-thumb',       100, 65, true);
    
    //small height, 1 col wide
    add_image_size('art-wide',        326, 159, true);
    
    //medium height 1 col wide
    add_image_size('art-big-1col',    326, 235, true);
    
    //the slides
    add_image_size('art-slide-small', 326, 406, true);
    add_image_size('art-slide-med',   700, 357, true);
    add_image_size('art-slide-big',  1074, 483, true);
    
    //gallery slide 2 column
    add_image_size('td_0x357',         0, 357, true);
    add_image_size('td_0x483',         0, 483, true);
    
    //big slider - big image
    add_image_size('art-slidebig-main',  745, 483, true);
    
    //the gallery
    add_image_size('art-gal',         210, 210, true);
    
    //the gallery
    add_image_size('td_198x143', 198, 143, true);

    in the record is image
    And the blog not work ??
    Help me plz

    https://www.ads-software.com/plugins/external-featured-image/

Viewing 15 replies - 1 through 15 (of 19 total)
  • Plugin Author Nelio Software

    (@nelio)

    Hi there! Could you please share a link to your site where I can see a post with a regular featured image (which should be working) and a post with an external featured image (which should not be visible)? It may be the case that the problem you’re facing can be solved by simply editing your CSS files, but we need to take a look at your site.

    If the problems could not be solved via CSS, I’ll need access to your theme. If you could also please send a zipped version of it to our e-mail address (customers AT neliosoftware DOT com), that’d be great!

    Thread Starter MyLifeGameRU

    (@mylifegameru)

    My blog – mylifegameru
    Post – “Получаем бесплатно Gauntlet — Champions Crown DLC Steam”

    Plugin Author Nelio Software

    (@nelio)

    Hi again! Sorry for the delay; I’ve been out this weekend and couldn’t answer before. As it turns out, I have a copy of the Newspaper theme, and I could directly check the source code and see what you have to fix.

    The first file you’ll have to edit to fix the featured image on the list of latest posts is includes/wp_booster/td_module.php. On line 256, you’ll see the following statement:

    $buffy .= '<img width="' . $td_temp_image_url[1] . '" height="' . $td_temp_image_url[2] . '" itemprop="image" class="entry-thumb" src="' . $td_temp_image_url[0] . '" ' . $attachment_a    lt . $attachment_title . '/>';

    “Replace” it with the following piece of code:

    if ( function_exists( 'uses_nelioefi' ) && uses_nelioefi( $this->post->ID ) ) {
      global $_wp_additional_image_sizes;
      $nelio_width = $_wp_additional_image_sizes[$thumbType]['width'];
      $nelio_height = $_wp_additional_image_sizes[$thumbType]['height'];
      $buffy .= get_the_post_thumbnail(
        $this->post->ID,
        array( $nelio_width, $nelio_height ),
        array( 'class' => 'entry-thumb' )
      );
    }
    else {
      $buffy .= '<img width="' . $td_temp_image_url[1] . '" height="' . $td_temp_image_url[2] . '" itemprop="image" class="entry-thumb" src="' . $td_temp_image_url[0] . '" ' . $attachment_a    lt . $attachment_title . '/>';
    }

    Essentially, what this piece of code is doing is: if the post is using an external featured image, the img tag you’ll have to use is the one returned by WordPress’ standard function get_the_post_thumbnail. Otherwise, use theme’s regular approach (note that the original line wasn’t removed, but used in the else block).

    Then, in order to fix the featured image when viewing a concrete post, you’ll have to edit file includes/modules/module_modifier/td_module_blog.php lines 213-236. We’ll do the same we did before: we’ll create a new if-else block and surround the already-existing code from lines 213-236 into the else part of the code we add. This is the code you need:

    if ( function_exists( 'uses_nelioefi' ) && uses_nelioefi( $this->post->ID ) ) {
      $buffy = '';
      if ( is_single() ) {
        $image_html = get_the_post_thumbnail(
          $this->post->ID,
          false,
          array( 'class' => 'entry-thumb single-nelioefi' )
        );
      }
      else {
        $image_html = '<a href="' . $this->href . '">';
        $image_html .= get_the_post_thumbnail(
          $this->post->ID,
          false,
          array( 'class' => 'entry-thumb single-nelioefi' )
        );
        $image_html .= '</a>';
      }
    }
    else {
      // Here, the original code has to be placed. It starts with:
      $featured_image_id = get_post_thumbnail_id($this->post->ID);
      // And it goes on and on until:
      $image_html = '<a href="' . $this->href . '"> [...] </a>';
    }
    
    // And right after the else block we just inserted, comes this:
    $buffy .= '<div class="td-post-featured-image">';

    This will insert the external featured image into your HTML code. However, the image won’t be visible. You’ll have to add a new CSS rule:

    img.single-nelioefi {
      width:100%;
      height:300px;
    }

    You can tweak it as you please, and the featured image will look like the way you want it to look like.

    I hope this solves your problems! There might be other issues with galleries and so on… But that requires too much of your/my time! I’d recommend you contact the theme developer and ask him to use the function (get_)the_post_thumbnail for printing the img tag for featured images wherever a featured image is needed. Also, please note that, whenever the theme is updated, all your changes will be lost.

    Thread Starter MyLifeGameRU

    (@mylifegameru)

    $buffy .= ‘<img width=”‘ . $td_temp_image_url[1] . ‘” height=”‘ . $td_temp_image_url[2] . ‘” itemprop=”image” class=”entry-thumb” src=”‘ . $td_temp_image_url[0] . ‘” ‘ . $attachment_a lt . $attachment_title . ‘/>’;
    Don’t work code – syntax error, unexpected T_STRING ??
    https://2.firepic.org/2/images/2014-09/29/0x94iz7kjsur.jpg

    Thread Starter MyLifeGameRU

    (@mylifegameru)

    Nice!!! Work!
    https://mylifegame.ru/
    Need code:
    `if ( function_exists( ‘uses_nelioefi’ ) && uses_nelioefi( $this->post->ID ) ) {
    global $_wp_additional_image_sizes;
    $nelio_width = $_wp_additional_image_sizes[$thumbType][‘width’];
    $nelio_height = $_wp_additional_image_sizes[$thumbType][‘height’];
    $buffy .= get_the_post_thumbnail(
    $this->post->ID,
    array( $nelio_width, $nelio_height ),
    array( ‘class’ => ‘entry-thumb’ )
    );
    }
    else {
    My standard code*** ??
    }
    Thank you!

    Plugin Author Nelio Software

    (@nelio)

    I’m glad to hear! And thanks for sharing your solution.

    starter11

    (@starter11)

    Hi, can you help me too?
    I need to generate Newpapers theme thumbnails (100*65, 326*159, etc) only if uploaded image named with “thumb”, for examle thumb15.jpg, thumbnail1.jpg…
    Standart WordPresses thumbnails must be generated for all uploaded images.
    Sorry for my English, please )

    Plugin Author Nelio Software

    (@nelio)

    Hi starter. I’m afraid I cannot help you with this issue. What you’re trying to solve involves uploading the featured image to WordPress’ media library and, then, generate the thumbnails. Our plugin does not load any images to there (that’s why it’s called external featured images).

    Anyway, you may want to try out a plugin called “Regenerate Thumbnails“. It may come handy.

    [Edit: added link to the other plugin]

    I’ve tried following the instructions and have modified the 2 files and added the css but still doesn’t work? It appears as if it wants to display the image as now there is extra spacing on the front page, but it doesn’t display. Can Nelio or MyLifeGameRU possibly lend a hand?

    Plugin Author David Aguilera

    (@davilera)

    Hi @worldchris. I think I answered you in another thread… Please share a link to your blog where I can see how things “almost” work and then we’ll see how I can help you ??

    Hello I changed those codes but at single post view the thumbnail doesnt appears… Can you help me? At the homepage and the category posts page the thumbnail shows up but it doesn’t appear at single post page.
    Here is the link from a sample single post where the thumbnail isn’t showing:

    Single post view

    Plugin Author David Aguilera

    (@davilera)

    The image is there, but it’s too small (1px x 1px). Add the following CSS rule and you should be able to see it:

    .single .nelioefi {
      width:100%;
      max-height:300px;
    }

    (Feel free to use the whatever sizes you want to use; I’m using max-height:300px as an example).

    hmm Ok the code you gived me I modified to .single-nelioefi which is the name of class which appears at the image and now its ok.. but the uploaded featured images are not showing up.. It only displays dots inside a bracket with a link to the post.. here is an example link: Link

    Plugin Author David Aguilera

    (@davilera)

    That error was introduced when you edited your PHP files (it’s showing text instead of an image). I recommend you take a look at the files you edited and make sure that an image is inserted. If the error is not there, you’ll have to find where that portion of the page is created in your theme and fix it.

    Unfortunately, these kind of issues are complex to find… you’ll have to dive into the code and find the specific offending line(s). Good luck!

    Could you explain this a bit more:

    It seems you have comments in the code and your asking to paste certain pieces in different places.

    includes/modules/module_modifier/td_module_blog.php lines 213-236.
    Your code:

    if ( function_exists( 'uses_nelioefi' ) && uses_nelioefi( $this->post->ID ) ) {
      $buffy = '';
      if ( is_single() ) {
        $image_html = get_the_post_thumbnail(
          $this->post->ID,
          false,
          array( 'class' => 'entry-thumb single-nelioefi' )
        );
      }
      else {
        $image_html = '<a href="' . $this->href . '">';
        $image_html .= get_the_post_thumbnail(
          $this->post->ID,
          false,
          array( 'class' => 'entry-thumb single-nelioefi' )
        );
        $image_html .= '</a>';
      }
    }
    else {
      // Here, the original code has to be placed. It starts with:
      $featured_image_id = get_post_thumbnail_id($this->post->ID);
      // And it goes on and on until:
      $image_html = '<a href="' . $this->href . '"> [...] </a>';
    }
    
    // And right after the else block we just inserted, comes this:
    $buffy .= '<div class="td-post-featured-image">';

    Here is what I have by defualt for lines 213 – 236

    //get the full size for the popup
                    $featured_image_full_size_src = td_util::attachment_get_src($featured_image_id, 'full');
    
                    $buffy = '';
    
                    $show_td_modal_image = td_util::get_option('tds_featured_image_view_setting') ;
    
                    if (is_single()) {
                        if ($show_td_modal_image != 'no_modal') {
                            //wrap the image_html with a link + add td-modal-image class
                            $image_html = '<a href="' . $featured_image_full_size_src['src'] . '" data-caption="' . htmlentities($featured_image_info['caption'], ENT_QUOTES) . '">';
                            $image_html .= '<img width="' . $featured_image_info['width'] . '" height="' . $featured_image_info['height'] . '" itemprop="image" class="entry-thumb td-modal-image" src="' . $featured_image_info['src'] . '" alt="' . $featured_image_info['alt']  . '" title="' . $featured_image_info['title'] . '"/>';
                            $image_html .= '</a>';
                        } else { //no_modal
                            $image_html = '<img width="' . $featured_image_info['width'] . '" height="' . $featured_image_info['height'] . '" itemprop="image" class="entry-thumb" src="' . $featured_image_info['src'] . '" alt="' . $featured_image_info['alt']  . '" title="' . $featured_image_info['title'] . '"/>';
                        }
                    } else {
                        //on blog index page
                        $image_html = '<a href="' . $this->href . '"><img width="' . $featured_image_info['width'] . '" height="' . $featured_image_info['height'] . '" itemprop="image" class="entry-thumb" src="' . $featured_image_info['src'] . '" alt="' . $featured_image_info['alt']  . '" title="' . $featured_image_info['title'] . '"/></a>';
                    }
    
                    $buffy .= '<div class="td-post-featured-image">';

    Would be nice just to have the code to paste over the area vs having to chop it up.

    Thanks!

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Don't work on Newspaper Theme’ is closed to new replies.