• Resolved barmou

    (@barmou)


    Hello,
    I have to put different color for each post, how can I do to assign a color to a post when I’m writing it please ?
    Only 2 colors is not enough, and I can’t choose which color is assigned to which post. When a post is on the right it’s a color, when it’s on the left an another, but sometimes I need both post (left and right) in the same color.
    Is it possible and how ?

    Thanks in advance for answering !
    Have a nice day,

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author CoolHappy

    (@narinder-singh)

    Hi @barmou,

    Yes,It is possible you can set color of each story(post).but you have to modify small code snippet.

    Please follow below mentioned steps:-
    1 . ADD META for story color.

    Goto to this path:- cool-timeline\includes find metaboxes.php

    Open it in your text editor.
    Goto line no # 15 find this code:-
    $ptype=get_post_type();

    Please add this code below this line.

    
     $ct_metaboxes[] = array('name' => 'story_color',
              'label' => __('Story Color', 'cool_timeline'),
              'type' => 'text',
               'desc' => __('Add here your story color code E.g#000.', 'cool_timeline'));

    2 Show color on timeline:-

    Please open :- cool_timline_template.php file

    Goto line no # 215 find this code:-

    ctl_html .='<div class="events"><h4 class="events-heading">' . get_the_title() . '</h4>';

    Just replace it with below mentioned code

    $storycolor = get_post_meta(get_the_ID(), 'story_color', true);
    $storycolor=!empty($storycolor)?$storycolor:"";
    $ctl_html .='<div class="events"><h4  style="background:'.$storycolor.';" class="events-heading">' . get_the_title() . '</h4>';

    Please let me know if you need further assistance.

    Regards,

    Cool Timeline Team.

    Thread Starter barmou

    (@barmou)

    Hi,
    Thank you so much for helping, you’re so nice !!
    It’s almost perfect !
    But I still have a little problem, only left stories takes the colour I choose. Stories on the right stays first colour, even if I try to assign a special colour.
    Do you know why ?

    Thanks again for your help !
    Barmou

    Thread Starter barmou

    (@barmou)

    Hello,

    Sorry but I’m waiting for your answer, only half of the stories took color I choose.
    What can I do please ?

    Thanks in advance !

    Thread Starter barmou

    (@barmou)

    Hi,
    I fixed it by myself,
    I just had to put this at line 186 in cool_timline_template.php

    $storycolor = get_post_meta(get_the_ID(), 'story_color', true);
    $storycolor=!empty($storycolor)?$storycolor:"";
    $ctl_html .='<div class="events"><h4  style="background:'.$storycolor.';" class="events-heading">' . get_the_title() . '</h4>';

    You advised me to put it at line 215 but it just affected left post, when I added at line 186 it was for right post and it works good now.
    Now I’ve to find how to change the little circle and little arrow’s color because they don’t take story’s color !

    Thanks again

    Plugin Author CoolHappy

    (@narinder-singh)

    Thanks,

    In order to add change the little circle and little arrow’s color you have to add these styles based upon post ID.

    .timeline dl dd.even .circ{
        background-color: red;
    }
    .timeline dl dd.odd .circ{
        background-color: red;
    }
    
    .timeline dl dd.even .events:before{
        border-right-color: #1e73be;
    }
    .timeline dl dd.odd .events:before{
        border-left-color: #1e73be;
    }

    Hi,
    I put different colours for each post but as @barmou remarked, the little circles and arrows don’t take the colour of the post. I tried to add the style that you recommended but it did nothing. Any other alternative?

    Thank you

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘choose color for each post’ is closed to new replies.