Plugin Directory

Changeset 1215005


Ignore:
Timestamp:
08/07/2015 05:42:05 PM (11 years ago)
Author:
iTux
Message:

New Parameter show_list to explicitly hiding the "Jump to" list. Contributed by billthefarmer.

Location:
post-index/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • post-index/trunk/php/postsummary.php

    r1202863 r1215005  
    176176        }
    177177   
    178     function printOut($maxColumns = 1, $showLetter = true)
     178    function printOut($maxColumns = 1, $showLetter = true, $showList = true)
    179179    {       
    180180        if(is_null($this->items))
     
    188188                echo '<h2>'.$subCategory.'</h2>'."\n";
    189189                // Parse Subcategory
    190                 $this->printItem($item, $this->itemCount[$subCategory], $subCategory, $maxColumns, $showLetter, 'h3');
     190                $this->printItem($item, $this->itemCount[$subCategory], $subCategory, $maxColumns, $showLetter, $showList, 'h3');
    191191            }
    192192        }
    193193        else {
    194             $this->printItem($this->items, $this->itemCount, $this->category, $maxColumns, $showLetter);
     194            $this->printItem($this->items, $this->itemCount, $this->category, $maxColumns, $showLetter, $showList);
    195195        }
    196196       
     
    203203     * @param int $maxColumns determines the amount of columns
    204204     */
    205     function printItem($item, $itemCount, $categoryName, $maxColumns, $showLetter, $headerTag = 'h2') {
     205    function printItem($item, $itemCount, $categoryName, $maxColumns, $showLetter, $showList, $headerTag = 'h2') {
    206206        echo '<p>';
    207207        $categoryId = uniqid();
     
    219219                echo '<hr />';
    220220        }
    221        
    222         if($itemCount > 0)
    223         {
    224             echo '<p>' . __('Jump to', 'post-index') . ' ';
    225          
    226             $groups = array_keys($item);
    227             $countOfGroups = count($groups);
    228          
    229             for($i = 0; $i < $countOfGroups; $i++) {
    230                 echo '<a href="#letter_' . $categoryId . '_' . $groups[$i] . '">' . $groups[$i] . '</a>';
    231                 if($i < ($countOfGroups-1)) {
    232                     echo ',';
    233                 }
    234                 echo ' ';
    235             }
    236            
    237             echo '</p>' . "\n";
     221
     222        if ($itemCount > 0) {
     223            if ($showList) {
     224                echo '<p>' . __('Jump to', 'post-index') . ' ';
     225
     226                $groups = array_keys($item);
     227                $countOfGroups = count($groups);
     228
     229                for ($i = 0; $i < $countOfGroups; $i++) {
     230                    echo '<a href="#letter_' . $categoryId . '_' . $groups[$i] . '">' . $groups[$i] . '</a>';
     231                    if ($i < ($countOfGroups - 1)) {
     232                        echo ',';
     233                    }
     234                    echo ' ';
     235                }
     236
     237                echo '</p>' . "\n";
     238            }
    238239           
    239240            $itemCountPerGroup = 2;                         // used for the calculation of items per column.
  • post-index/trunk/post-index.php

    r1202863 r1215005  
    7171                                           , 'columns' => 1
    7272                                           , 'show_letter' => true
     73                                           , 'show_list' => true
    7374                                           , 'groupby_cf' => null
    7475                                           )
     
    7879
    7980            $show_letter = filter_var($show_letter, FILTER_VALIDATE_BOOLEAN);
     81            $show_list = filter_var($show_list, FILTER_VALIDATE_BOOLEAN);
    8082                   
    8183            if(empty($post_type) && empty($category)) {
     
    8789            ob_start();
    8890            $ps->parse($category, $groupby, $groupby_cf, $categoryslug, $post_type);
    89             $ps->printOut($columns, $show_letter);
     91            $ps->printOut($columns, $show_letter, $show_list);
    9092       
    9193            $content = ob_get_contents();
  • post-index/trunk/readme.txt

    r1202863 r1215005  
    7070* **columns**: The amount of columns. Default is 1.
    7171* **show_letter**: If set to false, the grouping letter will not be generated.
     72* **show_list**: If set to false, the "Jump to" list will not be generated.
    7273* **groupby_cf**: If defined, the custom field value will be used for grouping and sorting instead of the blog posts title.
    7374
     
    9091
    9192* Added: Use any custom field value to group your index with. Just specify it in the shortcode like `[post_index groupby_cf='Author']`. It does work together with grouping by subcategory and the default firstLetter grouping.
     93* Added: New Parameter show_list to explicitly hiding the "Jump to" list. Contributed by billthefarmer. (Usage: `[post_index show_list=false]`)
    9294
    9395= 0.7.4 =
    9496
    95 * Added: Dutch translation. Thanks to aadje93.
    96 * Added: Portuguese translation. Thanks to luisapietrobon.
     97* Added: Dutch translation. Contributed by aadje93.
     98* Added: Portuguese translation. Contributed by luisapietrobon.
    9799* Added: Parameter show_letter to explicitly hide the grouping letter. (Usage: `[post_index show_letter=false]`)
    98100* Fixed: On PHP configurations having error_reporting set to include E_NOTICE, saving pages ended up with a warning page.
Note: See TracChangeset for help on using the changeset viewer.