Pro Theme Design Forum » Mimbo Pro » Technical Help

Problem with Related Post

  • Started 1 year ago by Q-design
  • Latest reply from Ben
  • This topic is not a support question

Hi,
I'm using your theme (version 2.0) on my website, but when I try to use the plugin Related Post (or Related Post with Thumbnail) I don't obtain the list of articles.

Do you know the reason for this strange behaviour?

I tried to uninstall all plugins except Related Post but anything happens...

Could you help me?

And another question:

is it possible change the bm_categoryPosts function?

I don't want to show a particular category. I know the ID of that category but I don't understand the way I could change that function.

  • Ben
  • Ben
  • Posted 1 year ago #

I have no idea what the answer to your first question is - i've not even heard of the plugin :(

Regarding the second problem, yes you can add categories to ignore :)

The function bm_categoryPosts can be found in theme_functions.php

In that function I would create an array of ids to ignore (to be flexible if you want to add more in the future)

$ignoreList = array(1,2,3);

and then in the foreach loop that goes through all the categories I would check if the current category is in the ignoreList array using the PHP in_array function


foreach( $bm_cats as $bm_c ) {
if(!in_array($bm_c->cat_ID, $ignoreList) {
//... other code here ...
}
}

First of all, thank you Ben foryour quick reply.

I don't know exactly where to put the code. I tried to put directly after the line

foreach( $bm_cats as $bm_c ) {

but I obtain only an error. Wordpress doesn't like the curly brackets {

Where I do wrong?

  • Ben
  • Ben
  • Posted 1 year ago #

You've got the correct location. You need to add the if(!in_array part directly after the foreach and then make sure you close the curly brackets at the end of the foreach

Also I've just noticed that I missed a closing bracket at the end of the if statement as well. It should read like this...

if(!in_array($bm_c->cat_ID, $ignoreList)) {

... I guess that's what I get for writing code without actually testing it :)

Reply

You must log in to post.