Viewing 8 replies - 1 through 8 (of 8 total)
  • xxxLesy

    (@xxxlesy)

    Yes I also see this after the wordpress 5.5.3 update. I believe something changed to make this plugin’s “$inserted_page->ID” no longer work properly. So it pulls the data from the page, where you insert the code instead of the page you wanted to insert.

    Downgrading to previous versions of this plugin doesn’t help. And it used to work just fine a week ago.

    Plugin Author Paul Ryan

    (@figureone)

    We see it working fine on WordPress 5.5.3 on all our installs, can you test and see if there’s a specific conflict with another plugin, or provide some steps to reproduce on vanilla WordPress?

    I’m also unclear what you both mean by “the source of the page” or “the data from the page”; maybe provide some screenshots to illustrate the problem.

    I troubleshooted my problem to an issue with the custom template.

    I use a custom template, which works fine on it’s own – when inseted in a page or post.
    I then insert that template shortcode into an ad (advanced ads plugin – for tracking purposes). Which also works fine when inserted in a page/post.
    I then insert this ad into my newsletter ad slot (The Newsletter plugin), where it doesn’t work anymore. Divs and their styles get loaded, but are empty, meaning the php doesn’t get excecuted.

    But the strange part is, when I use one of the built in display options in the shortcode (title, post-thumbnail …) instead of the custom template, it does get loaded in my newsletter (in the same way as above – ad inside newsltter).

    If I copy the same code I have in my template and replace one of the built in parameters (title, post-thumbnail …) in insert-pages.php it also works fine.

    So I feel like the custom template might cause too long of a loop?

    Again this only started happening recently and rolling back both insert pages or the newsletter plugin didn’t have any effect.

    It’s not that big of a deal, now that I know just editing insert-pages.php is a workaround, but having it in a seperate template file is nicer for easier updates.

    Plugin Author Paul Ryan

    (@figureone)

    Does your custom template call the_post(); at the beginning? If not, it’s possible that the global $post variable is not being populated. Another thought, the plugin itself calls wp_reset_postdata() after finishing, so your template shouldn’t do that (unless you are doing subqueries). WordPress doesn’t have a great way to visualize the stack of subqueries you’re performing, and it’s easy to unbalance your push/pop actions, so it sounds like that’s what is happening here.

    It does have the_post(). I tried 2 different codes both with it.

    I don’t see wp_reset_postdata() in my newsletter theme file, but it does automatically populate with an article list with foreach($new_posts as $post). So yeah, it might be in other files somewhere.

    <?php
    /**
     * Template Name: Novi newsletter PR
     */
    ?>
    <div id="your-wrapper-div">
      <?php while ( have_posts() ) : the_post(); ?>
        <div id="your-container-div-for-each-post">
          <?php the_content(); ?>
          <?php the_post_thumbnail(); ?>
        </div>
      <?php endwhile; ?>
    </div>
    <?php /* Template Name: Newsletter PR */ ?>
    <?php while ( have_posts() ) : the_post(); ?>
    <div class="nad-pr-responsive" style="width:285px;float:left;">
    <table width="285" class="pr-tabela-responsive" style="margin-right:11px;"><tbody><tr><td>
    	<a href="%link%">
    		<div class="pr-naslov" style="font-family: Verdana, Arial, sans-serif; font-weight: bold; text-decoration: none; font-size: 18px;"><?php echo get_the_title( $inserted_page->ID ); ?></div>
    		<div class="desktop-pic"><?php echo get_the_post_thumbnail( $inserted_page->ID, 'td_324x235' ); ?></div>
    		<div class="mobile-pic" style="display:none;"><?php echo get_the_post_thumbnail( $inserted_page->ID, 'td_533x261' ); ?></div>
    		<!--<div class="pr-povzetek" style="color:black !important;line-height:1.5em;text-align:justify;height:85px;overflow:hidden;margin-bottom:0;"><?php echo $this->insert_pages_trim_excerpt( get_post_field( 'post_excerpt', $inserted_page->ID ), $inserted_page->ID, $attributes['should_apply_the_content_filter'] ); ?></div>-->
    	</a>
    </td></tr></tbody></table>
    </div>
    <?php endwhile; ?>
    Plugin Author Paul Ryan

    (@figureone)

    Thanks, we’ll try to see if we can reproduce this with the templates you shared.

    And just to clarify, you’re saying it works when you paste the template code above within insert-pages.php, in a section that renders one of the other display types?

    Yes, I pasted it in insert-pages.php, lines 573+ under case title and it works fine that way.

    				switch ( $attributes['display'] ) {
    					case 'title':
    						?>
    						<div class="nad-pr-responsive" style="width:285px;float:left;">
    							<table width="285" class="pr-tabela-responsive" style="margin-right:11px;"><tbody><tr><td>
    								<a href="%link%">
    									<div class="pr-naslov" style="font-family: Verdana, Arial, sans-serif; font-weight: bold; text-decoration: none; font-size: 18px;"><?php echo get_the_title( $inserted_page->ID ); ?></div>
    									<div class="desktop-pic"><?php echo get_the_post_thumbnail( $inserted_page->ID, 'medium' ); ?></div>
    									<div class="mobile-pic" style="display:none;"><?php echo get_the_post_thumbnail( $inserted_page->ID, 'td_533x261' ); ?></div>
    								</a>
    							</td></tr></tbody></table>
    						</div>
    						<?php
    						break;
    • This reply was modified 3 years, 11 months ago by xxxLesy.
    Plugin Author Paul Ryan

    (@figureone)

    Hm, I tested both those templates and they work fine, so there must be something else about your specific context causing problems. Maybe another plugin/theme hooking into the_content or another filter? I notice in your last code sample (where you place the template code on line 573 of the plugin) that there isn’t a the_post(); call, so my guess is that may be happening elsewhere. So you can try removing the while( have_posts() ) : the_post(); loop from your template and see if that works.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Plugin show page and page code’ is closed to new replies.