Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter squaredindex

    (@squaredindex)

    @riaanknoetze Will do, thank you.

    Thread Starter squaredindex

    (@squaredindex)

    That worked! Thank you so much! You’re a genius, I never would have figured that out. If I can rate your profile up or anything I will, thank you!

    Thread Starter squaredindex

    (@squaredindex)

    I’m a bit of a wp-noob, I’m not enterly sure where that is located in roots structure sorry.

    From what I can tells roots is a little different and puts that stuff under different lib folders.

    here are a few of the files that might be relevant:

    scripts.php

    <?php
    /**
     * Enqueue scripts and stylesheets
     *
     * Enqueue stylesheets in the following order:
     * 1. /theme/assets/css/bootstrap.css
     * 2. /theme/assets/css/app.css
     *
     * Enqueue scripts in the following order:
     * 1. jquery-1.10.2.min.js via Google CDN
     * 2. /theme/assets/js/vendor/modernizr-2.6.2.min.js
     * 3. /theme/assets/js/plugins.js (in footer)
     * 4. /theme/assets/js/main.js    (in footer)
     */
    function roots_scripts() {
      wp_enqueue_style('roots_bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.css', false, null);
      wp_enqueue_style('roots_app', get_template_directory_uri() . '/assets/css/app.css', false, null);
    
      // jQuery is loaded using the same method from HTML5 Boilerplate:
      // Grab Google CDN's latest jQuery with a protocol relative URL; fallback to local if offline
      // It's kept in the header instead of footer to avoid conflicts with plugins.
      if (!is_admin() && current_theme_supports('jquery-cdn')) {
        wp_deregister_script('jquery');
        wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js', false, null, false);
        add_filter('script_loader_src', 'roots_jquery_local_fallback', 10, 2);
      }
    
      if (is_single() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
      }
    
      wp_register_script('modernizr', get_template_directory_uri() . '/assets/js/vendor/modernizr-2.6.2.min.js', false, null, false);
      wp_register_script('roots_plugins', get_template_directory_uri() . '/assets/js/plugins.js', false, null, true);
      wp_register_script('roots_main', get_template_directory_uri() . '/assets/js/main.js', false, null, true);
      wp_enqueue_script('jquery');
      wp_enqueue_script('modernizr');
      wp_enqueue_script('roots_plugins');
      wp_enqueue_script('roots_main');
    }
    add_action('wp_enqueue_scripts', 'roots_scripts', 100);
    
    // http://wordpress.stackexchange.com/a/12450
    function roots_jquery_local_fallback($src, $handle) {
      static $add_jquery_fallback = false;
    
      if ($add_jquery_fallback) {
        echo '<script>window.jQuery || document.write(\'<script src="' . get_template_directory_uri() . '/assets/js/vendor/jquery-1.10.2.min.js"><\/script>\')</script>' . "\n";
        $add_jquery_fallback = false;
      }
    
      if ($handle === 'jquery') {
        $add_jquery_fallback = true;
      }
    
      return $src;
    }
    
    function roots_google_analytics() { ?>
    <script>
      (function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
      function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
      e=o.createElement(i);r=o.getElementsByTagName(i)[0];
      e.src='//www.google-analytics.com/analytics.js';
      r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
      ga('create','<?php echo GOOGLE_ANALYTICS_ID; ?>');ga('send','pageview');
    </script>
    
    <?php }
    if (GOOGLE_ANALYTICS_ID) {
      add_action('wp_footer', 'roots_google_analytics', 20);
    }

    relative-urls.php

    re<?php
    /**
     * Root relative URLs
     *
     * WordPress likes to use absolute URLs on everything - let's clean that up.
     * Inspired by http://www.456bereastreet.com/archive/201010/how_to_make_wordpress_urls_root_relative/
     *
     * You can enable/disable this feature in config.php:
     * current_theme_supports('root-relative-urls');
     *
     * @author Scott Walkinshaw <scott.walkinshaw@gmail.com>
     */
    function roots_root_relative_url($input) {
      preg_match('|https?://([^/]+)(/.*)|i', $input, $matches);
    
      if (isset($matches[1]) && isset($matches[2]) && $matches[1] === $_SERVER['SERVER_NAME']) {
        return wp_make_link_relative($input);
      } else {
        return $input;
      }
    }
    
    function roots_enable_root_relative_urls() {
      return !(is_admin() || in_array($GLOBALS['pagenow'], array('wp-login.php', 'wp-register.php'))) && current_theme_supports('root-relative-urls');
    }
    
    if (roots_enable_root_relative_urls()) {
      $root_rel_filters = array(
        'bloginfo_url',
        'the_permalink',
        'wp_list_pages',
        'wp_list_categories',
        'roots_wp_nav_menu_item',
        'the_content_more_link',
        'the_tags',
        'get_pagenum_link',
        'get_comment_link',
        'month_link',
        'day_link',
        'year_link',
        'tag_link',
        'the_author_posts_link',
        'script_loader_src',
        'style_loader_src'
      );
    
      add_filters($root_rel_filters, 'roots_root_relative_url');
    }

    rewrites.php

    <?php
    /**
     * URL rewriting
     *
     * Rewrites do not happen for multisite installations or child themes
     *
     * Rewrite:
     *   /wp-content/themes/themename/assets/css/ to /assets/css/
     *   /wp-content/themes/themename/assets/js/  to /assets/js/
     *   /wp-content/themes/themename/assets/img/ to /assets/img/
     *   /wp-content/plugins/                     to /plugins/
     *
     * If you aren't using Apache, alternate configuration settings can be found in the docs.
     *
     * @link https://github.com/retlehs/roots/blob/master/doc/rewrites.md
     */
    function roots_add_rewrites($content) {
      global $wp_rewrite;
      $roots_new_non_wp_rules = array(
        'assets/css/(.*)'      => THEME_PATH . '/assets/css/$1',
        'assets/js/(.*)'       => THEME_PATH . '/assets/js/$1',
        'assets/img/(.*)'      => THEME_PATH . '/assets/img/$1',
        'plugins/(.*)'         => RELATIVE_PLUGIN_PATH . '/$1'
      );
      $wp_rewrite->non_wp_rules = array_merge($wp_rewrite->non_wp_rules, $roots_new_non_wp_rules);
      return $content;
    }
    
    function roots_clean_urls($content) {
      if (strpos($content, RELATIVE_PLUGIN_PATH) > 0) {
        return str_replace('/' . RELATIVE_PLUGIN_PATH,  '/plugins', $content);
      } else {
        return str_replace('/' . THEME_PATH, '', $content);
      }
    }
    
    if (!is_multisite() && !is_child_theme()) {
      if (current_theme_supports('rewrites')) {
        add_action('generate_rewrite_rules', 'roots_add_rewrites');
      }
    
      if (!is_admin() && current_theme_supports('rewrites')) {
        $tags = array(
          'plugins_url',
          'bloginfo',
          'stylesheet_directory_uri',
          'template_directory_uri',
          'script_loader_src',
          'style_loader_src'
        );
    
        add_filters($tags, 'roots_clean_urls');
      }
    }

    and config.php

    <?php
    /**
     * Enable theme features
     */
    add_theme_support('root-relative-urls');    // Enable relative URLs
    add_theme_support('rewrites');              // Enable URL rewrites
    add_theme_support('bootstrap-top-navbar');  // Enable Bootstrap's top navbar
    add_theme_support('bootstrap-gallery');     // Enable Bootstrap's thumbnails component on [gallery]
    add_theme_support('nice-search');           // Enable /?s= to /search/ redirect
    add_theme_support('jquery-cdn');            // Enable to load jQuery from the Google CDN
    
    /**
     * Configuration values
     */
    define('GOOGLE_ANALYTICS_ID', ''); // UA-XXXXX-Y
    define('POST_EXCERPT_LENGTH', 40);
    
    /**
     * .main classes
     */
    function roots_main_class() {
      if (roots_display_sidebar()) {
        // Classes on pages with the sidebar
        $class = 'col-sm-8 col-lg-8';
      } else {
        // Classes on full width pages
        $class = 'col-lg-12';
      }
    
      return $class;
    }
    
    /**
     * .sidebar classes
     */
    function roots_sidebar_class() {
      return 'col-sm-4 col-lg-4';
    }
    
    /**
     * Define which pages shouldn't have the sidebar
     *
     * See lib/sidebar.php for more details
     */
    function roots_display_sidebar() {
      $sidebar_config = new Roots_Sidebar(
        /**
         * Conditional tag checks (http://codex.wordpress.org/Conditional_Tags)
         * Any of these conditional tags that return true won't show the sidebar
         *
         * To use a function that accepts arguments, use the following format:
         *
         * array('function_name', array('arg1', 'arg2'))
         *
         * The second element must be an array even if there's only 1 argument.
         */
        array(
          'is_404',
          //'is_front_page'
        ),
        /**
         * Page template checks (via is_page_template())
         * Any of these page templates that return true won't show the sidebar
         */
        array(
          'template-custom.php'
        )
      );
    
      return apply_filters('roots_display_sidebar', $sidebar_config->display);
    }
    
    /**
     * $content_width is a global variable used by WordPress for max image upload sizes
     * and media embeds (in pixels).
     *
     * Example: If the content area is 640px wide, set $content_width = 620; so images and videos will not overflow.
     * Default: 940px is the default Bootstrap container width.
     */
    if (!isset($content_width)) { $content_width = 940; }
    
    /**
     * Define helper constants
     */
    $get_theme_name = explode('/themes/', get_template_directory());
    
    define('RELATIVE_PLUGIN_PATH',  str_replace(home_url() . '/', '', plugins_url()));
    define('RELATIVE_CONTENT_PATH', str_replace(home_url() . '/', '', content_url()));
    define('THEME_NAME',            next($get_theme_name));
    define('THEME_PATH',            RELATIVE_CONTENT_PATH . '/themes/' . THEME_NAME);

    Sorry about all the code, really not familiar with roots structure yet.

    Thread Starter squaredindex

    (@squaredindex)

    Thanks for the reply

    <?php
    /**
     * The Header for our theme.
     *
     * Displays all of the <head> section and everything up till <div id="main">
     *
     * @package Minileven
     */
    ?><!DOCTYPE html>
    <html <?php language_attributes(); ?>>
    <head>
    <meta charset="<?php bloginfo( 'charset' ); ?>" />
    <meta name="viewport" content="width=device-width" />
    <title><?php wp_title( '|', true, 'right' ); ?></title>
    <link rel="profile" href="http://gmpg.org/xfn/11" />
    <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    <?php wp_head(); ?>
    
    <body <?php body_class(); ?>>
    <div id="wrapper">
    	<?php
    		$location = minileven_get_menu_location(); // get the menu locations from the current theme in use
    	?>
    		<div class="menu-search">
    			<nav id="access" class="site-navigation main-navigation" role="navigation">
    				<h3 class="menu-toggle"><?php _e( 'Menu', 'jetpack' ); ?></h3>
    
    				<?php /*  Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff. */ ?>
    				<div class="skip-link"><a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to primary content', 'jetpack' ); ?>"><?php _e( 'Skip to primary content', 'minileven' , 'jetpack'); ?></a></div>
    				<?php /* Our navigation menu.  If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assiged to the primary position is the one used. If none is assigned, the menu with the lowest ID is used. */
    					if ( false !== $location ) :
    						$menu_id = array_shift( array_values( $location ) ); // acccess the ID of the menu assigned to that location. Using only the first menu ID returned in the array.
    						wp_nav_menu( array( 'theme_location' => 'primary', 'container_class' => '', 'menu_class' => 'nav-menu', 'menu' => $menu_id ) );
    					else: // if the $location variable is false, wp_page_menu() is shown instead.
    						wp_nav_menu( array( 'theme_location' => 'primary', 'container_class' => '', 'menu_class' => 'nav-menu' ) );
    					endif;
    				?>
    			</nav><!-- #access -->
    			<div class="search-form">
    				<?php get_search_form(); ?>
    			</div><!-- .search-form-->
    		</div><!-- .menu-search-->
    
    	<?php minileven_header(); ?>
    
    	<div id="page" class="hfeed">
    		<div id="main">
Viewing 4 replies - 1 through 4 (of 4 total)