Directory Press-Free Listings, Hide Website Button

Although Directory Press, a product of Premium Press, offers lots of configuration options, sometimes you want to make some special setups. Thanks to Mark Fail, the developer, we can make those changes because he believes in open source code.

This week, I wanted to change the features that show up on the listing page for clients that are using the Free Listing.

What to change

One of my goals in making changes to the source code in Directory Press is to avoid making changes in the database structure and keep the updates to the code simple and readable. So, I decided that instead of writing code to figure out if it was a Free listing it would be easier to make the assumption that Package 1 would always be Free. Of course, if you understand the code you can make any other package Free as well.

Where to change it

One of the first things to do is figure out which program module (or file) we need to update. In this case, individual listings are shown using the _single.php module. Remember, any changes to the source code may break your website and the changes may need to be added back after every Directory Press update. So keep good notes of all changes you make to your website.

After we identify the right module, we will need to figure out which data field is available to implement our changes. I know from past experience that getting the cost of a listing may be involved, so in this case we will be using the packageID and making the assumption that if packageID = 1, then it is the FREE listing.

You have now completed the most difficult part of adding your own features to the Directory Press application, identifying the right source module and data variable to add your updates.

How to change it

Enough talking, here is how I updated the code to remove the Visit Website button on the listing page. Keep your code logical and structured, which will help you understand your changes when you look at it a year later.

NOTE: Save the original file to your local machine and create a new copy. Update that copy and upload the new file back to your server. If you are not familiar with HTML and PHP, then you should not make these changes.

You update your files at your own risk.

Program: Directory Press
Version: 6.1
Modules Changed: template_directorypress/_single.php
Code Changes:

First, create a variable for our test. This helps keeps things readable. Find the following:

$GLOBALS['images']   = get_post_meta($post->ID, 'images', true);
$GLOBALS['map']   = get_post_meta($post->ID, "map_location", true);
$GLOBALS['hits']   = get_post_meta($post->ID, "hits", true);

and add the following lines after that section:

// - Get the Package Level
$lf_packageID = get_post_meta($post->ID,"packageID",true); 
Further down, find the following code:
        <?php if(strlen($link) > 2){
        <a href="<?php echo $link; ?>" target="_blank" title="<?php the_title(); ?>" <?php if($GLOBALS['premiumpress']['nofollow'] =="yes"){ ?>rel="nofollow"<?php } ?>><?php echo SPEC($GLOBALS['_LANG']['_single1']) ?></a>
        <?php } ?>

And change it to:

        <?php if(strlen($link) > 2 and $lf_packageID != 1){  // - Exclude hot link from Level 1 ?>
        <a href="<?php echo $link; ?>" target="_blank" title="<?php the_title(); ?>" <?php if($GLOBALS['premiumpress']['nofollow'] =="yes"){ ?>rel="nofollow"<?php } ?>><?php echo SPEC($GLOBALS['_LANG']['_single1']) ?></a>
        <?php } ?>

Upload the file and it should work fine.

And if you are unfamiliar with Directory Press, you can check it out at . If you have some background in programming, it is a great base for your own directory development.

Good luck,

If you need more assistance, contact

18 Responses to Directory Press-Free Listings, Hide Website Button

  • Warren says:


    I checked my installation of Directory Press and it does not show the website link in search results. Let me know the Directory Press version you are using and the URL of your site. I will be glad to check it out.

    Thanks for visiting my blog…Warren

  • Ashley says:

    Hi Warren,

    My site is:
    My version is 6.2.2

    Hoping you can help!


  • Warren says:

    Try this: In wordpress admin,
    – Go to Directory Press>Display Settings>Search Tab
    – Set “Show Publisher Link” to NO

    Let me know if this fixes your problem.


  • Warren says:

    The white page after making php changes usually means you made a php code error. I usually restore it to the original and try again.


  • Vizag property says:

    Can it be implemented in RealtorPress 6.3.1 ?

    RealtorPress is not showing link for any package.

  • Jubal says:

    Hi Warren,
    Great tutorial, thanks. I want to do this same thing, but rather than hiding the link I want to hide images (screen capture, uploads, etc.) on free accounts. I assume I can do this with a change to your code. Any tips?

  • Warren says:

    @Jubal…Any feature that is in the content section can be toggled with the same code. My only tip would be to give it a try…after all, it is only code. Just make sure to save a copy of the original file before making your changes.

    That is one of the reasons that I avoid database modifications. That introduces a whole new level of complexity.

  • Yudhistira says:

    Thank you Warren

    Great tutorial! I’ve successfully installed the code on my website.

Leave a Reply

Your email address will not be published. Required fields are marked *