Weergave homepage (Wordpress)
De homepage wordt prima weergeven, alle laatste artikelen verschijnen in samenvattend formaat. Wanneer echter wordt doorgeklikt naar een artikel, en deze volledig verschijnt, verschijnen daaronder opnieuw alle samenvattingen. Dit wil ik graag voorkomen. Zie hier de code van de betreffende pagina:
Code (php)
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
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
<?php get_header();
// [grid column setting]
$col_w = 290; // width of grid column
$gap_w = 35; // padding + margin-right (15+15+5)
$max_col = 2; // max column size (style div.x1 ~ xN)
// * additional info *
// check also "style.css" and "header.php" if you change $col_w and $gap_w.
// - style.css:
// div.x1 ~ xN
// div.grid-item
// div.single-item
// ... and maybe #sidebar2 li.widget.
// - header.php:
// gridDefWidth in javascript code.
//
// if you want to show small images in main page always, set $max_col = 1.
// [grid image link setting]
$flg_img_forcelink = true; // add/overwrite a link which links to a single post (permalink).
$flg_img_extract = false; // in single post page, extract thumbnail link to an original image.
$flg_obj_fit = 'large-fit'; // none | small-fit | large-fit ... how to fit size of object tag.
// * additional info *
// if you use image popup utility (like Lightbox) on main index, set $flg_img_forcelink = false;
?>
// [grid column setting]
$col_w = 290; // width of grid column
$gap_w = 35; // padding + margin-right (15+15+5)
$max_col = 2; // max column size (style div.x1 ~ xN)
// * additional info *
// check also "style.css" and "header.php" if you change $col_w and $gap_w.
// - style.css:
// div.x1 ~ xN
// div.grid-item
// div.single-item
// ... and maybe #sidebar2 li.widget.
// - header.php:
// gridDefWidth in javascript code.
//
// if you want to show small images in main page always, set $max_col = 1.
// [grid image link setting]
$flg_img_forcelink = true; // add/overwrite a link which links to a single post (permalink).
$flg_img_extract = false; // in single post page, extract thumbnail link to an original image.
$flg_obj_fit = 'large-fit'; // none | small-fit | large-fit ... how to fit size of object tag.
// * additional info *
// if you use image popup utility (like Lightbox) on main index, set $flg_img_forcelink = false;
?>
<div id="single-wrapper">
<div id="post-title2">
<h2 class="post-title"><a href="" rel="bookmark"></a></h2>
<div class="post-body">
Code (php)
</div>
Code (php)
1
<?php wp_link_pages('before=<p class="pagination" id="post-pagination"><span class="prefix">' . __('Pages:') . '</span>'); ?>
<p class="post-meta">
Gedropt op om
met de tags .
</p>
</div>
<div class="single-item">
<h2>Not Found</h2>
<p></p>
</div>
</div><!-- /single-wrapper -->
Code (php)
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
<?php /* make a new query for grid items (in single page) */
$new_query_arg = 'paged='.$paged;
// use this code if you want filter items by category.
/* $arr_catID = array();
foreach( get_the_category() as $cat) $arr_catID[] = $cat->cat_ID;
if ( count($arr_catID) ) $new_query_arg .= '&cat=' . join(',', $arr_catID);
*/
query_posts($new_query_arg);
?>
$new_query_arg = 'paged='.$paged;
// use this code if you want filter items by category.
/* $arr_catID = array();
foreach( get_the_category() as $cat) $arr_catID[] = $cat->cat_ID;
if ( count($arr_catID) ) $new_query_arg .= '&cat=' . join(',', $arr_catID);
*/
query_posts($new_query_arg);
?>
<div id="grid-wrapper">
Code (php)
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
<?php
$content = get_the_content('Lees het hele artikel.');
$content = apply_filters('the_content', $content);
list($col_class, $grid_img) = adjust_grid_image(
$content,
$col_w,
$gap_w,
$max_col,
$flg_img_forcelink,
$flg_obj_fit
);
?>
$content = get_the_content('Lees het hele artikel.');
$content = apply_filters('the_content', $content);
list($col_class, $grid_img) = adjust_grid_image(
$content,
$col_w,
$gap_w,
$max_col,
$flg_img_forcelink,
$flg_obj_fit
);
?>
<div id="post-title2">
<h2 class="post-title"><a href="" rel="bookmark"></a></h2>
<div class="post-body">
Code (php)
1
2
3
4
5
6
7
2
3
4
5
6
7
<?php
$content = preg_replace('/<img(?:[^>]+?)>/', '', $content); // remove img tags
$content = preg_replace('/<a([^>]+?)><\/a>/', '', $content); // remove empty a tags
$content = preg_replace('/<p([^>]*?)><\/p>/', '', $content); // remove empty p tags
$content = preg_replace('/<object(.+?)<\/object>/', '', $content); // remove object tags
echo $content;
?>
$content = preg_replace('/<img(?:[^>]+?)>/', '', $content); // remove img tags
$content = preg_replace('/<a([^>]+?)><\/a>/', '', $content); // remove empty a tags
$content = preg_replace('/<p([^>]*?)><\/p>/', '', $content); // remove empty p tags
$content = preg_replace('/<object(.+?)<\/object>/', '', $content); // remove object tags
echo $content;
?>
</div>
<p class="post-meta">
Gedropt op om .
<br />
</p>
</div>
<div class="grid-item x1">
<h2>Not Found</h2>
<p></p>
</div>
</div><!-- /grid-wrapper -->
<div class="pagination" id="grid-pagination">
</div>
</div><!-- /container -->
Gewijzigd op 26/04/2011 22:26:46 door Floris Faberge
Er zijn nog geen reacties op dit bericht.