Results 1 to 3 of 3

Thread: Adding a dot in between to my table of content list style

  1. #1
    Join Date
    Apr 2020
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Adding a dot in between to my table of content list style

    I'm banging my head to the wall since I can't seem to find how to do a simple thing. I have a list of content made with a WP plugin called Table of content plus. It only lets you do two option: show the number list or hide it. I want to show it, but I want to add a simple "." before the number.

    For example, in the first one I want it to be shown like this: "1. Resumen 'too long; didn't read'" instead of "1 Resumen 'too long; didn't read". Just a simple "." before the number, but I'm not able to figure it out! I tried all the css property list-style with no results.

    Any help will be much appreciated.

    Thank you!

  2. #2
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,284
    Thanks
    97
    Thanked 104 Times in 102 Posts

    Default

    I could probably create a short php script that will do what you want, but I need to take care of a few things first. I'll try to have it for you by tomorrow at the latest.
    To choose the lesser of two evils is still to choose evil. My personal site

  3. #3
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,284
    Thanks
    97
    Thanked 104 Times in 102 Posts

    Default

    I'm sure this can be improved upon, but try this:

    Code:
    <?php
    $arr="1 this is list item 1.
    2 this is list item 2
    3this is list item 3";
    $arr=explode("\r\n",$arr);
    
    foreach ($arr as &$value)
    {
    $value = preg_replace('/(^\d{0,3})/',"$1.",$value);
    }
    $arr=implode("<br>",$arr);
    echo"$arr";
    ?>
    If I can see the text that needs to be formatted, it will help me to understand what you are working with and how the above code needs to be modified.
    To choose the lesser of two evils is still to choose evil. My personal site

  4. The Following User Says Thank You to james438 For This Useful Post:

    Marywilliams (05-06-2020)

Similar Threads

  1. Problem with the style of list
    By animsaj in forum CSS
    Replies: 1
    Last Post: 01-19-2015, 06:08 AM
  2. List style wont work
    By fodo in forum CSS
    Replies: 8
    Last Post: 01-23-2009, 09:29 PM
  3. list-style-image problem in IE
    By Moshambi in forum CSS
    Replies: 1
    Last Post: 10-18-2008, 06:36 PM
  4. Resolved Adding and Deleting table row style
    By bigalo in forum JavaScript
    Replies: 16
    Last Post: 08-01-2008, 05:13 PM
  5. Replies: 1
    Last Post: 05-23-2007, 03:55 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •