• Resolved pheonixgh

    (@pheonixgh)


    First of great plugin!
    I do have a slight complaint/feature-request though.
    Can you please make it possible to set “all” option defaults (weight, post types etc..).

    as i understand it the plugin will only cache the related results if all options in a request match the defaults (bar limit ofc), i can understand why this is and it is perfectly sensible.

    However if i wish to change the defaults, knowing that this will effect all general yarpp requests, i.e. to always include a custom post type or globaly adjust weighting, and still take advantage of the caching it should be possible.

    I had to resort to altering the ‘yarpp’ option directly to achieve this as it wasn’t possible to do it from the settings page.
    not ideal since i have to do it before every yarpp request to ensure it hasnt been overwritten by the settings page or via an update etc.

    i appreciate it would be tricky to make a settings page that would incorporate all options without making it very complicated for the general user but perhaps you could have it load defaults from a php file in your theme. ‘yarpp-defaults.php’ for example if it exists.

    oh and one other thing, i don’t know if its just me but i had issues with yarpp not loading the default stopword list because it checks to see if WPLANG is defined and my wp-conf contained
    define('WPLANG', '');
    which i believe is the default on a clean install, this results in no file being loaded as it is defined but as an empty string, removed the define and all worked as expected with the en_US list loaded.

    keep up the great work.

    http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/

Viewing 5 replies - 1 through 5 (of 5 total)
  • @pheonixgh: I’m a little confused by your post. Are you hoping to have a programmatic way to update the settings besides overwriting the yarpp option (which is strongly discouraged, by the way)? Or are you looking to access the Relatedness and Pool options? (These are hidden by default; find them in the “screen options”.)

    As for the stopword lists, yes, that’s a bug. Thanks! I just committed the change and it’ll be in the next release.

    Thread Starter pheonixgh

    (@pheonixgh)

    @mitcho: thanks for the response. Sorry if my post was confusing.

    yes i am looking for a programmatic way to alter some of the default options not available via the settings page, such that my yarpp results are still cached.

    I want to add an additional post type and change the weighting for all yarpp use throughout the site. these options are not fully configurable via the settings page.

    i know it is possible to achieve the correct results using an appropriate args array, but the results of these calls are not cached as the settings do not match the defaults.

    thus the only way i found to achieve this was merge my custom options with the ‘yarpp’ option prior to each function call.

    i am well aware that this is not advisable hence my post.
    a filter on the get_option() output which is also passed the $option param, within class-core.php would suffice, however this would/could then effectively contradict the settings page.

    glad i could help re the stopwords.

    I see what you’re saying now.

    How do you want to change the settings? You’re changing the weights in a way that the options screen doesn’t? (Fine-tuning your weights?) As for adding additional post types, this is possibly by adding yarpp_support to your custom post type and then including it via The Pool options (some info in the readme).

    In general, though, as you’re clearly comfortable doing some custom coding, I would suggest you use the yarpp_related() function and then create your own caching wrapper around the results. You could do this using a transient or postmeta or the object cache API, depending on your setup and what your purpose is. I think that’ll give you the best flexibility.

    Thread Starter pheonixgh

    (@pheonixgh)

    ahah i had overlooked the yarpp_support for custom post types, that solves that bit.
    Though would be great if this were available as a list of types with checkboxes. it may not always be possible or desirable to alter post type definitions.
    As for the weights i wanted to have three tiers for body,title and category whilst also requiring a category match, from what i can see, via the settings screen, making a taxonomy required will always set its weight to 1, and you can only really have 2 weights (1 and YARPP_EXTRA_WEIGHT).
    the ability to define numerical weights directly, with a numerical required value for each taxonomy, on the setting page would be more flexible.

    either way i have now achieved what i wanted by altering my weights as required via the yarpp_settings_save filter (much better than having to do it before each call).
    thus i can utilize your existing and elegant table caching system.
    thanks for all your assistance and a great plugin.

    I see. Indeed, what you’re trying to do is a little more hacking than is regularly supported. 😀 Glad you got things working. 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Yet Another Related Posts Plugin] Please make it possible to set "all" option def’ is closed to new replies.