Breadcrumb navigation on Wordpress
I have just worked on the breadcrumb navigation on my Wordpress site, which will be my base work for the vocational skill competition for this weekend.
It took longer than I had expected, because I misunderstood several concept.
First, I confused post objects with post IDs when I deal with a post with its ancestors.
Finally I decided to control everything based on post IDs rather than post object, because when I tried to obtain the post object of the parent object.
Second, I have misunderstood array operation in php.
I wanted to connect two arrays like [apple, orange, banana] and [dog, cat ,bear] into
[apple, orange, banana, dog, cat, bear].
I had thought that the array_merge function inappropriate because I had thought it overwrite the former one with latter one and all I would get in the example above would be all animals, losing fruits. (This function do overwrite associative array and I have known this by reading examples of building a mini blog framework)
It took longer than I had expected, because I misunderstood several concept.
First, I confused post objects with post IDs when I deal with a post with its ancestors.
Finally I decided to control everything based on post IDs rather than post object, because when I tried to obtain the post object of the parent object.
Second, I have misunderstood array operation in php.
I wanted to connect two arrays like [apple, orange, banana] and [dog, cat ,bear] into
[apple, orange, banana, dog, cat, bear].
I had thought that the array_merge function inappropriate because I had thought it overwrite the former one with latter one and all I would get in the example above would be all animals, losing fruits. (This function do overwrite associative array and I have known this by reading examples of building a mini blog framework)
Comments
Post a Comment