Author Archives: wayne123

The #1 Directory Theme for WordPress: Vantage

/ by

Many of us use a simple theme for our website and then go through the tedious process of finding plugins suitable for our sites to function correctly. If you are operating a directory site or plan to, why not choose the Vantage AppTheme.

AppThemes come with a base theme and plugins that enable you to monetize your website. Each AppTheme comes with a unique appearance and  all the required features and functionality to run a specific site.

In this post we will explain why many people are choosing to use the Vantage AppTheme for their directory website.

Pricing of Vantage

This AppTheme is currently priced at $69.00 for a standard site. This will give users a lifetime license, 12 months of support and 12 months of updates. This gives you a feature rich AppTheme that gives you the freedom to create a stand out directory listing site.

vantage-apptheme

When to Use Vantage

Once you download and activate Vantage, all the basic tools to build a directory listing website will be available to you. Thousands of customers use Vantage to run their directory sites. Some of these include tourist, event, landmark, local and business directories.

Valuable Features that Come with Vantage

Responsive Design

Vantage is a fully responsive theme meaning that your site will be scaled perfectly on all devices. There is nothing worse than trying to view a non-responsive website on a mobile device.

Freedom of Pricing Plans- Monetizing Your Website

You can create pricing plans immediately after downloading this AppTheme. This includes offer pricing plans that include featuring customers listings on the homepage or on the listings page. This theme allows you to be in complete control of how you monetize your website. Generate a stable and reliable income by using the Vantage AppTheme.

  • You can choose to charge additional fees for certain categories (for example, you may wish to limit the fees associated with non-for-profit business listings)
  • You may choose to limit the charge associated with listings and focus on ad revenue and affiliate offers
  • Creating multiple pricing plans allows the business owners to decide how much they would like to invest in their listing

Accessibility to Search for Listings

Vantage allows your customers to easily browse your directory listings through the search bar tool, by specific category or business location. All your listings can be geo-located enabling them to be search by exact location and distance from.

Create Listings & Allow Them to Be Claimed

Vantage has a useful feature that allows admin to create listings and then allow them to be claimed by business owners. For example, as admin I create a listing for Tom’s Burgers. The owner of this business then views this listing and decides he would like to promote it further himself. He is able to pay for this listing and have complete control of the information, images and comments displayed. This feature allows you to start your directory listing site immediately without the need for businesses to contact you first.

Listings Created by Business Owners

Listings can be created on the front-end of your website by business owners. They can choose the pricing plan that suits their needs. Business owners simply fill out a form on the front end (which you can customize) with all their business directory details. Admin can then configure the settings so that it must be approved before going live on the site. You can create multiple forms on the back end of your site that are specific to different business directory listings.

Easily Manage Listings

The user dashboard becomes the heart of your website. From the dashboard you are able to view the sites listings, edit profiles, manage favourites and see reviews that people have left.

claim-listings

Endless Customization

Vantage can be customized to suit all directory websites both large and small. The custom form builder and custom fields allow you the flexibility to design an array of directory listing site.

Child Themes

Another advantage of choosing Vantage as the basis of your website is that you can change the entire appearance by using a child theme.

Option to Accept Reviews and Ratings

When you use Vantage, you can decide if you would like visitors to be able to leave reviews and ratings for listings on your site. This can work in your favor as it allows people to have their say and creates a community of discussion around your website.

More Reasons Vantage is the #1 used Theme for Directory Websites

  • Advanced search options
  • Option to receive recurring payments
  • Google maps integration
  • Separate blog page
  • SEO friendly
  • Multi-language support
  • 2 payment gateways available on installation
  • 10 or more possible payment gateways available from the marketplace
  • Option to mass import listings

accuracy-search

In Conclusion to the Vantage AppTheme

Vantage comes ready with everything you will need to set up your very own directory site. Vantage is a strong contender for the best directory theme for WordPress users.

If you are interested in finding out more about Vantage, you can find extensive information on the AppThemes Website.

vantage-apptheme

READ MORE


How to Add Google Analytics to WordPress

/ by

Adding Google Analytics to WordPress is a painless process. There are numerous ways to do it. Today, we will follow some simple steps to get it added.

There is a plugin in the WordPress Plugin Repository that allows us to not only add the Google Analytics code, but load it in such a way that passes the Google PageSpeed Insights test.

By default, the Google Analytic’s script has a low 2 hour cache time set, which ironically triggers a flag in Google PageSpeed Insights.

The aforementioned plugin will let you add your Tracking ID, load the tracking code in the footer, and also load the script locally.

Loading the script locally bypasses the 2 hour cache limitation, removing the flag set by Google’s Page Speed test.

There is one caveat however, and that is that Google doesn’t support the local storage of the script.

The reason Google does not prefer the local serving of the script, is because it can quickly become out of date when upgrades occur.

However, the plugin that stores it, also leverages WP Cron to auto-update the script, so that concern becomes moot.

In this tutorial, you will learn:

  • How to add your site to Google Analytics.
  • How to connect Google Analytics with Google Search Console (assuming you have already added your site to Google Search Console).
  • How to add Google Analytics to WordPress.

Resources mentioned in the tutorial:

Before you move on:

  • Make sure that you have a Google Account. Having a Gmail email address or YouTube account qualifies.
  • Make sure that you have already added your web site to Google’s Search Console. This process is covered in the video, but not below in the written instructions.

How to add your site to Google Analytics.

  1. Point your web browser to: google.com/analytics
  2. Click Sign In at the top right, then click Analytics. If prompted, login with your main Google Account.
  3. Click the Sign Up button.
  4. Type in an Account Name similar to the name of your web site.
  5. Type in your Website Name.
  6. Choose the protocol for your web site: http or https
  7. Paste in your Website URL.
  8. Choose an Industry Category that best matches what your site is about.
  9. Change the Reporting Time Zone to match your local time.
  10. Specify any Data Sharing Settings you are interested in. Read about them to see if they matter to you.
  11. Click the Get Tracking ID button.
  12. When prompted to accept the Terms of Service, choose your country, read the Terms, and if you accept, click the I Accept button.
  13. Copy your Tracking ID for later use.

Assuming you have already setup your web site within the Google Search Console, let’s move on to the next steps.

How to connect Google Analytics with Google Search Console.

  1. Click on Property Settings on the left side.
  2. Scroll down, and click the Adjust Search Console button, then scroll back up.
  3. Click the Edit link.
  4. Choose the preferred version of your site (with or without https, with or without www), then click the Save button.
  5. You will now land in the Search Console. You can close that window to go back to Analytics.
  6. Click the Done button. Refreshing the page will show the connection between Analytics and Search Console.

Now, with your Analytics Tracking ID handy, let’s go back to your WordPress Dashboard.

If you haven’t yet copied the Tracking ID, you can click the Tracking Info, then Tracking Code link in the Analytics Dashboard to get it.

How to add Google Analytics to WordPress.

  1. From within your WordPress Dashboard, click Plugins, then Add New.
  2. Do a search for: Complete Analytics Optimization Suite
  3. Click Install Now, then Activate.
  4. Click Settings, then Optimize Analytics.
  5. Paste in your Tracking ID in the top box.
  6. Choose Footer for the location, unless you have a specific reason to choose Header.
  7. Select Anonymize IP if applicable.
  8. Click the Save Changes button.

To test placement, you can either:

  • Wait for Google Analytics to start reporting data. Visit your Google Analytics Dashboard to see. You can also have GA send test traffic.
  • Or, enable the ‘Track logged in Administrators’ feature in the Complete Analytics Optimization Suite, then visit your site, right-click and View Source, then do a Find for your Tracking ID.

READ MORE

How to Remove Powered by WordPress from Your Web Site Footer

/ by

If you are interested in removing the “Powered by WordPress” credit from the footer of your web site, this tutorial will go through the steps on how to do that.

In this tutorial, you will be introduced to:

  • How to remove or edit the credit link from your theme’s template files
  • How to locate the CSS ID or Class for the footer credit link
  • How to use Custom CSS to hide the footer credit link
  • Why using Custom CSS is a preferred solution

First, let’s see how to edit template files. You may not want to actually perform these steps however, as the more preferred solution will be demonstrated below. I am just including this section for completeness.

  1. From within your WordPress Dashboard, go to Appearance, then Editor.
  2. From the right side, locate the Template Footer or footer.php file, and click on it.
  3. Search for the code that displays the footer credit link. This could differ depending on the theme. In the theme in the demonstration, Twenty Seventeen, it does a call to a different file, which is accessible by FTP. It uses the WordPress function get_template_part to call the other file.
  4. You can do what is called “commenting out” the function to prevent it from calling the other file. To do that, put 2 slashes just before the get_template_part function, and click the Update File button.
  5. Now, check the web site to see that the footer credit link has been removed.

For reasons discussed in the final section, you may want to undo the steps performed above, and use the approach demonstrated next.

Before we remove the link with CSS, let’s first see what CSS container it is in. I am using Google Chrome to perform these steps. The steps will differ for other web browsers.

  1. First, view the front end of your web site in your web browser.
  2. Next, scroll down to the footer credit section.
  3. Right click on the credit link, and click Inspect.
  4. Look for the most immediate HTML container that is enclosing the footer credit. This could be a div, span or other tag. In the theme in the demonstration, Twenty Seventeen, a div tag is being used.
  5. Check whether the CSS that styles this container is a class or an ID. In the demo, a CSS class is being used.
  6. Make note of the name of the class or ID. In the demo, the class name is site-info.

Now, let’s add some Custom CSS to hide the footer credit from the web site.

Since version 4.7 of WordPress, a Custom CSS tool has been added to the Theme Customizer. Prior to that, JetPack, a Child Theme, or a 3rd party solution could have been used.

We will use the Theme Customizer to edit the CSS.

  1. From within your WordPress Dashboard, go to Appearance, then Customize.
  2. Click on Additional CSS.
  3. Put your cursor on a new empty line.
  4. If your theme is using a class for the footer credit container, start with a period or dot. If the theme is using an ID, start with a hashtag or pound symbol. Then type the name of the class or ID, then press the spacebar and open a squiggly bracket.
  5. Now type: display, a colon, none, a space, an exclamation mark immediately followed by the word important, immediately followed by a semicolon.
  6. Add in a space, then close the squiggly brackets.
  7. Check the Live Preview tool on the right side.
  8. If the desired result is achieved, click the Save & Publish button near the top left.

Using Custom CSS in this way is definitely the preferred choice.

It used to be, and by some still, suggested to modify the core theme files directly.

Well, this has the same implications as editing core plugin and WordPress core files.

Any time the core files are updated, then you will need to manually apply your changes again. This can become a maintenance burden before long.

Another choice is to avoid updating the core files, but then you would miss out on feature updates, as well as important security and bug fixes.

In the past, creating a Child Theme may have been a good choice. In general though, a Child Theme only had value when wanting to edit the CSS, and in some cases for adding custom functionality.

Using a Child Theme to override core template files, such as overriding footer.php, inherited some of the same concerns as editing the core files of the Parent Theme.

Also, unless the custom functions are very specific to the theme, it’s often better to create a custom plugin instead when needing to add custom functions.

At any rate, because JetPack, and now WordPress since version 4.7, offers native support for adding custom CSS, this is certainly the preferred route for the reasons discussed above. Plus, it’s a lot simpler.

With that said, I hope that you reconsider hiding the WordPress footer credit, and perhaps use this education for different types of customization you would like to perform to your theme 🙂

READ MORE

How to Create a Custom Post Type for Affiliate Links

/ by

Depending on the type of web site that you are creating, and the desired content structure, it’s sometimes very powerful to create custom post types with custom fields.

Some of the time, you may want 100% control over the fields for your custom post type.

At a minimum, you may want to keep the post title, although you actually don’t have to.

Keeping the title is handy though for when viewing the content within the Admin and for generating a default post slug.

The title doesn’t actually have to be used on the front end if it’s not needed.

Let’s explore creating a custom post type for affiliate links, which can be expanded on at anytime.

Today, you will simply create an interface to store the affiliate URL, give it a name for easy reference, and to keep track of how many times the affiliate URL was visited.

Upon visiting the domain-branded & friendlier custom post URL, as opposed to the ugly affiliate URL, the counter will increment by one, and the browser will redirect to the affiliate URL.

Future upgrades for this application can involve creating country specific versions for each affiliate link, and redirecting to the appropriate URL based on the country of the visitor. This feature is handy if you are an Amazon affiliate.

Also, it can be expanded upon to pass data to the Custom Post, which can then pass the data along dynamically within the affiliate URL for tracking purposes.

Beyond that, for cleaner admin management, you can use the Admin Columns plugin so that you can display the Custom Post URL and Click Count in the Custom Posts list.

That way, it’s quicker to grab the Custom Post’s URL whenever you want to use the affiliate link, as it will be available at a glance instead of having to go into the Editor for the custom post, or having to get it from the View Link.

In this tutorial, you will be introduced to:

  • How to create a custom post type for affiliate links.
  • How to add custom fields to the custom post type for the affiliate URL, and for a click counter.
  • How to create a custom plugin to handle the incrementing of the click counter, and for redirecting the visitor to the affiliate URL.

Let’s create the custom post type now.

  1. From within your WordPress Dashboard, click on Plugins, then Add New.
  2. Do a search for ‘Custom Post Type UI’.
  3. Click Install Now, then Activate.
  4. Under the newly created CPT UI menu, click on Add Post Type.
  5. Enter affiliate_links for the Post Type Slug.
  6. Enter Affiliate Links for the Plural Label.
  7. Enter Affiliate Link for the Singular Label.
  8. Scroll down to Settings, and change Public to False.
  9. Change Show in Nav Menus to False.
  10. Change Exclude From Search to True.
  11. Remove Editor and Featured Image from the Supports box.
  12. Finally, click the Add Post Type button.

You will now see on the left side, a new menu option called Affiliate Links.

If you have a peek inside the Add New screen for Affiliate Links, you will see that Title, Slug, Status, Visibility, and Publish Date are the only editable settings.

Let’s now add a field for the URL, and another for the counter.

Follow along below to add custom fields to the custom post type.

  1. From within your WordPress Dashboard, click on Plugins, then Add New.
  2. Do a search for ‘Advanced Custom Fields’.
  3. Click Install Now, then Activate.
  4. Click on the newly created Custom Fields menu.
  5. Click the Add New button.
  6. Give it a Title, such as: Affiliate Link Custom Fields.
  7. In the Location box, choose Post Type is equal to: affiliate_links
  8. In the Options box, choose Standard for Style.
  9. Go back up to the top, and click the Add Field button.
  10. In the Field Label box, type: Affiliate URL.
  11. Change the Field Name to: my_custom_affiliate_url or something similar, to keep it unique from custom fields used in other plugins and tools that may find their way into your WordPress site down the line. Please make note of the name you use because we will be referencing it within the plugin.
  12. Leave the Field Type as Text, as we lack the URL type in the Free version of Advanced Custom Fields.
  13. Change Required to Yes.
  14. Click the Close Field button.
  15. Click the Add Field button again.
  16. For Field Label put: Click Counter.
  17. Change the Field Name to: my_custom_click_counter or something similar, to keep it unique. Again, please make note of the name you use because we will be referencing it within the plugin.
  18. Change the Field Type to Number.
  19. Change the Default Value to the number zero.
  20. Click the Publish button on the right side of the screen.

Now, let’s create a new Affiliate Link that we can use for testing purposes after we create the plugin.

  1. From within your WordPress Dashboard, click on Affiliate Links, then Add New.
  2. Give the link a name. For testing, just enter: Amazon Home Page
  3. In the Affiliate URL box, enter: https://www.amazon.com/
  4. Click the Publish button.
  5. Click on Screen Options, put a check next to Slug if not already selected, and click Update on the post. That way, you can modify the URL from the default that was created based on the title, if desired.

Now, if you view this Affiliate Link Post right now, you will see that it simply displays a page on your site with the Title.

That’s not the desired effect however.

We want it to redirect to the affiliate URL, but not before silently incrementing the hit counter.

Let’s create a quick plugin to accomplish these tasks.

To follow along, please be sure that you have the Pluginception plugin installed, as that is the approach we will be using to create a new plugin.

The video above shows how to set it up.

Finally, with Pluginception ready, follow these steps to create your custom plugin:

  1. From within your WordPress Dashboard, go to Plugins, then Create a New Plugin.
  2. Give it a name such as: My Affiliate Link Redirect Plugin.
  3. Click the Create a Blank Plugin button.
  4. Copy in the code shown in the video or below these steps if you are following along within the written tutorial. Please make certain that you use the appropriate field names if you didn’t use the names I suggested in the previous steps.
  5. Click the Update File button.

To test your work, follow along with these quick steps:

  1. From within your WordPress Dashboard, click on Affiliate Links. On a side note, as you can see in this screen, using a tool like Admin Columns could be handy because it would allow you to add your custom fields and other fields such as the Post URL in the columns. Either way, you can right click the View link to get the Affiliate Link or Post URL to use whenever you want to display your affiliate link somewhere.
  2. Right click the View link, and click Open in a New Tab.
  3. Visit the Tab and you will see that it redirected to the Amazon.com home page as expected.
  4. Now, head back to your Affiliate Links list.
  5. Click on the Edit link for your Amazon test link, and see that the Click Counter is now a 1.

A few extra things worth mentioning here.

  • One, be sure to always use your Custom Post Type’s URL when wanting to link to your affiliate link. If you use your actual affiliate link, this whole process will have been for nothing. The Custom Post Type URL is more attractive, has your domain branded in it, and keeps track of clicks. And perhaps in the future, it can also geo-target and do other wonderful things.
  • Secondly, since these are affiliate links, be certain to nofollow them whenever used.
  • Also, keep in mind that these links technically can be used on other sites, not just the site you are managing them with. Do so only with permission of course.
  • Lastly, there is a rule that you must be transparent about the use of affiliate links. Be sure to look up the rules and requirements governing the use of affiliate links. There are general rules, and probably specific rules for the merchant you are an affiliate for. Please do your homework before using this new tool on your Live site.

Below is the code used in this tutorial:

function my_affiliate_link_redirect() {
  if( is_singular( 'affiliate_links' ) ) {
    $count = (int) get_field( 'my_custom_click_counter', get_the_id() );
    $count++;
    update_field( 'my_custom_click_counter', $count, get_the_id() );
    wp_redirect( get_field( 'my_custom_affiliate_url', get_the_id() ) );
    exit();
  }
}
add_action( 'template_redirect', 'my_affiliate_link_redirect' );

READ MORE

Add a Status Text Next to Your WordPress Post Title

/ by

In this tutorial I will show you how you can add a status text next to the post title based on a condition.

There are two different ways you can handle this:

  1. Show the status text dynamically when WordPress is rendering the post title.
  2. Update the post title text in the wp_posts database table using a cronjob.

For this tutorial we will show an “Expired” message before the post title if the post’s published date is older than 14 days. The same concept can be applied to do any kind of conditional check and update the post title accordingly.

Method #1) Dynamically Update the Post Title

We can use the “the_title” filter to modify the post title when it is being rendered.

The following code example shows how to do it (read the comment in the code for explanation):

add_filter('the_title', 'tthq_add_expired_status_to_title');
function tthq_add_expired_status_to_title($title) {
    //Check if this is a page or not
    if (is_page()){
        //We don't want to do it for pages.
        return $title;
    }
    //Check if this is an attachment
    if (is_attachment()){
        //is_single() can be true for attachment so it is good to check is_attachment()
        return $title;
    }    
    //Check if we are in the loop
    if (!in_the_loop()){
        return $title;
    }
    
    //Initialize the date objects
    $created = new DateTime(get_the_date('Y-m-d g:i:s'));
    $current = new DateTime(date('Y-m-d g:i:s'));

    //The date_diff objects
    $created_to_today = date_diff($created, $current);

    //Check if the post published date is older than 14 days.
    $has_expired = ($created_to_today && $created_to_today->days > 14 ) ? true : false;

    //Adds status text before the post title
    if($has_expired){
        //Modify the post title to add the expired message in there.
        $markup = 'Expired';
        $title = $markup . ' ' . $title;
    }

    //Return post title
    return $title;
}

You can also take it one step further by collecting a custom value in the post editor then using that value in the above code. This tutorial shows you how you can add a meta box in the post editor so you can save custom value for each of your posts.

Method #2) Update Post Title in the Database

You can create a small plugin that creates a “daily” or “weekly” cronjob for your site. When the cronjob is triggered, you can do your check then update the post title using the wp_update_post() function.

Below is an example of how you can schedule a daily cronjob when your custom plugin is activated:

function tthq_custom_plugin_activate() {
    wp_schedule_event(time(), 'daily', 'tthq_custom_daily_cron_event');
}
register_activation_hook(__FILE__, 'tthq_custom_plugin_activate');

You will then write code in the tthq_custom_daily_cron_event() function which will do the checks in a loop and update post title accordingly.

The following code block shows an example of how to update the post title in the wp_posts database table:

//Lets say we want to update the post title of post ID 20
$my_post = array(
    'ID' => 20,
    'post_title' => 'This is the UPDATED post title.',
);

//Update the post title in the database
wp_update_post( $my_post );

Check the WordPress codex page to learn more about the wp_update_post() function.

READ MORE




Simple Table of Contents (ToC) Using Pure HTML and CSS Code

/ by

For one of my blogs, I needed a simple and clean Table of Contents (ToC) implementation that uses pure HTML and CSS only (no plugins or JavaScripts). I can then manually add the ToC into any page where I want to show it. This method has the benefit of not having to load any JS files on every page of the site. More importantly, I don’t have to maintain any JavaScript code for it.

Most of the tutorials on this topic uses a solution that involves using JavaScript or a Plugin. In this tutorial I will explain how I created a simple table of contents that look like the following screenshot using only HTML and CSS. You should be able to copy and paste most of the code. However, you do have to understand CSS and HTML code a little to utilize this.

example-table-of-contents-created-using-html-css

The CSS Code for the ToC

Add the following CSS code in your theme’s stylesheet file. Alternatively, you can inject this CSS code using a custom CSS plugin like this one.

#toc_container {
    background: #f9f9f9 none repeat scroll 0 0;
    border: 1px solid #aaa;
    display: table;
    font-size: 95%;
    margin-bottom: 1em;
    padding: 20px;
    width: auto;
}

.toc_title {
    font-weight: 700;
    text-align: center;
}

#toc_container li, #toc_container ul, #toc_container ul li{
    list-style: outside none none !important;
}

The HTML Code for the ToC

Now that the CSS code is in place, you can use simple HTML code like the following example to create a ToC in any page.

You are basically making a list of links that are in the page.


Now, assign the “id” parameter in your heading tags to connect the links from the above list. The following example shows how you can assign an “id” to any heading tags in your page.

<h2 id="First_Point_Header">First Point Header</h2>

That should do it.

READ MORE