Support » Plugin: Sermon Manager » /views Template Files Very Different to Core Plugin

  • Resolved jodamo5

    (@jodamo5)


    I’ve found that the templates in the /views folder display significantly differently to the core plugin.

    I wanted to make some changes to the template, so followed the instructions and copied single-wpfc_sermon.php into the root folder of my theme. However the whole layout of the page changed. The container was no longer centered on the screen, and the sidebar ended up below the content.

    While investigating I noticed the option to turn on “Enable template files found in the /views folder”. I removed the template file from my theme and turned this option on to test it and the same broken layout occurred.

    I like the theory of being able to copy the /views template file into our own theme to customise the look of the page … but I was expecting it to look just the same except for the changes I wanted to make. But instead I spent a couple of hours working out what was going wrong and making adjustments to get the template from the /views folder displaying the same as the core plugin.

    Is this expected behaviour?

    Because the option is there, it sounds like the /views templates are used to backwards integration with older versions. But could additional templates be provided that match the core of the plugin? That would make modifying layouts a lot easier.

    Or did I miss something?
    thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Nikola

    (@nikolam)

    Hi,

    Template files that are located in /views directory are, like you guessed, primarily for backwards integration. They were added a long time ago, and like you saw – they don’t work nicely with modern themes.

    For that reason, we will soon do an overhaul of templating engine (it’s very high on the priority list), which will allow much better customization.

    But, you can still use /views templates with modern themes, if you use the same “initial layout” as your theme does.

    For example:

    1. Open your theme’s /archive.php and copy its contents to a first new file (will be referred to as “first file”) in some text editor (Notepad or Notepad++ is enough for this)
    2. Then open /views/archive-wpfc_sermon.php and copy its contents to a second new file (will be referred to as “second file”)
    3. Remove The Loop code from first file
    4. Copy The Loop code from second file to the first file where The Loop would be located (The Loop starts at line 29 in Sermon Manager)
    5. “Save As…” the first file as /archive-wpfc_sermon.php in your theme’s directory

    This should fix the visual issues in 99% of cases.
    You can do the same thing for other files (single-wpfc_sermon.php, etc)

    But if it doesn’t fix them…

    You can edit the individual sermon layout on the archive page by hooking into wpfc_sermon_excerpt filter and returning the HTML that you want. (docs)

    Note: You won’t be able to use the filter unless you have latest development version (since it was added during the writing of this comment).

    To install the development version, do the following:

    • Download from here
    • Deactivate & delete existing Sermon Manager plugin
    • Install & activate the downloaded zip file

    Note: No data will be lost and you will get the future updates in normally.

    Let us know how you go and if you need any further help. 🙂

    Thanks for the thorough reply and explanation. That’s really good.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘/views Template Files Very Different to Core Plugin’ is closed to new replies.