2012-04-25 2 views
0

Wordpress Gallery의 스타일링에 관한 글과 기사를 많이 읽었지만 구조를 변경하고 싶습니다. 아래는 일반적인 갤러리 코드의 예입니다. <dl> <dt> <br>을 제거하고 내 요소로 대체하려고합니다. 내가 Wordpress 파일 구조에서 이것을 할 수있는 어떤 생각?Wordpress Gallery Structure 변경하기

<div id="gallery-1" class="gallery galleryid-1 gallery-columns-1 gallery-size-thumbnail"> 
<dl class="gallery-item"> 
<dt class="gallery-icon"> 
    <a href="http://mydomain.com/2012/01/hello-world/dsc_0003/" title="DSC_0003"><img width="376" height="250" src="http://mydomain.com/wp-content/uploads/2012/01/DSC_0003-376x250.jpg" class="attachment-thumbnail" alt="DSC_0003" title="DSC_0003"></a> 
</dt> 
</dl> 
<br style="clear: both"> 
<dl class="gallery-item"> 
<dt class="gallery-icon"> 
    <a href="http://mydomain.com/2012/01/hello-world/dsc_0003/" title="DSC_0003"><img width="376" height="250" src="http://mydomain.com/wp-content/uploads/2012/01/DSC_0003-376x250.jpg" class="attachment-thumbnail" alt="DSC_0003" title="DSC_0003"></a> 
</dt> 
</dl> 
<br style="clear: both"> 
</div> 

어떤 도움을 주시면 감사하겠습니다. 고맙습니다.

답변

1

기본 게시물 갤러리를 추가로 사용자 정의하려는 경우 post_gallery에 filter을 추가하여 출력물을 만들 수 있습니다. post_gallery 필터가 아무 것도 반환하면 기본 갤러리 출력은 무시됩니다. 시작점으로 /wp-includes/media.php에있는 갤러리 단축 코드 기능을 살펴보십시오. 첨부 파일을 가져오고 출력하기 위해 get_posts을 사용합니다. 당신은 당신의 functions.php 파일에 그 기능을 완전히 복사 할 수 있고 이름을 바꾸고 그것을 필터로 사용할 수 있습니다.

+0

좋은 소리입니다. 나는 /wp-includes/media.php 파일을 직접 편집 할 수있다. 만약 내가 단축 코드를 functions.php에 복사하도록 선택했다면 그 파일에 어디에 넣을까요? 맨 위에? –

+0

네, 중복 함수'gallery_shortcode()''add_shortcode ('gallery', 'gallery_shortcode');로 복사하여 이름을 변경하고'if (is_feed()) { \t \t $ output = "섹션을 제외 할 수 있습니다. \엔"; \t \t $ attach = $ att_id => $ 첨부 파일 \t \t \t $ 출력. = wp_get_attachment_link ($ att_id, $ size, true). "\엔"; \t \t return $ output; \t}'function.php에 복사하면 –