Horje
Do you use custom post types and taxonomies? Do you want to list any related content, not just posts? Wordpress Tutorial

Noted That:

  • To install correctly this better-related.zip .
  • Fisrt Download the better-related.zip to your computer
  • Extract/Open better-related.zip to Your Computer.
  • Then, Find readme.txt file inside better-related.zip and Open readme.txt .
  • Now, Read the Requirements of this plugin. Which Wordpress Version and PHP Version are required to run this Plugin in Your Wordpress Site.
  • Then, Follow the Tips Below.

Start the Tips:

1. First Download " better-related.zip " Plugin to your Local Computer. (Click Download)

2. Then, Login to your " yourdomain.com/wp-admin " Dashboard.

/stack/wp/e1593231376d7d849d2-4597-4fa3-a6ff-1eca18f72aab.png

3. Then, Click on " Plugins " + " Add New " from left sidemenu of Dashboard.

/stack/wp/e1593231378Screenshot20.png

4. Now, Click on "Upload Plugin" button.

/stack/wp/e1593231380Screenshot-2019-4-2AddPluginsHorjeWordPress.png

 

5. Now, Browse " better-related.zip "  Downloaded plugin from your computer, Where you downloaded better-related.zip According to Step – 1 Above then, click on " Install Now"

/stack/wp/e15931461531577025694plugin.png

6. Now, Click on " Active Plugin"

/stack/wp/e15932313830ca45529-bf73-4101-8178-53ae60ce549f.png

7. Then, See left sidemenu. " Better Related Posts " folder is added on left sidemenu. Now, Click on " Better Related Posts " folder.

   Noted that: If you do not see " Better Related Posts " folder on left sidemenu then, see at left sidemenu " Settings " or " Tools ".

8. Now you configure yourself oR Watch video tutorial below about  Better Related Posts Configurtions and Settings or How to work " Better Related Posts " in your WordPress site.

 

oR

After Activated Plugin According to Step-6 then,

  1. Go to " Plugins " + " Installed Plugin " from Wordpress Admin Panel Leftside Menu.
  2. or Direct go to: https://yourdomain/wp-admin/plugins.php
  3. Then, Find " Better Related Posts " Activated Plugin from Plugin List.
  4. Then, Click on " Settings " from Plugin that is Better Related Posts
  5. Now, Edit/Add/Config the setting and Click on " Save Changes " button,
WP Plugin Setting



Guide

If you have a big site keep in mind that installing this plugin will create a fulltext index for your posts, so the size of the wp_posts table can almost double.

  1. Upload the plugin to your plugins directory
  2. Enable the plugin
  3. Enable automatic display of related posts

How to place a related content list manually

If you don’t enable automatic display of related posts on the plugin options page (the very first setting) you’ll have to use the template tag to insert a related content list into your theme. If you use this outside of the WordPress loop you have to pass the post ID as parameter.

How to build a custom loop of related posts

Here is a short example how to build your own loop of related posts. This way you can add excerpts, post thumbnails etc.



 $posts, 'posts_per_page' =>
 5, 'caller_get_posts' =>
 1 // ignore sticky status ); $my_query = new WP_Query( $args ); if ( $my_query->
have_posts() ) { while ( $my_query->
have_posts() ) { $my_query->
the_post(); echo '
'; the_title(); echo '
'; the_excerpt(); if ( has_post_thumbnail() ) { the_post_thumbnail( 'thumb' ); } echo '
'; } } else { echo "No posts found..."; } ?>

Please notice that the posts won’t be ordered by score if you build a loop like this. To accomplish this you’ll have to sort the posts in $my_query manually. I have a relevant example on how to sort posts manually on my site. I’ll build something like this into the plugin in the future.

How to evaluate different scoring methods

Logged in admins can get the results of all scoring methods by using the template tag in the loop of their theme. Example:




The scoring methods

Content to content, title to content and title do title are simple MySQL fulltext searches.

Keywords to content and keywords to title do a fulltext search for a string that contains all terms a post has. If a post is in the category Fruits and tagged sweet a fulltext search for “Fruits sweet” will be performed.

Terms against taxonomies searches for posts that have the same terms as the current one. By default only posts that use the same taxonomy are found. It is however as well possible to find posts that use a different taxonomy, by searching this other taxonomy for terms of the same name. See the examples below.

How to use different configurations at the same time

It is possible to use different configurations of the plugin at the same time. Let’s say you use the normal related content feature for your posts. But you also have a custom post type ‘venue’. To get a custom list of related venues use this:



 array( 'venue' =>
 true ), 'storage_id' =>
 'ventures-better-related-' )
);
?>

It is imporant to define a storage ID, or the plugin will overwrite the scores for the standard posts with the scores for your custom configuration. The default storage ID is ‘better-related-‘, so you should avoid that unless you changed the default.

To get a similar listing that includes related posts (from the built-in ‘post’ post type) use:



 array( 'post' =>
 true, 'venue' =>
 true ), 'maxresults' =>
 7, 'storage_id' =>
 'more-better-related-' )
);
?>

Now an example that shows off all configuration options available:



 array( 'post' =>
 true, 'venue' =>
 true ), 'usetax' =>
 array( 'drinks' =>
 true, 'food' =>
 true, 'post_tag' =>
 true, 'category' =>
 true ), 'do_c2c' =>
 1.5, 'do_t2c' =>
 2, 'do_k2c' =>
 2, 'do_t2t' =>
 1, 'do_k2t' =>
 2, 'do_x2x' =>
 4.3, 'minscore' =>
 25, 'maxresults' =>
 5, 'log' =>
 true, 'loglevel' =>
 'taxquery', 'storage_id' =>
 'better-related-full-example-', 'storage' =>
 'transient', 'cachetime' =>
 1, 'querylimit' =>
 10000, 'incremental' =>
 true, 't_querylimit' =>
 30000, 'relatedtitle' =>
 'Related venues and posts', 'relatednone' =>
 'No related venues or posts' )
);
?>

Notes:

  • Using the usetax parameter means that cross-taxonomy searches will be performed. It is not recommended to use this parameter at the moment, as it’s usage will probably change in the future. However, if different taxonomies share terms you can play with this parameter.
  • You should not log on live sites.
  • The high querylimit in this example could slow down your site.
  • The transient storage should only be used temporarily and for testing purposes.
  • Enabling incremental scoring means that the relatedness scores for posts will be calculated in multiple steps. In the example above up to 30000 related posts will be found and the necessary queries will be spread across three page views, assuming there is no cache.

Find posts related to a string

The template tag returns related posts for a string. The tag prints a list of posts related to a string. Usage:




I use this on 404 pages currently, see the paste for my dynamic WordPress 404 search form . In the future I will probably add a replacement for the built-in WordPress search to this plugin.

mysqld configuration

Generally speaking, the plugin should work out of the box. However, there are two settings you might want to change, see the mysql full-text fine-tuning docs .

ft_min_word_len controls the minumum length of words. This defaults to 4, which might be too small if you use acronyms like CSS, PHP etc. You can change or set that option to 3 in your mysqld config. You will have to re-build your fulltext indexes after doing this, use “REPAIR TABLE table_name QUICK;” where table_name is wp_posts on a default WordPress install.

The second option could be interesting if your site is not in english and you want to improve search results. Use the ft_stopword_file option to create your own stopwords file. MySQL uses english stopwords by default.


custom , post , types , taxonomies , list , related , content , posts , tutorial ,

Name

Read Article
https://develop.horje.com/learn/1434/reference