Forum Replies Created

Viewing 15 replies - 511 through 525 (of 571 total)
  • Plugin Author vicchi

    (@vicchi)

    Hi Bruce,

    Good to hear from you. I’ve been recently thinking about adding custom action and/or filter support to WP Biographia and this sounds like a feature request that needs an action or a filter if ever there was one ??

    My first thought was to add a custom filter that is called after WP Biographia renders the contact links to allow you to append your custom contact links to the contents of the wp-biographia-test div. But that method would mean that the caller has to have precise knowledge of how that div is structured and there’s a lot of scope for breaking the formatting of the Biography Box.

    So what I’m thinking is that instead, I add a custom filter that is called before WP Biographia renders the Biography Box and allows the caller to pass back an array of information about the custom links to be added. Using your pastebin example (which, by the way, is precisely how WP Biographia adds support for additional custom links), it would look something like this …

    $custom_links = array (
        'stumbleupon' => __('StumbleUpon'),
        'googleprofile' => __('Google Profile')
    );
    
    add_filter ('wp_biographia_custom_links', 'custom_links_handler');
    
    function custom_links_handler($links) {
        return array_merge ($links, $custom_links);
    }

    And then in the code for WP Biographia, before I start rendering the links, I call

    $new_links = apply_filters('wp_biographia_custom_links', $plugin_links);

    … and then iterate over the (potentially) modified version of $new_links which should contain the plugin’s supported links, plus your additional custom links.

    Of course, this is all off of the top of my head and I’ve not even tried to see if the above code snippets actually work or not, but it should give you an indication of what I’m thinking.

    So … does this sound like a valid approach to what you’re looking for? If so, then it should also be possible to add a similar approach to allow your new custom links to be controlled from within the plugin’s settings and options admin panel, but that’s stage 2 of the process I think.

    Let me know …

    -Gary

    Plugin Author vicchi

    (@vicchi)

    … and here’s an example “in the wild” thanks to Steve Krause at https://www.groovypost.com/staff/

    -Gary

    Plugin Author vicchi

    (@vicchi)

    Hi. What version of WordPress and of WP Biographia are you running? I’ve just put together a test page showing the short code running in author mode, which has the following code:

    Test markup page to show the WP Biographia short code running in user wildcard mode.
    <h3>Shortcode - No Overrides</h3>
    [wp_biographia author="*"]
    <h3>Shortcode - Prefix Override</h3>
    [wp_biographia author="*" prefix="About"]

    … you can see this running at https://test.vicchi.org/contributors/ … it should work regardless of whether you use WYSIWYG mode or HTML mode to put the page together.

    -Gary

    Plugin Author vicchi

    (@vicchi)

    So I’ve just got this working on my web site; take a look at the author archive template at https://github.com/vicchi/twentyten-vicchi/blob/master/author.php.

    Basically you need to queue the first post to get the current user details setup, then you can display the Biography Box via the shortcode, then you rewind the loop and process all the posts for that author.

    -Gary

    Plugin Author vicchi

    (@vicchi)

    The author name at the start of the Biography Box is styled by .wp-biographia-text h3 on line 49 of css/wp-biographia.css … (Firebug in Firefox and Web Inspector in Safari are good for this).

    -Gary

    Plugin Author vicchi

    (@vicchi)

    Hi. At the moment, not without a code change and a new release I’m afraid.

    I’ve also done some digging around on the web and the general consensus out there seems to be don’t use _target="_blank", but let the user make an informed decision (right-click/middle-click/ctrl-click and then either “open link in new tab” or “open link in new window”.

    Two comments I found in my search seemed to be particularly illuminating …

    Let me add, on the social engineering aspect, that people who browse with their UAs maximized may not realize they have a new instance of the browser. Now, for them, the back button is broken. Instead of clicking ‘back’, they just go somewhere else. You’ve lost them for sure. People know how to go back; let them do so.

    … and …

    TARGET was deprecated in STRICT for a reason, and using javascript to replicate something you shouldn’t be doing in the first place is just more /profanity/. The user wants the page to open in a new window, let them choose on their end via middle-click / control-click / right click-new window, and don’t shove it down their throat with target or scripting breaking normal navigation.

    Now to be fair, I’m using _target="_blank" in a few places on my web sites; I really should go and make them all consistent.

    I am of course open to suggestion … let’s throw it out to the users … should I add a configuration setting to allow the contact links (and the icon set in the next release) to either open in a new window or in the same window … is it overkill to add a configuration setting, save it to the database, and query that setting each time the Biography Box is rendered.

    /I’m not too sure either way to be honest …/

    -Gary

    -Gary

    Plugin Author vicchi

    (@vicchi)

    Ack. A typo … I missed out a single quote …

    echo implode(" ", array_splice($words, 0, $limit)).dots . do_shortcode('[wp_biographia mode="configured"]');

    .. as the_content and the_excerpt are fired once for each post in the loop what you’re seeing is expected, as you’ve asked for the Biography Box to be added to archive pages (which adds it to both single post archives and multiple post archives).

    If you only want a single Biography Box, there’s another workaround and that’s to disable the “display on archive pages” option, remove the call to smart_excerpt entirely from loop.php and add code along the lines of

    <?php echo do_shortcode (‘[wp_biographia user=”your-login-name”]’); ?php>

    .. outside of the WordPress loop. This will work if you have a single user blog. If you have a multi-user blog you’ll need to do some cleverness to output the Biography Box at the start of the loop (so it has the current author set up) and then set a flag after the first pass through the loop so it doesn’t repeat for each post.

    You’ll have to do some hacking around here; I haven’t been able to test this out, but in principle, it should work.

    -Gary

    Plugin Author vicchi

    (@vicchi)

    Hi Joel,

    So I’ve downloaded the theme you’re using and I’ve managed to reproduce exactly what you’re seeing. This is what’s happening …

    Browsing to https://techolatte.com/author/Joel causes the theme’s archive.php to be executed. This template file calls get_template_part('loop') which in turn executes loop.php. So far, so usual for most themes.

    *Most* themes either call the_content() or the_excerpt() to get the full post content or the post excerpt. Again, so far, so usual. WP Biographia works in both of these cases because it hooks into both the_content and the_excerpt filters and appends the Biography Box to either the full post content or the excerpt. If it’s an excerpt, then the Biography Box will either be appended to the explicit post excerpt, if one’s been written, or to the configured excerpt length, which defaults to 55 characters. So basically, providing the theme is using *standard* WordPress API calls and filters, WP Biographia should work in all cases.

    But here’s where it gets interesting and, to be honest, a bit non-standard …

    Firstly, the theme’s functions.php sets a new excerpt length of 200 characters (at line 718).

    Then the theme’s loop.php doesn’t call the_excerpt(); instead it does this at line 23…


    <div class="post-content">
    <?php if (function_exists('smart_excerpt')) smart_excerpt(get_the_excerpt(), 55); ?>
    </div>

    … and this is where it starts to get … different. Having already set the excerpt length to 200 characters, loop.php then calls a theme specific function, smart_excerpt, passing in the return from get_the_excerpt(), which will have the Biography Box appended *and* a new excerpt length of 55, which this time is for *words*, not for *characters* (which does sort of make sense as I think the theme’s designer wanted to ensure you actually *have* 55 words worth of excerpt).

    smart_excerpt then takes the first 55 words of the post excerpt (which will also strip off the Biography Box which has been already added) and display that as part of the archive.

    All of this is a very long winded way of saying that WP Biographia is working as it should do, and the problem lies with the theme and not with the plugin.

    There’s two relatively easy workarounds for this, but both involve hacking the theme’s template files.

    Workaround 1 is to remove the call to smart_excerpt entirely and rely on the WordPress excerpt handling mechanism, replacing this at line 23 of loop.php


    <div class="post-content">
    <?php if (function_exists('smart_excerpt')) smart_excerpt(get_the_excerpt(), 55); ?>
    </div>

    … with this …


    <div class="post-content">
    <?php the_excerpt(); ?>
    </div>

    Workaround 2 is to call WP Biographia *again* inside smart_excerpt to add the Biography Box, but *after* the post content had been trimmed to 55 words, changing line 732 of functions.php from this …

    echo implode(" ", array_splice($words, 0, $limit)).dots;

    … to this …

    echo implode(" ", array_splice($words, 0, $limit)).dots . do_shortcode('[wp_biographia mode="configured"]);

    … hope this is of help.

    -Gary

    Plugin Author vicchi

    (@vicchi)

    Ah … I see. That makes a bit more sense. So your theme defines a custom post type called “Static Content Block”. Hmm … If you deselect all options for this custom post type in the WP Biographia settings does this still happen? I’m wondering if your theme does something “clever” with this post type (unless you’ve created it yourself) which is bound up with the post footer. There should be a way around this without the need to hack the theme templates, I’m just not clear (yet) what that is.

    If you’re adding the shortcode to the theme template, the part of the WordPress core that “expands” shortcodes has probably already run by the time [wp_biographia] is being “seen”. The usual workaround to this is to use do_shortcode('[wp_biographia]'); from within a hook handler, but without seeing your theme’s code and structure it’s not easy to say which hook you should be using.

    It might be easier to either grant me temporary access to a test version of your site or to let me “borrow” a copy of the theme’s code to see what is actually happening here?

    -Gary

    Plugin Author vicchi

    (@vicchi)

    Hi,

    So I’ve had a look at the page that you’ve linked to but it’s not clear what’s happening.

    From digging in the source of that page it looks like you’re running the Salutation theme … as this is a premium/paid theme, that makes it difficult for me to see what’s going on in the background.

    I’m assuming that the fact that this template is running static blocks is causing this to happen. I tried to disable WP Biographia for static blocks, since it is an option on the settings page, but it is still doing it.

    … static blocks aren’t a feature of WP Biographia, is this part of the theme’s settings?

    From what I can see, the first of the Biography Boxes is being automatically added by WP Biographia, but the second Biography Box shouldn’t be unless it’s been manually added in via a shortcode; you mention this in your original post … is this what’s been done? The second Biography Box looks to be in the page footer, which WP Biographia won’t do unless there’s been some shortcode customisation done?

    If this is the case it would be helpful to see the site with no customisations/shortcode additions to see whether this is a customisation problem or an odd side effect of the theme plus WP Biographia.

    Also, I can see that the theme is flagged as being BuddyPress compatible … have you installed/configured BuddyPress?

    Sorry to reply with more questions; hopefully we’ll get to the bottom of this.

    Plugin Author vicchi

    (@vicchi)

    OK. Good. We’re talking about the same thing. So yes, this will be in the next release. I’ll get the code change written up for this at the weekend.

    -Gary

    Plugin Author vicchi

    (@vicchi)

    Hi,

    Glad you like the plugin!

    Do you mean the author name/link that appears at the top of the Biography Box?

    If so, then currently there’s no way to remove the link, but it’s a very trivial task to add a configuration option to do just this, something along the lines of “Include link to more posts in author name” … so that’s just what I’ll do. It’ll be in the next release of the plugin which is due in about a week or so.

    -Gary

    Plugin Author vicchi

    (@vicchi)

    Just to wrap this topic up … turns out that WebEndev and myself are talking about two differing types of post exclusions.

    The current version of WP Biographia is designed to exclude single posts by Post ID, in other words when the Single Post Template is being used and thus, the is_single() API call returns true. This type of exclusion is working as designed.

    What WebEndev is asking for is a global post exclusion facility that acts on all the other ways a post can be displayed, so that’s via the front page or via post archives.

    I’ll take this as a feature request and add this into the next release, which will be forthcoming in a few week’s time.

    -Gary

    Plugin Author vicchi

    (@vicchi)

    Credentials arrived safe and sound.

    -Gary

    Plugin Author vicchi

    (@vicchi)

    FTP or SCP, whichever is easiest for you to set up (and more importantly to take down afterwards!).

    -Gary

Viewing 15 replies - 511 through 525 (of 571 total)