2012-01-30 3 views
0

내가 알고 싶은 것은, 이미 만든 index.php 파일을 구현하여 사용자 정의 게시물을 적용 할 수있는 방법입니다. 내가 달성하고 싶다 무엇WordPress에 더미 용으로 맞춤 게시물을 만드는 방법은 무엇입니까?

(아래 참조) :

Display all posts(already accomplished in index.php) 
--> show normal post a.k.a 'Article' (already accomplished in index.php) 

If category/or post type 'Aside' is used, don't apply a <a> tag, make title lighter(can figure it out in CSS) 
-->show text for the 'Aside' marked post 

If category/or post type 'Link' is used, wrap title in <a> tag linking to a site(<-- how would I do that in WordPress?) 
-->show text for info about the link 

If category/or post type 'Photo' is used, don't wrap title in a <a> tag 
-->show attached image in post, and post text as a caption 

나는이 많은 것처럼 보일 수 있습니다 알고 있지만 내가 쉽게 할-수 확신합니다.

일부 소스 코드는 나에게 모든 방법을 도움이되지 않을 수 있습니다, 그래서 당신은 내가 그것으로 그것을 구현하는 데 도움이 할 수있는 경우 아래에있는 내 index.php를보고있다 : 당신이 입력이 필요한 경우

<?php get_header(); ?> 


<?php if (have_posts()) : ?> 

    <?php while (have_posts()) : the_post(); ?> 

     <div class="post" id="post-<?php the_ID(); ?>"> 

      <article> 
      <!-- <p><span class="metaCat"><?php the_category(', '); ?></span></p> --> 
      <h1><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h1> 
      <p><span class="meta"><?php the_time('F jS, Y') ?></span></p> 
      <hr /> 
      <div class="entry"> 
       <?php the_content('Read the rest of this entry &raquo;'); ?> 
      </div> 

     </div> 
</article> 
     <hr class="big" /> 
    <?php endwhile; ?> 



<?php else : ?> 

    <h2 class="center">Not Found</h2> 
    <p class="center">Sorry, but you are looking for something that isn't here.</p> 
    <?php include (TEMPLATEPATH . "/searchform.php"); ?> 

<?php endif; ?> 

실행할 수있는 index.php 파일에 코드를 입력하면 브라우니 포인트에 대해 잘 생각하게됩니다!

감사합니다. 모든 도움을 환영합니다!

답변

0

마침내 당신이 여기서 의미하는 것을 보았습니다. 이것은 get_post_format() 기능을 사용하여 쉽게 수행 할 수 있습니다. 여기에 제목을 바꾸면됩니다 :

<?php 
$format = get_post_format(get_the_ID()); 
if ($format == 'link') { ?> 
<h1><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h1> 
<?php }else{ ?> 
    <h1><?php the_title(); ?></h1> 
<?php } ?> 

사이트로 연결하는 것에 대한 또 다른 비트이지만, 어떻게 달성하고 싶은지 잘 모르겠습니다. blogroll을 언급하고 있습니까?

"링크"게시 형식에 가장 적합한 옵션은 맞춤 메타 버튼/맞춤 입력란을 사용하는 것입니다. 키를 "URL"로 추가 한 다음 값 필드에 주소를 입력하십시오.

get_post_meta()을 사용하여 URL을 가져와 href에 the_permalink() 대신 사용하십시오.

+0

대부분의 주제가 처음부터 다루어 졌기 때문에 나는 길이에 대해 대답하지 않았습니다. 거기에 쓰여진 것을 받아들이고 필요에 맞게 적응시키지 않을 것입니다 ... 질의에 대한 올바른 응답을 훨씬 적게 투표하십시오. 나는 첫 번째 기대가 산산조각이 났으므로 두 번째가 될 것이다. 응답이 정확하지만 외부 URI에 대한 링크 인 게시 형식에 대한 부분이 누락되었습니다. (이렇게하려면 일부 get_post_custom (get_the_ID()) 헛소리가 필요합니다. –

+0

URL 부분에 관해서는 ... 내가 성취하고자하는 것은 기본적으로 Tumblr에서 이미 수행 된 작업입니다. 사이트/기사의 링크를 게시물의 머리말로 사용하십시오. 게시물을 통해 공유하는 것과 마찬가지로 내 의견이 적혀 있습니다. –

관련 문제