How do I remove categories from this PHP snippet?

I'm editing a WordPress plugin that provides a suggestion for related blog posts.

Here is a screenshot of how it looks now:

enter image description here

I want it to look exactly like the screenshot, but without the "Gratefulness, Happiness" links ... which are just links to categories. Keep the "Recommended for You" and the link to the article, but remove the link to the categories.

If I remove the "foreach ( $siblings as $url => $name )" snippet from the code below, then it gets rid of the categories, but messes up the link to the recommended article.

How should I edit it? To remove the categories but keep everything else?

Note: I'm not sure if this matters for the code below, but the plugin chooses the recommended article based on the previous article in the same category.

       ob_start();
    do_action( 'iworks_upprev_box_before' );
    $value .= ob_get_flush();
    if ( $iworks_upprev_options->get_option( 'header_show' ) ) {
        $value .= '<h6>';
        if ( count( $siblings ) ) {
            $value .= sprintf ( '%s ', __('Recommended for You' ) );
            $a = array(); 
            foreach ( $siblings as $url => $name ) {
            $a[] = sprintf( '<a href="%s" rel="%s">%s</a>', $url, $current_post_title, $name );
            }
            $value .= implode( ', ', $a);
        } else if ( $compare == 'random' ) {
            $value .= __('Read more:', 'upprev' );
        } else {
            $value .= __('Read previous post:', 'upprev' );
        }
        $value .= '</h6>';
    }

Solutions

It looks like all you need to do is comment out this line or remove it:

$value .= implode( ', ', $a);

You can also comment / remove the following lines of code:

$a = array(); 
foreach ( $siblings as $url => $name ) {
   $a[] = sprintf( '<a href="%s" rel="%s">%s</a>', $url, $current_post_title, $name );
}
Tags: PHP / Wordpress / Plugins

Similar questions

Adding a widget under an 'Add to Cart' button through a PHP snippet
Despite that my PHP knowledge is very scarce I've managed to add some elements under the add-to-cart button in my installation of Woocommerce with the function: I'd like to also add a small currency converter calculator widget using the same function, if possible, but my Google-fu hasn't returned useful results. Do I need to access the source code ...
Code snippet to show current php version inside "At a Glance" box in admin
Could somebody provide a code snippet which would show current php version inside the "At a glance" box win Wordpress admin? There are plugins but I'd like to do it with a code.
What is the ideal location to insert php code snippet into custom wordpress theme so global variable is widely accessible?
I'm playing around with a custom theme for Wordpress and I have this code snippet in my header, home and footer.php files. I should have this code in one location. Where should I place it so the global variable $lang is available in the header, footer, home and other template files?
Why is adding this html snippet in a php page working, but disabling other Wordpress functions?
There's a snippet of code near the top my WP theme's index.php (which other themes have as home.php). It looks like this: So, to insert a slideshow and a news ticker to my site's home page, I altered that, and turned it in to this: And so on ... Then the blog excerpts show underneath. The ticker and slideshow are working perfectly. But for some rea...
How can I make this php snippet float:right in my footer, but remain in the body of the page?
I'd like to have these social icons float:right in my footer. But when I try this before the closing PHP tag ?>: It gives me: If I put it below the closing PHP tag, ?>, it works, but appears outside the body of the page, way in the lower right-hand corner of the screen (in the blue area). I'd like it within the body of the page, but I'd like to get...
How can I properly combine this simple javascript into this tiny php snippet?
I have a snippet of code in a php (WordPress) page: What I'm trying to do is to add something in there ... like an extra clause to the javascript portion of that snippet, like this: So I want to somehow incorprate the data-cfasync="false" into the php snippet, but I'm unsure how to do this. Any guidance would be truly appreciated!

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.