<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
	<channel>
				<title><![CDATA[게시판 1 2건]]></title>
		<link>https://www.cosmosfarm.com/threads/rss/document/31955</link>
		<description><![CDATA[<p>닷홈의 워드프레스 &gt; 외모 &gt; Theme editer &gt; functions </p>

<p> </p>

<p>&lt;?php<br />
/**<br />
 * PhotoBook functions and definitions.<br />
 *<br />
 * @link <a href="https://developer.wordpress.org/themes/basics/theme-functions/">https://developer.wordpress.org/themes/basics/theme-functions/</a><br />
 *<br />
 * @package PhotoBook<br />
 */</p>

<p>if ( ! function_exists( 'photobook_setup' ) ) :<br />
/**<br />
 * Sets up theme defaults and registers support for various WordPress features.<br />
 *<br />
 * Note that this function is hooked into the after_setup_theme hook, which<br />
 * runs before the init hook. The init hook is too late for some features, such<br />
 * as indicating support for post thumbnails.<br />
 */<br />
function photobook_setup() {<br />
 /*<br />
  * Make theme available for translation.<br />
  * Translations can be filed in the /languages/ directory.<br />
  * If you're building a theme based on PhotoBook, use a find and replace<br />
  * to change 'photobook' to the name of your theme in all the template files.<br />
  */<br />
 load_theme_textdomain( 'photobook', get_template_directory() . '/languages' );</p>

<p> // Add default posts and comments RSS feed links to head.<br />
 add_theme_support( 'automatic-feed-links' );</p>

<p> // Custom Image Crop<br />
 add_image_size( 'photobook-banner-image', 1920, 980, true );<br />
 add_image_size( 'photobook-front-post-img', 450, 330, true );<br />
 add_image_size( 'photobook-blog-img', 750, '', true );</p>

<p> /*<br />
  * Let WordPress manage the document title.<br />
  * By adding theme support, we declare that this theme does not use a<br />
  * hard-coded &lt;title&gt; tag in the document head, and expect WordPress to<br />
  * provide it for us.<br />
  */<br />
 add_theme_support( 'title-tag' );</p>

<p> /*<br />
  * Enable support for Post Thumbnails on posts and pages.<br />
  *<br />
  * @link <a href="https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/">https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/</a><br />
  */<br />
 add_theme_support( 'post-thumbnails' );</p>

<p> // This theme uses wp_nav_menu() in one location.<br />
 register_nav_menus( array(<br />
  'primary' =&gt; esc_html__( 'Primary', 'photobook' ),<br />
 ) );</p>

<p> /*<br />
  * Switch default core markup for search form, comment form, and comments<br />
  * to output valid HTML5.<br />
  */<br />
 add_theme_support( 'html5', array(<br />
  'search-form',<br />
  'comment-form',<br />
  'comment-list',<br />
  'gallery',<br />
  'caption',<br />
 ) );</p>

<p> /*<br />
  * Enable support for Post Formats.<br />
  * See <a href="https://developer.wordpress.org/themes/functionality/post-formats/">https://developer.wordpress.org/themes/functionality/post-formats/</a><br />
  */<br />
 add_theme_support( 'post-formats', array(<br />
  'aside',<br />
  'image',<br />
  'video',<br />
  'quote',<br />
  'link',<br />
 ) );</p>

<p> // Set up the WordPress core custom background feature.<br />
 add_theme_support( 'custom-background', apply_filters( 'photobook_custom_background_args', array(<br />
  'default-color' =&gt; 'ffffff',<br />
  'default-image' =&gt; '',<br />
 ) ) );</p>

<p> /**<br />
  * Add editor style<br />
  */<br />
 add_editor_style( 'css/custom-editor-style.css' );</p>

<p> /*<br />
  * Add support for Gutenberg.<br />
  *<br />
  * @link <a href="https://wordpress.org/gutenberg/handbook/reference/theme-support/">https://wordpress.org/gutenberg/handbook/reference/theme-support/</a><br />
  */<br />
 add_theme_support( 'align-wide' );</p>

<p>}<br />
endif; // photobook_setup<br />
add_action( 'after_setup_theme', 'photobook_setup' );</p>

<p>/**<br />
 * Set the content width in pixels, based on the theme's design and stylesheet.<br />
 *<br />
 * Priority 0 to make it available to lower priority callbacks.<br />
 *<br />
 * @global int $content_width<br />
 */<br />
function photobook_content_width() {<br />
 $GLOBALS['content_width'] = apply_filters( 'photobook_content_width', 640 );<br />
}<br />
add_action( 'after_setup_theme', 'photobook_content_width', 0 );</p>

<p>/**<br />
 * Enqueue scripts and styles.<br />
 */<br />
function photobook_scripts() {</p>

<p> // Enqueue Bootstrap Grid<br />
 wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css', array(), '3.3.5', '' );</p>

<p> // Enqueue FontAwesome<br />
 wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css', array(), '4.4.0', '' );</p>

<p> // Enqueue Swiper.css<br />
 wp_enqueue_style( 'swiper', get_template_directory_uri() . '/css/swiper.min.css', array(), '4.0.6', '' );</p>

<p> // Enqueue colorbox.css<br />
 wp_enqueue_style( 'colorbox', get_template_directory_uri() . '/css/colorbox.css', array(), '', '' );</p>

<p> // Enqueue Google fonts<br />
 wp_enqueue_style( 'photobook-font-roboto', '//fonts.googleapis.com/css?family=Roboto:400,300,500,700,900' );</p>

<p> // Stylesheet<br />
 wp_enqueue_style( 'photobook-style', get_stylesheet_uri() );</p>

<p> // Enqueue nicescroll<br />
 wp_enqueue_script( 'nicescroll', get_template_directory_uri() . '/js/jquery.nicescroll.min.js', array( 'jquery' ), '3.6.6', '' );</p>

<p> // Enqueue Swiper<br />
 wp_enqueue_script( 'swiper', get_template_directory_uri() . '/js/swiper.min.js', array( 'jquery' ), '4.0.6', '' );</p>

<p> // colorbox JS<br />
 wp_enqueue_script( 'colorbox', get_template_directory_uri() . '/js/jquery.colorbox-min.js', array( 'jquery' ), '', '' );</p>

<p> // Custom JS<br />
 wp_enqueue_script( 'photobook-custom-js', get_template_directory_uri() . '/js/custom.js', array( 'jquery' ), '', true );</p>

<p> if ( is_singular() &amp;&amp; comments_open() &amp;&amp; get_option( 'thread_comments' ) ) {<br />
  wp_enqueue_script( 'comment-reply' );<br />
 }<br />
}<br />
add_action( 'wp_enqueue_scripts', 'photobook_scripts' );</p>

<p>/**<br />
 * Custom template tags for this theme.<br />
 */<br />
require get_template_directory() . '/inc/template-tags.php';</p>

<p>/**<br />
 * Custom functions that act independently of the theme templates.<br />
 */<br />
require get_template_directory() . '/inc/extras.php';</p>

<p>/**<br />
 * Customizer additions.<br />
 */<br />
require get_template_directory() . '/inc/customizer.php';</p>

<p>/**<br />
 * Load Widgets file<br />
 */<br />
require get_template_directory() . '/inc/widgets/widgets.php';</p>

<p>/**<br />
 * Load Dashboard file<br />
 */<br />
require get_template_directory() . '/inc/dashboard.php';</p>

<p>/**<br />
 * Convert hexdec color string to rgb(a) string<br />
 */<br />
function photobook_hex2rgba( $color, $opacity = false ) {</p>

<p> $default = 'rgb(0,0,0)';</p>

<p> //Return default if no color provided<br />
 if( empty( $color ) )<br />
  return $default;</p>

<p> //Sanitize $color if "#" is provided<br />
 if ( $color[0] == '#' ) {<br />
  $color = substr( $color, 1 );<br />
 }</p>

<p> //Check if color has 6 or 3 characters and get values<br />
 if ( strlen( $color ) == 6 ) {<br />
  $hex = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] );<br />
 } elseif ( strlen( $color ) == 3 ) {<br />
  $hex = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] );<br />
 } else {<br />
  return $default;<br />
 }</p>

<p> //Convert hexadec to rgb<br />
 $rgb =  array_map( 'hexdec', $hex );</p>

<p> //Check if opacity is set(rgba or rgb)<br />
 if( $opacity ){<br />
  if( abs( $opacity ) &gt; 1 )<br />
   $opacity = 1.0;<br />
  $output = 'rgba( '.implode( ",",$rgb ).','.$opacity.' )';<br />
 } else {<br />
  $output = 'rgb( '.implode( ",",$rgb ).' )';<br />
 }</p>

<p> //Return rgb(a) color string<br />
 return $output;<br />
}</p>

<p>/**<br />
 * Breadcrumbs<br />
 */<br />
function photobook_breadcrumb() {<br />
 global $post;<br />
 echo '&lt;ul id="dt_breadcrumbs"&gt;';<br />
 if ( !is_home() ) {<br />
  echo '&lt;li&gt;&lt;a href="';<br />
  echo esc_url( home_url() );<br />
  echo '"&gt;';<br />
  echo __( 'Home', 'photobook' );<br />
  echo '&lt;/a&gt;&lt;/li&gt;&lt;li class="separator"&gt; / &lt;/li&gt;';<br />
  if ( is_category() || is_single() ) {<br />
   echo '&lt;li&gt;';<br />
   the_category( ' &lt;/li&gt;&lt;li class="separator"&gt; / &lt;/li&gt;&lt;li&gt; ' );<br />
   if ( is_single() ) {<br />
    echo '&lt;/li&gt;&lt;li class="separator"&gt; / &lt;/li&gt;&lt;li&gt;';<br />
    the_title();<br />
    echo '&lt;/li&gt;';<br />
   }<br />
  } elseif ( is_page() ) {<br />
   if ( $post-&gt;post_parent ){<br />
    $anc = get_post_ancestors( $post-&gt;ID );<br />
    $title = get_the_title();<br />
    foreach ( $anc as $ancestor ) {<br />
     $output = '&lt;li&gt;&lt;a href="'. esc_url( get_permalink( $ancestor ) ) .'" title="'. esc_attr( get_the_title( $ancestor ) ) .'"&gt;'. esc_attr( get_the_title( $ancestor ) ) .'&lt;/a&gt;&lt;/li&gt; &lt;li class="separator"&gt; / &lt;/li&gt;';<br />
    }<br />
    echo $output;<br />
    echo esc_attr( $title );<br />
   } else {<br />
    echo '&lt;li&gt;'. the_title_attribute() .'&lt;/li&gt;';<br />
   }<br />
  }<br />
 } elseif ( is_tag() ) {<br />
  single_tag_title();<br />
 } elseif ( is_day() ) {<br />
  echo"&lt;li&gt;" . __( 'Archive for', 'photobook' ); the_time( 'F jS, Y' ); echo'&lt;/li&gt;';<br />
 } elseif ( is_month() ) {<br />
  echo"&lt;li&gt;" . __( 'Archive for', 'photobook' ); the_time( 'F, Y' ); echo'&lt;/li&gt;';<br />
 } elseif ( is_year() ) {<br />
  echo"&lt;li&gt;" . __( 'Archive for', 'photobook' ); the_time( 'Y' ); echo'&lt;/li&gt;';<br />
 } elseif ( is_author( ) ) {<br />
  echo"&lt;li&gt;" . __( 'Author Archive', 'photobook' ); echo'&lt;/li&gt;';<br />
 } elseif ( isset( $_GET['paged'] ) &amp;&amp; !empty( $_GET['paged'] ) ) {<br />
  echo "&lt;li&gt;" . __( 'Blog Archive', 'photobook' ); echo'&lt;/li&gt;';<br />
 } elseif ( is_search() ) {<br />
  echo"&lt;li&gt;" . __( 'Search Results', 'photobook' ); echo'&lt;/li&gt;';<br />
 }<br />
 echo '&lt;/ul&gt;';<br />
}</p>

<p>/**<br />
 * Register Load more scripts<br />
 */<br />
function photobook_register_load_more_scripts() {<br />
 wp_localize_script( 'photobook-custom-js', 'photobook_load_more', array(<br />
  'dt_nonce' =&gt; wp_create_nonce( 'dt_nonce' ),<br />
  'ajax_url' =&gt; admin_url( 'admin-ajax.php' )<br />
 ));<br />
}<br />
add_action( 'wp_enqueue_scripts','photobook_register_load_more_scripts' );</p>

<p>/**<br />
 * Ajax load more posts<br />
 */<br />
function photobook_get_ajax_results(){</p>

<p> if ( !isset( $_POST['dt_nonce'] ) || !wp_verify_nonce( $_POST['dt_nonce'], 'dt_nonce' ) )<br />
  die( 'Permissions check failed.' );<br />
 $dt_pageNumber = absint( ( isset( $_POST['dt_pageNumber'] ) ) ? $_POST['dt_pageNumber'] : 0 );</p>

<p> $args = array(<br />
  'post_type'   =&gt; 'post',<br />
  'posts_per_page' =&gt; get_option( 'posts_per_page' ) + 1,<br />
  'paged'      =&gt; $dt_pageNumber<br />
 );</p>

<p> $loop = new WP_Query( $args );</p>

<p> if ( $loop-&gt;have_posts() ) :<br />
  while ( $loop-&gt;have_posts() ) : $loop-&gt;the_post(); ?&gt;</p>

<p>   &lt;div class="dt-front-post"&gt;<br />
    &lt;figure&gt;<br />
     &lt;?php<br />
     if ( has_post_thumbnail() ) {</p>

<p>      $dt_post_id = get_the_ID();<br />
      $dt_post_thumbnail_id = get_post_thumbnail_id( $dt_post_id );<br />
      $dt_thumbnail = wp_get_attachment_image( $dt_post_thumbnail_id, 'photobook-front-post-img', true );<br />
      echo $dt_thumbnail;<br />
     }<br />
     ?&gt;<br />
    &lt;/figure&gt;</p>

<p>    &lt;div class="dt-front-post-meta transition5"&gt;<br />
     &lt;h2&gt;&lt;?php the_title(); ?&gt;&lt;/h2&gt;</p>

<p>     &lt;a href="&lt;?php echo esc_url( get_the_permalink() ); ?&gt;"&gt;&lt;?php _e( 'View Details', 'photobook' ); ?&gt;&lt;/a&gt;<br />
    &lt;/div&gt;&lt;!-- .dt-front-post-meta .transition5 --&gt;<br />
   &lt;/div&gt;&lt;!-- .dt-front-post --&gt;</p>

<p>  &lt;?php endwhile;<br />
  wp_reset_postdata();</p>

<p> endif;<br />
 die();<br />
}<br />
add_action( 'wp_ajax_get_ajax_results', 'photobook_get_ajax_results' ); //for logged in users<br />
add_action( 'wp_ajax_nopriv_get_ajax_results', 'photobook_get_ajax_results' ); //for non logged in users</p>

<p>/**<br />
 * wp localize script<br />
 */<br />
function photobook_load_scripts() {</p>

<p> wp_enqueue_script( 'photobook-loadmore', get_template_directory_uri() .'/js/loadmore.js' );</p>

<p> wp_localize_script( 'photobook-loadmore', 'photobook_script_vars', array(<br />
   'no_more_posts' =&gt; __( 'No more post', 'photobook' )<br />
  )<br />
 );<br />
}<br />
add_action('wp_enqueue_scripts', 'photobook_load_scripts');</p>

<p>/**<br />
 * Filter the except length.<br />
 *<br />
 * @param int $length Excerpt length.<br />
 * @return int (Maybe) modified excerpt length.<br />
 */<br />
function glow_archive_excerpt_length( $length ) {<br />
 return ( is_front_page() ) ? 18 : 35;<br />
}<br />
add_filter( 'excerpt_length', 'glow_archive_excerpt_length', 999 );</p>

<p>/**<br />
 * Filter the excerpt "read more" string.<br />
 *<br />
 * @param string $more "Read more" excerpt string.<br />
 * @return string (Maybe) modified "read more" excerpt string.<br />
 */<br />
function glow_excerpt_more( $more ) {<br />
 return '...';<br />
}<br />
add_filter( 'excerpt_more', 'glow_excerpt_more' );<br />
}<br />
add_filter('kboard_list_where', 'my_kboard_list_where', 10, 3);<br />
function my_kboard_list_where($where, $board_id, $content_list){<br />
 $id = '2';<br />
 <br />
 if($board_id == '1'){<br />
  $where = "`board_id`='{$board_id}' OR `board_id`='{$id}' AND `parent_uid`='0' AND `notice`='' AND (`status`='' OR `status` IS NULL OR `status`='pending_approval')";<br />
 }<br />
 return $where;<br />
}</p>]]></description>
		<copyright>Copyright 2026, 코스모스팜</copyright>
				<item>
			<title><![CDATA[안녕하세요~^^

올려주신 코드를 확인해보니

아래와 같은 코드가 있습니다.


add_filter( 'excerpt_mo...]]></title>
			<link>https://www.cosmosfarm.com/threads/document/31958</link>
			<description><![CDATA[<p>안녕하세요~^^</p>

<p>올려주신 코드를 확인해보니</p>

<p>아래와 같은 코드가 있습니다.</p>

<pre>
<code class="language-php">add_filter( 'excerpt_more', 'glow_excerpt_more' );
}</code></pre>

<p>위의 코드를 아래의 코드로 교체해서 확인해보시겠어요?</p>

<pre>
<code class="language-php">add_filter( 'excerpt_more', 'glow_excerpt_more' );</code></pre>

<p> </p>

<p>코드 수정 시 중괄호의 열고 닫힘을 잘 확인해주셔야 합니다.</p>

<p>PHP 뿐만 아니라 CSS, Javascript 등 코드 수정 시</p>

<p>중괄호를 정확하게 입력하지 않으면 원치 않는 결과를 얻으실 수 있습니다.</p>

<p>고맙습니다.</p>]]></description>
			<author>스레드봇</author>
			<pubDate>Wed, 10 Apr 2019 00:01:58 +0000</pubDate>
			<category>워드프레스</category>
		</item>
			</channel>
</rss>