Blog Link Format: How to just go to link, no page created

I have three different blogs on 3 different domains. On my main blog posts page I want to have “Link Format” posts that show the image and excerpt but all links go directly to the existing page on the other blog domain without creating a new duplicate one on the current site’s blog. Also, I either need the meta to not show on the link posts or have the category link go to the category on the outside domain. How can I do this?

Here is my main posts page with a link to an outside post called STOP BEING JEALOUS TO SAVE YOUR RELATIONSHIP https://blog.donnabarnes.com/blog/

Also, how can I change the post titles to Capitalize instead of Uppercase?

Hello Donna,

Thanks for writing in!

1.) To change the post titles to Capitalize instead of Uppercase, please add the following CSS code in the X > Theme Options > Global CSS (http://prntscr.com/evui3r)

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    text-transform: capitalize;
}

2.) To change the permalink to the actual link for the Link post format, since the child theme is set up, please add the following code in your child theme’s functions.php file

// =============================================================================
// Change permalink for the link post format
function change_link_filter($link, $post) {
     if (has_post_format('link', $post) && get_post_meta($post->ID, '_x_link_url', true)) {
          $link = get_post_meta( get_the_ID(), '_x_link_url',  true );
     }
     return $link;
}
add_filter('post_link', 'change_link_filter', 10, 2);
// =============================================================================

We would loved to know if this has work for you. Thank you.

Thanks so much that worked to change the links!
But I have PRO theme and there is no Global CSS option in PRO > Theme Options. Where should I put that code?

Hey Donna,

You can add it in Pro > Theme Options > Global CSS.

Hope this helps.

Great thanks! That worked!

Is it possible to make the post headings aligned to center?

Hey Donna,

You can align the headings to the center by updating the code into this:

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    text-transform: capitalize;
    text-align: center;
}

Hope this helps.

Great, yes that helped! You’re the best! I appreciate all your quick replies!

You are most welcome. :slight_smile:

Is it possible to show an excerpt on the link format posting on the posts page?

Hi Donna,

It’s possible, since you have the child theme, please copy the file \pro\framework\views\integrity\content-link.php of the main theme to your child theme (with same folder structure, example \pro-child\framework\views\integrity\content-link.php and please create folders when needed)

Then edit your child theme’s content-link.php and make sure the code is the same as this

<?php

// =============================================================================
// VIEWS/INTEGRITY/CONTENT-LINK.PHP
// -----------------------------------------------------------------------------
// Link post output for Integrity.
// =============================================================================

$link = get_post_meta( get_the_ID(), '_x_link_url',  true );

?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  <div class="entry-featured">
    <?php x_featured_image(); ?>
  </div>
  <div class="entry-wrap">
    <header class="entry-header">
      <?php if ( is_single() ) : ?>
      <div class="x-hgroup">
        <h1 class="entry-title"><?php the_title(); ?></h1>
        <span class="entry-title-sub"><a href="<?php echo $link; ?>" title="<?php echo esc_attr( sprintf( __( 'Shared link from post: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ); ?>" target="_blank"><?php echo $link; ?></a></span>
      </div>
      <?php else : ?>
      <div class="x-hgroup center-text">
        <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ); ?>"><?php x_the_alternate_title(); ?></a></h2>
        <span class="entry-title-sub"><a href="<?php echo $link; ?>" title="<?php echo esc_attr( sprintf( __( 'Shared link from post: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ); ?>" target="_blank"><?php echo $link; ?></a></span>
      </div>
      <?php endif; ?>
      <?php x_integrity_entry_meta(); ?>
    </header>
    <?php x_get_view( 'global', '_content', 'the-excerpt' ); ?>
  </div>
  <?php x_get_view( 'integrity', '_content', 'post-footer' ); ?>
</article>

Hope this helps.

Thanks!

Thanks so much! I hate to be picky but is there any way to not show the actual link? Since the image and title both click through to it like all the other posts?

Hi Donna,

To do that, you will have to remove these lines in the code:

 <span class="entry-title-sub"><a href="<?php echo $link; ?>" title="<?php echo esc_attr( sprintf( __( 'Shared link from post: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ); ?>" target="_blank"><?php echo $link; ?></a></span>
  </div>

and

<span class="entry-title-sub"><a href="<?php echo $link; ?>" title="<?php echo esc_attr( sprintf( __( 'Shared link from post: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ); ?>" target="_blank"><?php echo $link; ?></a></span>

Hope this helps.

You’re the best! That worked great!

You’re most welcome, Donna. :slight_smile:

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.