Display a list of related entries on your site and feeds based on a unique algorithm. Now with thumbnail support built-in!
To make YARPP support your custom post type, the attribute
yarpp_support must be set to true on the custom post type when it is registered. It will then be available on options on the YARPP settings page.
If you would like to programmatically control which post types are considered in an automatically-displayed related posts display, use the
Developers can call YARPP's powerful relatedness algorithm from anywhere in their own code. Some examples and more details are in my slides from my WordCamp Birmingham talk.
yarpp_related(array( // Pool options: these determine the "pool" of entities which are considered 'post_type' => array('post', 'page', ...), 'show_pass_post' => false, // show password-protected posts 'past_only' => false, // show only posts which were published before the reference post 'exclude' => array(), // a list of term_taxonomy_ids. entities with any of these terms will be excluded from consideration. 'recent' => false, // to limit to entries published recently, set to something like '15 day', '20 week', or '12 month'. // Relatedness options: these determine how "relatedness" is computed // Weights are used to construct the "match score" between candidates and the reference post 'weight' => array( 'body' => 1, 'title' => 2, // larger weights mean this criteria will be weighted more heavily 'tax' => array( 'post_tag' => 1, ... // put any taxonomies you want to consider here with their weights ) ), // Specify taxonomies and a number here to require that a certain number be shared: 'require_tax' => array( 'post_tag' => 1 // for example, this requires all results to have at least one 'post_tag' in common. ), // The threshold which must be met by the "match score" 'threshold' => 5, // Display options: 'template' => , // either the name of a file in your active theme or the boolean false to use the builtin template 'limit' => 5, // maximum number of results 'order' => 'score DESC' ), $reference_ID, // second argument: (optional) the post ID. If not included, it will use the current post. true); // third argument: (optional) true to echo the HTML block; false to return it
Options which are not specified will default to those specified in the YARPP settings page. Additionally, if you are using the builtin template rather than specifying a custom template file in
template, the following arguments can be used to override the various parts of the builtin template:
If you need to use related entries programmatically or to know whether they exist, you can use the functions
yarpp_get_related($args, $reference_ID) and
yarpp_get_related returns an array of
post objects, just like the WordPress function
yarpp_related_exist returns a boolean for whether any such related entries exist. For each function,
$args takes the same arguments as those shown for
yarpp_related above, except for the various display and template options.
Note that custom YARPP queries using the functions mentioned here are not cached in the built-in YARPP caching system. Thus, if you notice any performance hits, you may need to write your own code to cache the results.
Any taxonomy, including custom taxonomies, may be specified in the
require_tax arguments in a custom display as above.
term_taxonomy_ids specified in the
exclude argument may be of any taxonomy.
If you would like to choose custom taxonomies to choose in the YARPP settings UI, either to exclude certain terms or to consider them in the relatedness formula via the UI, the taxonomy must (a) have either the
yarpp_support attribute set to true and (b) must apply to either the post types
page or both.
YARPP is currently localized in the following languages:
ar_EG) by Bishoy Antoun of cdmazika.com.
ar) by led
by_BY) by Fat Cow
bg_BG) by Flash Gallery
zh_CN) by Jor Wang of jorwang.com
zh_TW) by Pseric
hr) by GoCroatia.com
cs_CZ) by Zdenek Hejl
nl_NL) by Sybrand van der Werf
est_EST) by JOURNAL
fa_IR) by Moshen Derakhshan
fr_FR) by Lionel Chollet
ge_KA) by Kasia Ciszewski of Find My Hosting
de_DE) by Michael Kalina of 3th.be and Nils Armgart of movie-blog.de.ms
el_CY) by Aristidis Tonikidis of akouseto.gr
el_EL) by Aristidis Tonikidis of akouseto.gr
gu_IN) by Vikas Arora
he_IL) by Mickey Zelansky of simpleidea.us and Hadas Kotek
hi_IN) by Outshine Solutions
it_IT) by Gianni Diurno of gidibao.net
gb_IR) by Ray Gren
id_ID) by Hendry Lee of Kelayang
ja) by myself
kk_KZ) by DachaDecor
ko_KR) by Jong-In Kim
lv_LV) by Mike
lt_LT) by Karolis Vyčius and Mantas Malcius
nb_NO) by Tom Arne Sundtjønn
pl_PL) by Perfecta
pt_PT) by Stefan Mueller of fernstadium-net
pt_BR) by Rafael Fischmann of macmagazine.br
ro_RO) by Uhren Shop
ru_RU) by Marat Latypov of
Requires: 3.3 or higher
Compatible up to: 3.6
Last Updated: 2013-4-15
43 of 70 support threads in the last two months have been resolved.
Got something to say? Need help?