Center blogpost + Change the location the 'See all our news' button links to

Hi there,

I have only one blogpost on my website (www.languageinnovationcampus.com) and wonder if it is possible to center this blogpost? I would prefer it not to be lined out on the left.

Also I wonder if it is possible to change the location the ‘See all our news’ button underneath the blog links to? I want to encourage people to contact me after reading the blogpost and contact me to get more tips about learning Japanese so I would prefer to change the name of the button to ‘Contact us to get more tips and tricks’ (I know how to do that) and than let this button link to the contact form.

Help is much appreciated!

Cheers, Lotte

Dear Lotte,

To center the post item on your homepage, could you please try to apply the following CSS code through the Simple Custom CSS plugin or child theme’s style.css?

.home .widget_sydney_latest_news .blog-post{
  float: none;
  margin-left: auto;
  margin-right: auto;
}

To add a call to action button at the bottom of your post content, try adding the following function into your child theme’s functions.php file.


add_filter('the_content', 'sydney_child_add_cta_button_after_post');
function sydney_child_add_cta_button_after_post( $content ){

	if( is_single() ){
		$content = $content . '<div><a class="roll-button more-button" href="http://yoursite.com/contact">Contact us to get more tips and tricks</a></div>';
	}

	return $content;

}

Alternatively you can use a functionality plugin like Code Snippets if you don’t want to use a child theme.

Regards,
Kharis

Thanks Karis, it worked!

Hi Kharis,

I have similar question on this post.
I just want to change the location of the page as follows on your suggestion function inserted function.php under my child theme, but it does not go to the assigned location.

add_filter(‘the_content’, ‘sydney_child_add_cta_button_after_post’);
function sydney_child_add_cta_button_after_post( $content ){

if( is_single() ){
	$content = $content . '&lt;div&gt;<a href="https://reborninaustralia.com/blog/">See all our news</a>&lt;/div&gt;';
}

return $content;

}

Could you please let me know what I did wroing?

Regards, J

Hi J,

That function adds a new “See all our news” button at the bottom content of single post page. To check it, visit one of your posts.

Regards,
Kharis

Hi Kharis,

How about when I want to change a location of URL on the front page of the See All Our News?

Please let me know.

Regards, J

Hello J,

Thank you for the followup. It requires different code. It can be accomplished by using jQuery code. Try to follow the following steps:

  1. Install and activate the TC Custom JavaScript plugin
  2. Go To Appearance > Custom JavaScript
  3. Paste the following code into the provided box

jQuery(function($) {

  if( $('.more-button').length ){

    var pageURL    = 'http://www.yoursite.com/new-news-page/';
    $('.more-button').attr('href', pageURL);
    
  }
  
});

  1. Update

Regards,
Kharis