• Resolved Neoqueenhoneybee

    (@neoqueenhoneybee)


    I realize there are similar topics, but I have tried ‘solutions’ and have no luck.

    I’m using the ‘blankslate‘ theme; the Page edit post links show up fine, but the Post edit links don’t show.

    The following code is on the page.php, but when put on the single.php, did nothing.
    <?php edit_post_link( __( 'Edit', 'blankslate' ), '<span class="edit-link">', '</span>' ) ?>

    This is the code on the single.php:

    <?php if (is_single(array('bh-news','bh-events','bh-announcements'))): ?>
    <?php get_header('behavioral'); ?>
    <?php endif; ?>
    
    <?php if (is_single(array('idd-upcoming-events','idd-advocacy-corner','idd-consumer-satisfaction-2','idd-volunteer-or-intern','idd-newsletters'))): ?>
    <?php get_header('iddservices'); ?>
    <?php endif; ?>
    
    <?php if (!is_single(array('bh-news','bh-events','bh-announcements','idd-upcoming-events','idd-advocacy-corner','idd-consumer-satisfaction-2','idd-volunteer-or-intern','idd-newsletters'))): ?>
    <?php get_header(); ?>
    <?php endif; ?>
    
    <article id="content">
    
    <div id="largecol">
    <?php the_post(); ?>
    
    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
    <h1 class="columnheaders"><?php the_title(); ?></h1>
    
    <div class="columntext">
    <?php
    if ( has_post_thumbnail() ) {
    the_post_thumbnail();
    }
    ?>
    <?php the_content(); ?>
    
    <?php wp_link_pages('before=<div class="page-link">' . __( 'Pages:', 'blankslate' ) . '&after=</div>') ?>
    
    <?php edit_post_link( __( 'Edit', 'blankslate' ), '<span class="edit-link">', '</span>' ) ?>
    
    </div>
    
    </div>
    
    </div></div>
    </article>
    <?php get_footer(); ?>

    >> The web page to look at is this page

    The small, right column is the post, the larger right column is the page.

    And code to the page template that pulls in the posts:

    <?php
    
    /*
    
    Template Name: Main Site Template
    
    */
    
    ?>
    
    <?php get_header(); ?>
    
    <div id="content">
    
    <?php if (!is_page('programs-services')): ?>
    
    <div id="maincol">
    
    <?php the_post(); ?>
    
    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    
    <div class="columntext">
    
    <?php the_content(); ?>
    
    <?php wp_link_pages('before=<div class="page-link">' . __( 'Pages:', 'blankslate' ) . '&after=</div>') ?>
    
    <?php edit_post_link( __( 'Edit', 'blankslate' ), '<span class="edit-link">', '</span>' ) ?>
    
    </div>
    
    <?php endif; ?>
    
    </div>
    
    </div>
    
    <?php if (!is_page('programs-services')): ?>
    
    <div id="rightcol">
    
    <?php if (is_page('contact-us')): ?>
    
    <?php
    
    $post_id = 171;
    
    $queried_post = get_post($post_id);
    
    $title = $queried_post->post_title;
    
    ?>
    
    <p class="columnheaders"><?php echo $title;
    
    ?></p>
    
    <p class="columntext2"><?php echo $queried_post->post_content;
    
    ?></p>
    
    <?php endif; ?>
    
    <?php if (is_page('jobs-volunteering')): ?>
    
    <?php
    
    $post_id = 151;
    
    $queried_post = get_post($post_id);
    
    $title = $queried_post->post_title;
    
    ?>
    
    <p class="columnheaders"><?php echo $title;
    
    ?></p>
    
    <p class="columntext2"><?php echo $queried_post->post_content;
    
    ?></p>
    
    <?php endif; ?>
    
    <?php if (is_page('news-events')): ?>
    
    <?php
    
    $post_id = 478;
    
    $queried_post = get_post($post_id);
    
    $title = $queried_post->post_title;
    
    ?>
    
    <p class="columnheaders"><?php echo $title;
    
    ?></p>
    
    <p class="columntext2"><?php echo $queried_post->post_content;
    
    ?></p>
    
    <?php endif; ?>
    
    <?php if (is_page('support-our-work')): ?>
    
    <?php
    
    $post_id = 158;
    
    $queried_post = get_post($post_id);
    
    $title = $queried_post->post_title;
    
    ?>
    
    <p class="columnheaders"><?php echo $title;
    
    ?></p>
    
    <p class="columntext2"><?php echo $queried_post->post_content;
    
    ?></p>
    
    <?php endif; ?>
    
    <?php if (is_page('hipaa-practices')): ?>
    
    <?php
    
    $post_id = 352;
    
    $queried_post = get_post($post_id);
    
    $title = $queried_post->post_title;
    
    ?>
    
    <p class="columnheaders"><?php echo $title;
    
    ?></p>
    
    <p class="columntext2"><?php echo $queried_post->post_content;
    
    ?></p>
    
    <?php endif; ?>
    
    <?php if (is_page('about-us') || is_page('our-leadership') || is_page('interacts-headquarters-at-the-langhurst-mansion') || is_page('facility-rentals')): ?>
    
    <div class="columnheaders">Navigation</div>
    
    <div class="columntextmenu"><?php wp_nav_menu( array( 'theme_location' => 'aboutus-submenu' ) ); ?></div>
    
    <?php endif; ?>
    
    </div>
    
    <?php endif; ?>
    
    <?php if (is_page('news-events')): ?>
    
    <div id="contact">
    
    <div id="container5">
    
    <div id="container4">
    
    <div id="container3">
    
        <div id="container2">
    
            <div id="container1">
    
                <div id="col1"><?php
    
    $post_id = 186; 
    
    $queried_post = get_post($post_id);
    
    $title = $queried_post->post_title;
    
    ?>
    
    <div class="colTitle"><?php echo $title;?></div>
    
    <p class="columntext"><?php echo substr($queried_post->post_content, 0, 100);
    
    ?>...<br><a href="<?php echo get_permalink( $post_id ); ?>">Read More >></a></p>
    
    </div>
    
    <div id="col2"></div>
    
    <div id="col3">
    
    <?php
    
    $post_id = 191;
    
    $queried_post = get_post($post_id);
    
    $title = $queried_post->post_title;
    
    ?>
    
    <div class="colTitle"><?php echo $title;?></div>
    
    <p class="columntext"><?php echo substr($queried_post->post_content, 0, 100);
    
    ?><br><a href="<?php echo get_permalink( $post_id ); ?>">Current Calendar >></a></p>
    
    </div>
    
    <div id="col4"></div>
    
    <div id="col5">
    
    <?php
    
    $post_id = 193;
    
    $queried_post = get_post($post_id);
    
    $title = $queried_post->post_title;
    
    ?>
    
    <div class="colTitle"><?php echo $title;?></div>
    
    <p class="columntext"><?php echo substr($queried_post->post_content, 0, 100);
    
    ?>...<br><a href="<?php echo get_permalink( $post_id ); ?>">Read More >></a></p>
    
    </div>
    
    </div>
    
    </div>
    
    </div>
    
    </div>
    
    </div>
    
    </div>
    
    <?php endif; ?>
    
    <?php if (is_page('programs-services')): ?>
    
    <div id="content">
    
    <div id="container5">
    
    <div id="container4">
    
    <div id="container3">
    
        <div id="container2">
    
            <div id="container1">
    
                <div id="col1"><?php
    
    $post_id = 31; 
    
    $queried_post = get_post($post_id);
    
    $title = $queried_post->post_title;
    
    ?>
    
    <div class="colTitle"><?php echo $title;?></div>
    
    <p class="columntext"><?php echo $queried_post->post_content;
    
    ?><br /><?php wp_nav_menu( array( 'theme_location' => 'older-adults' ) ); ?></p>
    
    </div>
    
    <div id="col2"></div>
    
    <div id="col3">
    
    <?php
    
    $post_id = 138;
    
    $queried_post = get_post($post_id);
    
    $title = $queried_post->post_title;
    
    ?>
    
    <div class="colTitle"><?php echo $title;?></div>
    
    <p class="columntext"><?php echo $queried_post->post_content;
    
    ?><br /><?php wp_nav_menu( array( 'theme_location' => 'idd-menu' ) ); ?></p>
    
    </div>
    
    <div id="col4"></div>
    
    <div id="col5">
    
    <?php
    
    $post_id = 34;
    
    $queried_post = get_post($post_id);
    
    $title = $queried_post->post_title;
    
    ?>
    
    <div class="colTitle"><?php echo $title;?></div>
    
    <p class="columntext"><?php echo $queried_post->post_content;
    
    ?><br /><?php wp_nav_menu( array( 'theme_location' => 'behavioral-health' ) ); ?></p>
    
    </div>
    
    </div>
    
    </div>
    
    </div>
    
    </div>
    
    <?php endif; ?>
    
    </div></div>
    
    <?php get_footer(); ?>

    Please let me know if there is anything else I need to provide. Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Neoqueenhoneybee

    (@neoqueenhoneybee)

    I’m still searching for online answers and it seems like this person had the same issue I’m having, working with queried posts. Unfortunately he never received an answer.

    So this got me rethinking my question; is there specific post edit link code that I can place within the queried code?

    <?php
    $post_id = 171;
    $queried_post = get_post($post_id);
    $title = $queried_post->post_title;
    ?>

    I tried experimenting and putting the below after the ‘$title =’ and there was an error.

    $edit_post_link( __( 'Edit', 'blankslate' ), '<span class="edit-link">', '</span>' );

    Thanks!

    Thread Starter Neoqueenhoneybee

    (@neoqueenhoneybee)

    If I can get the below code to work, I’ll have a solution. The ‘Edit’ does appear below the post, but links to the page edit screen. I’ve tried putting in the post ‘id’ number, and it still points to the page edit screen.

    Anyone have any input?

    <?php
    $post_id = 171;
    $queried_post = get_post($post_id);
    $title = $queried_post->post_title;
    ?>
    <p class="columnheaders"><?php echo $title;
    ?></p>
    <p class="columntext2"><?php echo $queried_post->post_content;
    ?>
    </p>
    
    <p class="columntext2"><?php edit_post_link( __( 'Edit', 'blankslate' , $id = 171 ), '<span class="edit-link">', '</span>' ) ?></p>
    <?php endif; ?>
    Thread Starter Neoqueenhoneybee

    (@neoqueenhoneybee)

    Someone helped me figure it out!

    Below is the code I ended up using and it works fine.

    <?php
    $post_id = 171;
    $queried_post = get_post($post_id);
    $title = $queried_post->post_title;
    ?>
    <p class="columnheaders"><?php echo $title;
    ?></p>
    <p class="columntext2"><?php echo $queried_post->post_content;
    ?>
    </p>
    <p class="columntext2"><?php edit_post_link( 'Edit', '', '', $post_id ); ?></p>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Edit Post Link Not Showing on Posts’ is closed to new replies.