Browse Source

meta desc

windhamdavid 5 years ago
parent
commit
e81dd0bee7
3 changed files with 37 additions and 6 deletions
  1. 7 2
      functions.php
  2. 1 0
      header.php
  3. 29 4
      inc/template.php

+ 7 - 2
functions.php

@@ -33,8 +33,8 @@ function dw_scripts() {
 	wp_enqueue_style( 'boot', get_template_directory_uri() . '/css/bootstrap.css');
 	wp_enqueue_style( 'jasny', get_template_directory_uri() . '/css/jasny-bootstrap.css');
 	wp_enqueue_style( 'font', get_template_directory_uri() . '/css/font-awesome.css');
-	wp_enqueue_style( 'cal', get_template_directory_uri() . '/css/fullcalendar.css');
-	wp_enqueue_style( 'ani', get_template_directory_uri() . '/css/animate.css');
+	//wp_enqueue_style( 'cal', get_template_directory_uri() . '/css/fullcalendar.css');
+	//wp_enqueue_style( 'ani', get_template_directory_uri() . '/css/animate.css');
 	
 	wp_deregister_script('jquery');
 	if ( is_front_page() || is_home() ) {
@@ -72,6 +72,11 @@ function dw_scripts() {
 		wp_enqueue_script( 'chart', get_template_directory_uri() . '/js/chart.min.js', 'jquery', '', true );
 		wp_enqueue_script( 'last-fm', get_template_directory_uri() . '/js/fm.js', 'jquery', '', true );
 	}
+	
+	if ( is_page('card') ) {
+		wp_enqueue_style( 'jplayercss', get_template_directory_uri() . '/css/card.css');
+		wp_enqueue_script( 'scripts-o', get_template_directory_uri() . '/js/card.js', 'jquery', '', true );
+	}
 
 	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
 		wp_enqueue_script( 'comment-reply' );

+ 1 - 0
header.php

@@ -9,6 +9,7 @@
 <meta charset="UTF-8" />
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <title><?php dw_page_title();?></title>
+<meta name="description" content="<?php dw_page_desc();?>"/>
 <?php wp_head(); ?>
 </head>
 <body>

+ 29 - 4
inc/template.php

@@ -5,10 +5,35 @@ function dw_page_title() {
 	global $page, $paged; 
 	wp_title( '|', true, 'right' ); 
 	bloginfo( 'name' ); $site_description = get_bloginfo( 'description', 'display' );
-		if ( $site_description && ( is_home() || is_front_page() ) )
-			echo " | $site_description";
-		if ( $paged >= 2 || $page >= 2 )
-			echo ' | ' . sprintf( __( 'Page %s', 'dw' ), max( $paged, $page ) );
+	if ( $site_description && ( is_home() || is_front_page() ) )
+		echo " | $site_description";
+	if ( $paged >= 2 || $page >= 2 )
+		echo ' | ' . sprintf( __( 'Page %s', 'dw' ), max( $paged, $page ) );
+}
+endif;
+
+if ( ! function_exists( 'dw_page_desc') ) :
+function dw_page_desc() {
+	global $post; 
+	$post = get_post( $post );
+	setup_postdata( $post );
+	$excerpt = get_the_excerpt();
+	if (is_single()||is_page()){
+		if (get_post_meta($post->ID, "meta-desc", true) !='' ) 
+			echo get_post_meta($post->ID, "meta-desc", true); 
+		else echo substr(get_the_excerpt(), 0,60);;
+	}
+}
+endif;
+
+if ( ! function_exists( 'dw_excerpt') ) :
+function dw_excerpt($count){
+	$permalink = get_permalink($post->ID);
+	$excerpt = get_the_content();
+	$excerpt = strip_tags($excerpt);
+	$excerpt = substr($excerpt, 0, $count);
+	$excerpt = $excerpt.'... <a href="'.$permalink.'">more</a>';
+	return $excerpt;
 }
 endif;