Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7053877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:33:30+00:00 2026-05-28T03:33:30+00:00

well, I want to set a different color for each event. Basically that’s it

  • 0

well, I want to set a different color for each event. Basically that’s it
I’m reading events from an Ajax call
Thanks

EDIT: I don’t want to wait 8 hours for answer my own question

first of all, my apologize for not include code example on my answer, but thanks to Brandom who guide me to find my answer 😛

So, here is my .js file which has an Ajax call to my events:

$(document).ready(function() {

    $('#calendar').fullCalendar({
      events: {
        url:'http://myhost/mysite/ajax/',
        type: 'POST',
        data:{ trigger: 'eventos' },
        error: function() { alert('there was an error while fetching events!'); }
      }
    });
}

then, in my .php file who receives my ajax call I have this:

<?
 if($_POST['trigger'] == 'eventos'){
     $eventos = new WP_Query();
     $eventos->query(array(
         'post_type' => 'evento'
         )
      );
     $eventdata = array();
     while($eventos->have_posts()) : $eventos->the_post();
        $elem = array(
          'id' => $post->ID,
          'title' => $post->post_title,
          'start' => get('evento_fecha_inicio',1,1,$post->ID),
          'end' => get('evento_fecha_termino',1,1,$post->ID),
          'allDay' => 'false',
          'color' => '#'.rand(000000,999999), //this is what I'm was looking for!
        );
        $eventdata[] = $elem;
     endwhile;

     echo json_encode($eventdata);
 }
?>

(the ‘get’ functions corresponds to magicfields‘ functions). So there it is, with a rand(); in the color value I can generate a random color for each event element

(sorry for my english)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:33:31+00:00Added an answer on May 28, 2026 at 3:33 am

    If you’re using FullCalendar v1.5 you can set the color, backgroundColor, borderColor and textColor properties of the Event Object

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to implement a easy hsv color picker that fit well into my
I want to be able to read any well-formed RSS/ATOM file. That would mean
Starting a new rails project and we have a well-thought-out color palette, and want
I got this code from someone and it works very well, I just want
I have a data set of different locations, and want to show the nearest
Just want to ask if, I need to set an alarm for different days,
I want to serve up specialized RSS feeds on a different subdomain from the
I want to be able to set the color inside a Text Field to
I have five different websites set up using Wordpress 3.0 Multisite. They each contain
Well I want to render a self closing tag say <img> tag like this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.