Last active
February 26, 2020 01:46
-
-
Save tanjimahmmed/f4906f069fa97fa8c6303da0df9a07d5 to your computer and use it in GitHub Desktop.
theme support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once(get_theme_file_path("/inc/tgm.php")); | |
require_once(get_theme_file_path("/inc/attachments.php")); | |
if (site_url()=="http://127.0.0.1/demo.tanjim.com"){ | |
define("VERSION", time()); | |
}else{ | |
define("VERSION",wp_get_theme()->get("version")); | |
} | |
// theme setup | |
function philosophy_theme_setup(){ | |
load_theme_textdomain("philosophy"); | |
add_theme_support("post-thumbnails"); | |
add_theme_support( "custom-logo" ); | |
add_theme_support("title-tag"); | |
add_theme_support( 'html-5', array('search-form', 'comment-list') ); | |
add_theme_support("post-formats", array("image", "gallery", "quote", "audio", "video", "link")); | |
add_editor_style("/assets/css/editor-style.css"); | |
register_nav_menu( "topmenu",__("Top Menu", "philosophy") ); | |
register_nav_menus( array ( | |
"footer-left" =>__("Footer Left Menu", "philosophy"), | |
"footer-middle" =>__("Footer Middle Menu", "philosophy"), | |
"footer-right" =>__("Footer Right Menu", "philosophy") | |
)); | |
add_image_size("philosophy-home-square", 400,400,true); | |
} | |
add_action( "after_setup_theme", "philosophy_theme_setup" ); | |
// file linkup | |
function philosophy_assets(){ | |
wp_enqueue_style("fontawesome-css", get_theme_file_uri( "/assets/css/font-awesome/font-awesome.css" ), null, "1.0"); | |
wp_enqueue_style("fonts-css", get_theme_file_uri( "/assets/css/fonts.css" ), null, "1.0"); | |
wp_enqueue_style("base-css", get_theme_file_uri( "/assets/css/base.css" ), null, "1.0"); | |
wp_enqueue_style("vendor-css", get_theme_file_uri( "/assets/css/vendor.css" ), null, "1.0"); | |
wp_enqueue_style("main-css", get_theme_file_uri( "/assets/css/main.css" ), null, "1.0"); | |
wp_enqueue_style("philosophy-css", get_stylesheet_uri(),null,VERSION); | |
// java script enqueue | |
wp_enqueue_script( "modernizr-js", get_theme_file_uri("/assets/js/modernizr.js"), null, "1.0" ); | |
wp_enqueue_script( "pace-js", get_theme_file_uri("/assets/js/pace.min.js"), null, "1.0" ); | |
wp_enqueue_script( "plugins-js", get_theme_file_uri( "/assets/js/plugins.js" ), array("jquery"), "1.0", true ); | |
wp_enqueue_script( "main-js", get_theme_file_uri("/assets/js/main.js"), array("jquery"), "1.0", true ); | |
} | |
add_action("wp_enqueue_scripts", "philosophy_assets"); | |
// pagination | |
function philosophy_pagination(){ | |
global $wp_query; | |
$links = paginate_links(array ( | |
'current' => max(1, get_query_var( 'paged' )), | |
'total' => $wp_query->max_num_pages, | |
'type' => 'list', | |
'mid_size' => 3 | |
)); | |
$links = str_replace("page-numbers", "pgn__num", $links); | |
$links = str_replace("<ul class='pgn__num'>", "<ul>", $links); | |
$links = str_replace("next pgn__num", "pgn__next", $links); | |
$links = str_replace("prev pgn__num", "pgn__prev", $links); | |
echo $links; | |
} | |
remove_action( "term_description", "wpautop" ); | |
function philosophy_widgets(){ | |
register_sidebar( array( | |
'name' => __( 'About Us Page', 'philosophy' ), | |
'id' => 'about-us', | |
'description' => __( 'Widgets in this area will be shown on about us page.', 'philosophy'), | |
'before_widget' => '<div id="%1$s" class="col-block %2$s">', | |
'after_widget' => '</div>', | |
'before_title' => '<h3 class="quarter-top-margin">', | |
'after_title' => '</h3>', | |
) ); | |
register_sidebar( array( | |
'name' => __( 'Contact Page Maps Section', 'philosophy' ), | |
'id' => 'contact-maps', | |
'description' => __( 'Widgets in this area will be shown on contact page.', 'philosophy'), | |
'before_widget' => '<div id="%1$s" class="%2$s">', | |
'after_widget' => '</div>', | |
'before_title' => '', | |
'after_title' => '', | |
) ); | |
register_sidebar( array( | |
'name' => __( 'Contact Page Information Section', 'philosophy' ), | |
'id' => 'contact-info', | |
'description' => __( 'Widgets in this area will be shown on contact page.', 'philosophy'), | |
'before_widget' => '<div id="%1$s" class="col-block %2$s">', | |
'after_widget' => '</div>', | |
'before_title' => '<h3 class="quarter-top-margin">', | |
'after_title' => '</h3>', | |
) ); | |
register_sidebar( array( | |
'name' => __( 'Before Footer Section', 'philosophy' ), | |
'id' => 'before-footer-right', | |
'description' => __( 'before footer section, right side', 'philosophy'), | |
'before_widget' => '<div id="%1$s" class="%2$s">', | |
'after_widget' => '</div>', | |
'before_title' => '<h3>', | |
'after_title' => '</h3>', | |
) ); | |
register_sidebar( array( | |
'name' => __( 'Footer Section', 'philosophy' ), | |
'id' => 'footer-right', | |
'description' => __( 'footer section, right side', 'philosophy'), | |
'before_widget' => '<div id="%1$s" class="%2$s">', | |
'after_widget' => '</div>', | |
'before_title' => '<h4>', | |
'after_title' => '</h4>', | |
) ); | |
register_sidebar( array( | |
'name' => __( 'Footer Bottom Section', 'philosophy' ), | |
'id' => 'footer-bottom', | |
'description' => __( 'footer section, bottom side', 'philosophy'), | |
'before_widget' => '<div id="%1$s" class="%2$s">', | |
'after_widget' => '</div>', | |
'before_title' => '', | |
'after_title' => '', | |
) ); | |
register_sidebar( array( | |
'name' => __( 'Header Section', 'philosophy' ), | |
'id' => 'header-section', | |
'description' => __( 'Widgets in this area will be shown on header section.', 'philosophy'), | |
'before_widget' => '<div id="%1$s" class="header__social %2$s">', | |
'after_widget' => '</div>', | |
'before_title' => '<h3>', | |
'after_title' => '</h3>', | |
) ); | |
} | |
add_action("widgets_init", "philosophy_widgets"); | |
function philosophy_search_form($form){ | |
$homedir = home_url("/"); | |
$label =__("Search for:", "philosophy"); | |
$button_label =__("Search", "philosophy"); | |
$newform = <<<FORM | |
<form role="search" method="get" class="header__search-form" action="{$homedir}"> | |
<label> | |
<span class="hide-content">{$label}</span> | |
<input type="search" class="search-field" placeholder="Type Keywords" value="" name="s" title="{$label}" autocomplete="off"> | |
</label> | |
<input type="submit" class="search-submit" value="{$button_label}"> | |
</form> | |
FORM; | |
return $newform; | |
} | |
add_filter("get_search_form", "philosophy_search_form"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment