Skip to content
Public Ticket #6939

Related Articles

Conversation thread

ISOLE-GRECHE replied

Customer Reply

Maybe, I didn't understand use of theme child.

In theme child folder I have only this files:  functions.php, style.css and screenshot.png

Which are steps I have to do?

Penci Design replied

Staff Reply

Hi,

1/ You can use replace custom code :

// Post ids you want hide  related post
 $post_ids = array( '0','1','2' );
if( in_array( get_the_ID(), $post_ids ) ) {
 return;
}

to 

// Post id you want hide  related post
 $post_id = '0';
if( $post_id == get_the_ID() ) { return;
}

2/ Don't worry about this issue.

If you custom code on child theme of PenNews , It not lose when you update theme.

If you custom code on  theme, please copy custom code to  child theme.

Best Regards,

PenciDesign

ISOLE-GRECHE replied

Customer Reply

1. If I want to unable Related Articles for more than one post_id may I repeat code for each one or have I to use "or" clause?

2. Excuse me, but I'd like to understand better one thing. If I update the template, I think I'll lose changes. Infact, I'm using theme child to avoid it. Now, in theme child folder there are: functions.php, style.css and screenshot.png. Have I to copy there related_posts.php and add custom code there?

Penci Design replied

Staff Reply

Hi,

Related Articles code on pennews/template-parts/related_posts.php file as screenshot  http://prntscr.com/mmgsmq

then add custom code as screenshot http://prntscr.com/mmgt4e

// Post id you want hide  related post
 $post_id = '0';
if( $post_id == get_the_ID() ) {
return;
}

Please check  this guide to know find the post ID

Best Regards,

PenciDesign

ISOLE-GRECHE replied

Customer Reply

Is it possibile to work on php code?

Penci Design replied

Staff Reply

Hi,

Unfortunately, curently this theme doesn't support disable Related Articles only for certain posts.

Best Regards,

PenciDesign

ISOLE-GRECHE started the conversation

Conversation Start

How is possible to disable Related Articles only for certain posts?

In post settings, down by article editor I can see only 
"Disable Auto Load Previous Post" and other settings about siderbar...

Want to join this conversation or access attachments? Sign in first.