WordPress.org

Forums

Menubar
[resolved] Menubar-template in themefolder (4 posts)

  1. JustCarmen
    Member
    Posted 4 years ago #

    I made my own menubar template and stored it in wp-content/plugins/menubar-templates following the instructions.

    But I like to keep things together and I really want to put my custom menubar-template in my own themefolder.

    Because I make sites for different clients it's the most convenient way to maintain websites. I always know that all my modifications are stored in my own themefolder, but now I have an exception with the menubar-template and I am searching for a way to put it in my themefolder too.

    Anyone knows a solution?

    http://wordpress.org/extend/plugins/menubar/

  2. Andrea Tarantini
    Member
    Plugin Author

    Posted 4 years ago #

    Hello JustCarmen,

    Your suggestion is a very good one and I'll implement it in a future Menubar version.

    The patch to apply is very simple. Open wpm-main.php, locate the line

    $wpm_options->templates = 'menubar-templates';

    and replace it with

    // $wpm_options->templates = 'menubar-templates';
    $wpm_options->templates	= get_stylesheet_directory_uri ();

    Done!

  3. JustCarmen
    Member
    Posted 4 years ago #

    Thank you for putting me on the right track, but your solution didn't work because the created url was wrong. The plugin was searching the template in the theme directory as a subdirectory of the plugin directory.

    I took me some puzzling but I got it working by changing two other lines in wpm_main.php:

    Assume you put a folder in your themefolder that is named 'menubar-templates'

    Than you can leave the line "$wpm_options->templates = 'menubar-templates" as it is (you only have to change this if you change the folder name also).

    The two lines below has to be changed:

    1. Change this line:
    $wpm_options->templates_url = plugins_url ($wpm_options->templates);

    Into this line:
    $wpm_options->templates_url = get_stylesheet_directory_uri() . '/' . ($wpm_options->templates);

    2. Change this line:
    $wpm_options->templates_dir = WP_PLUGIN_DIR. '/'. $wpm_options->templates;

    Into this:
    $wpm_options->templates_dir = get_stylesheet_directory() . '/'. $wpm_options->templates;

    [Please post code snippets between backticks or use the code button.]

    In that case it is working in the backend as well as in the frontend of the site.

    And thank you for putting this option in the next version of menubar!

  4. Andrea Tarantini
    Member
    Plugin Author

    Posted 4 years ago #

    Thank you for your feedback. Sorry I didn't test my patch, but I'm glad you were able to move the templates anyway!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Menubar
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags