Support » Plugin: Totally Booked » Templating files and paths

  • Resolved Hedley

    (@hedley)


    Greetings, Great plugin!

    I have a question about templating, as described in the advanced usage section of the plugin page. It indicates that I can create a copy of a plugin file within my active theme which will override the file in the plugin folder, providing I “keep the directory structure in the plugin”. The example provided is:

    THEME_PATH/plugins/totally-booked/loops/gallery.php

    However, the actual path for gallery.php in my plugins folder is:

    PLUGIN_PATH/totally-booked/templates/loops/gallery.php

    Is this simply a matter of the plugin directory structure having been updated since the Plugin page was written, or should I be eliminating the /templates/ portion of the path when re-creating it in my theme folder?

    Related to this: I am attempting to modify the layout of the content produced when the [tb_book id="95"] is used within a page (specifically, I wish to move the “Buy Now” button to make better use of the content area). Am I correct that it is the /loops/single_book.php that I should edit?

    Thanks!

    HB

    https://wordpress.org/plugins/totally-booked/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Ben Casey

    (@casben79)

    Hi Hedley

    Thank you for your question.

    There are 2 things to discuss here:

    1) Template path: The plugin looks in the plugins/totally-booked directory in your theme then in the templates directory in the plugin files. The correct path would be THEMEPATH/plugins/totally-booked/loops/single_book.php Bear in mind that this will also affect the single page output of the books. This brings me to point number 2.

    2) You can override the file used by the shortcode using a filter.

    function mytheme_filter_totallybooked_shortcode_include( $path ){
        return 'loops/single_book_shortcode';
    }
    add_filter( 'tb_book_shortcode_template_part', 'mytheme_filter_totallybooked_shortcode_include', 10, 1 );

    This will look for the file at the path THEMEPATH/plugins/totally-booked/loops/single_book_shortcode.php for the output of the shortcode only.

    Let me know if you have any more questions or problems.

    Cheers
    Ben

    That’s great, I’ll give the override a try.

    Thanks for the quick and thorough response!

    H.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Templating files and paths’ is closed to new replies.