diff --git a/controller/classes/Subtemplate.php b/controller/classes/Subtemplate.php new file mode 100644 index 0000000..3828fd8 --- /dev/null +++ b/controller/classes/Subtemplate.php @@ -0,0 +1,40 @@ +ID; + $result = ''; + + $subtemplates = get_field('subtemplate', $id); + $result = ''; + if( $subtemplates ) { + foreach ( $subtemplates as $subtemplate ) { + $subtemplateType = $subtemplate['subtemplate_type']; + + $subtemplateTitle = $subtemplate['section_title']; + + switch ($subtemplateType) { + case 'content': + $result .= $this->content($subtemplate,$subtemplateTitle); + break; + + } + } + + return $result; + } + + + return $result; + } + + +} \ No newline at end of file diff --git a/controller/controller.inc.php b/controller/controller.inc.php new file mode 100644 index 0000000..46ddb85 --- /dev/null +++ b/controller/controller.inc.php @@ -0,0 +1,19 @@ +loopSubtemplates(); + } +} \ No newline at end of file diff --git a/controller/header.php b/controller/header.php new file mode 100644 index 0000000..725cef8 --- /dev/null +++ b/controller/header.php @@ -0,0 +1,55 @@ + +global $passInTitle; +$description = ''; +$image = ''; +$title = ''; +$url = get_bloginfo('wpurl'); +// + +// +if(isset($passInTitle)) { + $title = $passInTitle; +} +else { + $title = get_the_title(); +} + +if (strpos($title, 'Home') !== false) +{ + $title = ''; +} +else { + $title .= ' | '; +} +$title .= get_bloginfo(); +// + +// +$description = get_the_excerpt(); +if (empty($description)) { + + $content = get_field('subtemplate')[0]['content']; + if (!empty($content)) { + $description = substr(strip_tags($content),0,140)."..."; + + } +} +if (empty($description)) { + $description = get_bloginfo('description'); +} +// + +// +$image = get_field('header_image')['url']; +if (empty($image)) { + $image = WPTHEME_TEMPLATE_URL.'/images/ico/apple-touch-icon-152x152.png'; +} +// \ No newline at end of file diff --git a/functions.php b/functions.php index b15ad80..fcdf6c4 100644 --- a/functions.php +++ b/functions.php @@ -13,6 +13,9 @@ * @since 0.1.0 */ +require "controller/controller.inc.php"; + + // Useful global constants define( 'WPTHEME_VERSION', '0.1.0' ); define( 'WPTHEME_URL', get_stylesheet_directory_uri() ); @@ -23,7 +26,29 @@ define( 'WPTHEME_INC', WPTHEME_PATH . 'includes/' ); // Include compartmentalized functions require_once WPTHEME_INC . 'functions/core.php'; -// Include lib classes - // Run the setup functions -TenUp\ascribe\Core\setup(); \ No newline at end of file +TenUp\ascribe\Core\setup(); + + +// REMOVE WIDTH AND HEIGHT ATTRIBUTES ON THUMBNAILS +add_filter( 'post_thumbnail_html', 'remove_thumbnail_dimensions', 10, 3 ); + +//ACF Collapser temp fix +add_filter('acf/compatibility/field_wrapper_class', '__return_true'); + +// TURN ON ACF SETTINGS PAGE +if( function_exists('acf_add_options_page') ) { + acf_add_options_page(array( + 'page_title' => 'Theme General Settings', + 'menu_title' => 'Theme Settings', + 'menu_slug' => 'theme-general-settings', + 'capability' => 'edit_posts', + 'redirect' => false + )); +} + +//add excerpt to page +function wpcodex_add_excerpt_support_for_pages() { + add_post_type_support( 'page', 'excerpt' ); +} +add_action( 'init', 'wpcodex_add_excerpt_support_for_pages' ); \ No newline at end of file diff --git a/header.php b/header.php index 6420c5a..f300ba0 100644 --- a/header.php +++ b/header.php @@ -5,11 +5,88 @@ * @package ascribe * @since 0.1.0 */ - ?> - -> - - - - - \ No newline at end of file +require 'controller/header.php'; +$controller = new Controller(); + +?> + + + + + + + + + + + + <?php echo $title ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +> +
+ +
+ indexHeader(); + $indexMobileBg = get_field('mobile_video_replacement_image')['url']; + $indexHead = "
{$indexHeadContent}
"; + } + ?> +
+
+ + + +
+
+