• Hi.

    This is the first time I’m installing WPML from scratch, though I have been using it on several other sites.

    Everything was working okay, until I had to delete an English translation of a parent page.
    After that, I got this error: http://d.pr/i/3cXQ.The text: “Notice: Trying to get property of non-object in /var…./wp-includes/post-template.php” Making a new translation of the same page does not help.

    However, I found out the url with the post id will show the entire site, so I put up a redirect from the index, to that page. (http://d.pr/i/8CI2)

    I am not sure what is causing the problem, nor how to solve it. But it seems wordpress is unable to find the page id, or it has somehow been changed?

    Any suggestions?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter preben89

    (@preben89)

    Btw, the code for index.php is:

    <?php /* Main post template file */ ?>
    
    <?php get_header(); 
    
    exit;
    
    ?>
    <article class="article">
    <?php
    	// get this page
    get_template_part('part-page');
    
    // get all child pages and output them
    $the_query = new WP_Query('orderby=menu_order&order=ASC&post_type=page&post_parent='.get_the_ID());
    
    while ( $the_query->have_posts() ) : $the_query->the_post();
    	get_template_part('part-page');
    endwhile;
    
    ?>
    
    </article>
    
    <?php 
    
    get_footer();
    ?>

    Thread Starter preben89

    (@preben89)

    I also noticed another error in the source code:
    http://d.pr/i/70wu

    The code it is referring to is this:

    <div class=”submenu”>
    
    <?php
    
    $i = 1;
    
    while(has_sub_field(“sections”))
    {
    if (get_sub_field(“title”) && $i != 1) {
    echo ‘<a
    onclick=”_gaq.push(['_trackPageview', '/' . strip_tags(get_sub_field("title")) . '']);”
    data-url=”‘ . sanitize_title_with_dashes(get_sub_field(“title”)) . ‘-section’ . ‘”>’ . strip_tags(get_sub_field(“title”)) . ‘‘;
    
    }
    $i++;
    }
    ?>
    </div>

    while(has_sub_field(“sections”)) is the code on line 169.

    Are there any chance the errors might be related?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Error with "return get_post()->ID;" after deleting a translated post’ is closed to new replies.