Support » Plugin: WP Tiles » Add More Bylines

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Mike Martel

    (@mike_cowobo)

    Hi Philip,

    Cool idea to put WP Tiles in a sidebar for a concert calendar.

    Currently, there is no way to directly filter the byline (this has been on the wish list for a long time.. I should really make some time for a plugin rewrite!). What you can do is filter over the tile data and set the byline per tile using the wp-tiles-data filter.

    For example:

    add_filter( 'wp-tiles-data', function( $data ){
        foreach( $data as &$tile ) {
            $venue = get_post_meta( $data['ID'], 'the_venue', true );
            $price = get_post_meta( $data['ID'], 'the_price', true );
            $tile['byline'] .= "<br />$venue<br />$price";
        }
        return $data;
    } );

    (untested code! And, obviously, replace the $venue and $price vars by your actual venue and price)

    Also, see this thread for inspiration.

    Thread Starter PhilipHastings

    (@philiphastings)

    Thanks for the reply.

    Actually, I’m just trying to add more content to the byline and display the date and artist and when the user hovers over the tile it displays the venue and ticket price.

    I like you’re example – I’ve have a whack at it and let you know how it works out.

    Keep up the great work!

    Plugin Author Mike Martel

    (@mike_cowobo)

    Hi Philip, quick thought: you can also show the excerpt in the byline. You can also change the excerpt for each concert post to contain venue/price, or filter the excerpt.

    Thread Starter PhilipHastings

    (@philiphastings)

    yeah – the example was a bust, I’m sure I was missing something. I used the excerpt as a plan b but I need to pull some of that content from custom fields – so it’s a big compromise.

    it would be great if there was a way to add additional bylines through the settings – similar to the way that layouts are being added.

    Check the box to activate an additional line, give that line a name, enter your content.

    It’d be perfect if it supported custom post types too.

    I’m actually working on another project that doesn’t have such a tight deadline and I’d like to use wp-tiles for that as well. If I come up with something – do you mind if I share that with you?

    Plugin Author Mike Martel

    (@mike_cowobo)

    Hi Philip,

    What you could do is use a plugin like Custom Fields Shortcodes to display the custom fields in your excerpt.

    Good idea to add bylines through the settings page.. overall this plugin is long overdue an overhaul for the settings page!

    The plugin does support custom post types if you pass post_type=your_cpt in the posts_query parameter.

    Let me know what you come up with for your project with WP Tiles! Find me here, or email me at mike [at] trenvo.com.

    Cheers,
    Mike

    Thread Starter PhilipHastings

    (@philiphastings)

    Great idea – and perhaps I’m doing something wrong – but that didn’t work at all.

    I’m gonna have to talk the client off the roof and ask that they settle for this. Maybe we can address adding more content at a later time when there’s some flexibility when handling content.

    Maybe I’m old school – I like the idea of adding content without having to touch the code.

    Thread Starter PhilipHastings

    (@philiphastings)

    So – I was able to display the excerpt successfully and despite the fact that it’s an awkward workflow, it was working great – until it stopped working. I toggled the excerpt display on and off several times, even uninstalled and reinstalled the plug-in but the plug-in no longer displays the excerpt.

    If only there was an easy way to add custom fields to the byline this plug-in would be amazing.

    Plugin Author Mike Martel

    (@mike_cowobo)

    Hi Philip,

    What else changed when the excerpt started disappearing? Did you started adding things to the excerpt metabox in posts, or did you activate a new plugin? WP Tiles creates (or gets) an excerpt in exactly the same way WP does natively, so something must have thrown it off the tracks.

    What you could do is experiment with plugin combinations: make a vanilla WP install with all the plugins of your current site and activate them all. If WP Tiles is not showing the excerpt, disable everything and activate them one by one until the problem re-occurs.

    Let me know if you find any more clues!

    Mike

    Thread Starter PhilipHastings

    (@philiphastings)

    I actually pulled together a few of my developer friends over the weekend to give me their assessment of why the excerpt stopped working and how to add custom post types to the tiles. There was over 20 years of PHP development experience huddled around a breakfast table for two and a half hours. Here’s what we discovered.

    Not only did we not come up with a viable reason for the excerpt to simply stop working, or default to excerpt (we turned off plug-ins, reinstalled WP-Tiles, etc etc) – we were unable to even manipulate the existing content – such as post title and post date by commenting out any lines of code where ‘title’ or ‘date’ appeared.

    The consensus was great plug-in but falls short in the understanding that WP is a content-oriented platform designed to simplify the end-users experience of managing that content. This plug-in adds a great deal of functionality to WP but seems to ignore what is at the core of WordPress. Add to that that a group of developers couldn’t wrap their heads around what’s happening in the code in an effort to simplify the end-user experience.

    I’ve actually pitched using this plug-in at my day job (HP) for one of our internal sites but I’m thinking I’ll have to ask one of developers to build something similar that allows end-users to add content – or at the very least – for developers to add content.

    Plugin Author Mike Martel

    (@mike_cowobo)

    Hi Philip,

    Thanks for your open criticism. I’m sorry to hear that you weren’t able to fix the problem. More on that at the end of this post!

    I agree that the plugin currently falls short in user-friendliness and flexibility and on the (long and slow-going) road to 1.0 I hope to improve on the admin side of things enormously. I do think the plugin currently does what it says on the box: show a selection of posts on tiles. The ‘fully customizable’ in the tagline was a bit of an overstatement, but refers to the query and the tile templates, and not contents of the byline.

    As for the nature of the WordPress beast, you’re right in saying that WP is

    a content-oriented platform designed to simplify the end-users experience of managing that content

    However, this does not mean that every plugin should be able to do everything with every bit of content. It should: work out of the box (check), be designed for the majority (check, I think) and consider the user before adding extra options – ‘decisions, not options’ (check, I think). (Paraphrased from the WordPress philosophy) The main shortcoming then is extensibility for developers. There’s quite a few filters and pluggable functions that should make the modifying of every tile in any way possible (see the workaround in my second reply), but I would (and will) add more in the future.

    Making the byline filterable has been on the to-do list for a long time, I’ll push through that one-line change now.

    If you get your developer group of friends together over breakfast again (though there are more interesting topics 😉 ), here are a few pointers:

    1. The tile data is extracted from the queried posts in WP_Tiles::extract_data, and made ready to be passed to the Javascript. This is all very straight forward – it takes a list of posts and plucks out only the data that it needs and formats it where necessary. Play around with the data array in line 305-315 to hardcode some changes – you’ll see that the title, byline, link, etc. will change.

    2. The actual template of the Tiles is rendered in the JS. Look in the unminified wp-tiles.js line 44-59, and you’ll see how the byline is generated. Make sure that when you play with this file, SCRIPT_DEBUG is enabled – otherwise you won’t see any changes.

    Lastly, as for your problem: you can look at the solution in my second reply – it’s still sound. Alternatively, I’m adding the extra filter ‘wp-tiles-byline’ (in version 0.5.9, uploading now) that you can use to fill in the byline yourself entirely. Eg.:

    add_filter( 'wp-tiles-byline', 'my_tile_byline_filter' );
    function my_tile_byline_filter( $byline, $post ) {
        $byline .= my_get_the_venue_function( $post->ID );
        return $byline;
    }

    I’m happy to delve further into your site to help you find a way to fix this 🙂

    Cheers,
    Mike

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Add More Bylines’ is closed to new replies.