워드프레스 함수활용
템플릿 리디렉션 활용
Post, Custom Post Type, Page, Attachment and Bookmarks Functions Posts get_adjacent_post get_boundary_post get_children get_extended get_next_post get_next_posts_link next_posts_link get_permalink the_permalink get_the_excerpt the_excerpt get_the_post_thumbnail get_post get_post_field get_post_ancestors get_post_mime_type get_post_status get_post_format set_post_format get_edit_post_link get_delete_post_link get_previous_post get_previous_posts_link previous_posts_link get_posts have_posts is_post (deprecated) is_single is_sticky get_the_ID the_ID the_date the_post wp_get_recent_posts wp_get_single_post (deprecated) has_post_thumbnail has_excerpt has_post_format Custom Post Type register_post_type is_post_type_archive post_type_archive_title add_post_type_support…
테마 : Enfold 하나보드 한글파일 업로드 허용
1 2 |
/* User Add Uploads */ define('ALLOW_UNFILTERED_UPLOADS', true ); |
1 2 3 4 5 6 |
function add_custom_mime_types($mimes){ return array_merge($mimes,array ( 'hwp' => 'application/hangul' )); } add_filter('upload_mimes','add_custom_mime_types'); |
첨부파일 링크 수정 다운로드 후 페이지 리도드 멈춤현상 : 55번 라인 _blank 추가
1 2 3 4 5 6 7 8 9 10 |
<li> <a href="<?php echo $file->url;?>" target="_blank" title="<?php echo esc_attr( $file->title );?>"> <span class="attachment-filename"> <?php echo $file->title; ?> </span> <span class="attachment-filesize"> <?php echo ( empty($file->filesize) ? "" : "(".$file->filesize.")" ) ?> </span> </a> </li> |
the7 테마 수정사항 /wp-content/themes/brooklyn/partials/blog/content.php 87번라인 주석처리 싱글컨텐츠 출력시 피처이미지 숨김
1 2 3 4 5 |
<?php if ( is_single() ) : ?> <!--<div class="entry-thumbnail"> <img alt="<?php echo $caption; ?>" class="wp-post-image" src="<?php echo $thumbnail; ?>"> </div>//--> <?php else : ?> |
전환율 스크립트실행 do_action
테마 function 추가
/wp-content/plugins/dopbsp/includes/reservations/class-frontend-reservations.php 85라인
네비게이션 리디렉트 \wp-content\themes\dt-the7\inc\helpers\post_navigation.php 247
아카이브 칼럼4개 강제 \wp-content\themes\dt-the7\inc\helpers\masonry-template.php 39 45
이미지 라이트박스 팝업 방지 \wp-content\themes\dt-the7\inc\mods\portfolio\public\mod-portfolio-helpers.php 337 외
아래와 같이 수정하면 해당 if문을 타면서 switch case 구문을 타기 때문에 register 가 들어왔을 때 $title에 제대로 된 번역값이 들어가게 되어 정상적으로 한글이 출력됩니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
public function get_title( $action = '' ) { if ( empty( $action ) ) $action = $this->get_option( 'default_action' ); if ( is_admin() ) return; if ( is_user_logged_in() && 'login' == $action && $action == $this->get_option( 'default_action' ) ) { $title = sprintf( __( 'Welcome, %s', 'theme-my-login' ), wp_get_current_user()->display_name ); } else { if ( $page_id = Theme_My_Login::get_page_id( $action ) ) { // get_title 함수로 action이 들어오는데 $get_page_id 함수를 살펴보면 // $page_id와 같은 값이 되어 해당 if문을 타게 됩니다. $title = get_post_field( 'post_title', $page_id ); } else { // 이 else문을 타지 않아 번역값을 호출하지 못합니다. switch ( $action ) { case 'register': $title = __( 'Register', 'theme-my-login' ); break; case 'lostpassword': case 'retrievepassword': case 'resetpass': case 'rp': $title = __( 'Lost Password', 'theme-my-login' ); break; case 'login': default: $title = __( 'Log In', 'theme-my-login' ); } } } return apply_filters( 'tml_title', $title, $action ); } |
1 |
if ( $page_id = Theme_My_Login::get_page_id( $action ) ) { $title = get_post_field( 'post_title', $page_id ); // ---> 이 구문은 변경 후 기본 케이스로 사용합니다. } else { -- 후략 -- // 이런 조건문이 있습니다. // 조건문의 else 부분에 있는 switch case 구문을 복사하고 // default의 구문을 기존 if문에 있던 구문으로 교체합니다. // 그렇게 되면 다음과 같이 변경되겠죠. if ( $page_id = Theme_My_Login::get_page_id( $action ) ) { switch ( $action ) { case 'register': $title = __( 'Register', 'theme-my-login' ); break; case 'lostpassword': case 'retrievepassword': case 'resetpass': case 'rp': $title = __( 'Lost Password', 'theme-my-login' ); break; case 'login': default: $title = get_post_field( 'post_title', $page_id ); // default: --> 기존 if문에 있던 구문 } } else { -- 후략 -- |
이렇게 수정하면 해당 if문을 타면서 switch case 구문을 타기 때문에 register 가 들어왔을 때 $title에 제대로 된 번역값이 들어가게 되어 정상적으로 한글이 출력됩니다. 물론 해결방법은 여러가지가 있습니다. 하지만…
테마 : Enfold 메인 포토썸네일크기의 변경 – 중간사이즈로 출력되던것을 좀 더 작은사이즈로 출력 enfoldconfig-templatebuilderavia-shortcodesmasonry_entries.php 크기수정 $img_size=’masonry’ enfold theme
정리부터 single-{format}.php – single.php – content-{format}.php – content.php 요런순서다. 역시 자식테마에서 동작가능 워드프레스는 글 형식(Post Format)이 있어 포스트에 형식을 지정하고 그에 맞게 다른 모양으로 컨텐츠를 보여줄 수 있습니다. 사용할 수 있는 포스트 형식은 다음과 같습니다. aside – Typically styled without a title. Similar to a Facebook note update. gallery – A gallery of images. Post will…
[sourcecode language=”css”] your code here [/sourcecode] The language parameter controls how the code is syntax highlighted. The following languages are supported: * actionscript3 * bash * coldfusion * cpp * csharp * css * delphi * erlang * fsharp * diff * groovy * javascript * java * javafx * matlab (keywords only) * objc…