Which code relates the calendar in wordpress widget with post? - wordpress

Wordpress default calendar in widget displays the post published on that particular day if we click a date.I need the code which performing this action.

it is in wp-includes/default-widgets.php in the class WP_Widget_Calendar
In there you will find a call to the get_calendar function. get_calendar itself is in: wp-includes/general-template.php It should be around line 1074.
Just putting get_calendar() anywhere will generate the calendar with click-able posts just as the widget does. Remember there have to be posts to be click-able.
Tested on multiple sites.

Related

Permalink Goes to Old Page

I have been working on a site created by another developer. I have been fixing the site to make it more visually appealing. I am also responsible for adding new events and pictures which i self taught myself to do.
I have a situation where I have a page with the following permalink:
http://www.cic-nj.org/events/
The problem is that this link goes to a page that does not show the edits that i am making under that page and there is no other page listed that shows the info it actually displays.
this is what I have in the editor box on wordpress that I want it to show.
enter image description here
this is what appears when url is used or when i click view
enter image description here
I have been sure to click update and renewing page to view it. it's like its going to a ghost page i can not edit.
Can anyone point me in the right direction on this?
Thanks in advance...
You are experiencing "slug collision": more than one thing in your WP install has the same slug.
The problem that you have is events is a custom post type, with a slug set to events - therefore the url http://www.cic-nj.org/events/ is directing to the listing of events. This is an automatic feature of WordPress. (Note - you can see more details to support this conclusion by the fact that you've got individual events accessible at url's such as http://www.cic-nj.org/events/blue-apron-info-session/ )
Note that custom post type slugs will always take priority over a page / post slug.
You have a couple of options:
If you want a page to display the content that you've created, the page's slug / permalink must be different than events
If it's acceptable, you can rename the slug of the "events" custom post type to something different. This has the potential consequence of losing SEO "juice".
If it's acceptable, you can remove the custom post type, if you aren't going to use them any longer.
NOTE: It may be tempting to ask "how do I remove the custom post type", or "how do I change the post type slug". Those are different questions, and if you need to ask, they should be asked in a different question - not added as a comment below.

Woocommerce: how to display search results using the standard product/shop grid layout (archive page)?

Hej there!
I just did setup Woocommerce successfully in my custom template and everything is working fine — except for the search results layout. When I do perform a search through the very own Woocommerce product search widget, I end getting my results on the standard search results layout, instead of the archive page used for products by the shop plugin.
Category displaying is fine - it uses the archive page (shop grid), tags too, uses the archive page (shop grid). The only problem resides on the widget search results.
The search URL is fine as well... ?s=keyword&post_type=product
Thanks!
Cospefogo.
Well... Problem solved.
After trying to narrow down the problem I did find the cause: I had a obsolete function in my functions.php used to force Wordpress to search on all custom post types, all taxonomies and relevant meta data fields.
This function had a not-dynamic list of targets for the search inside and the custom post type "product" was not present in the group. This is the reason why my search using the Woocommerce product finder widget was being altered.
I removed this problematic function and everything went back to normal.
Thanks for your attention!
Cospefogo.

Roots Theme: How to Remove Sidebar on Tribes Calendar?

I am using the Tribes calendar Tribest Events Calendar and I want the sidebar from my site to be removed. I have gone through this post, but it doesnt work: http://discourse.roots.io/t/roots-and-modern-tribes-events-calendar/603
I have created the duplicate default-template.php but nothing happens.
I was having the same issue with woocommerce until I added "'is_woocommerce'," to the lib/config.php file and it removed it for woocommerce. Is there the same hack that I can use for the Tribes calendar. I just dont know what to script in: "'is_tribes' (???)," I hope someone can help smile
Thanks for any feedback that you can give me.
The plugin provides conditional template tags (a.k.a. functions) in the format tribe_is_*().
E.g. conditionals for calendar pages: tribe_is_upcoming(), tribe_is_month(), and tribe_is_day() (I believe there are other views in the Pro version of The Events Calendar plugin.)
To remove the sidebar from calendar pages in the Roots-based theme, you would pass "tribe_is_upcoming", "tribe_is_month", and "tribe_is_day" to the instantiation of the the Roots_Sidebar class in lib/config.php. To also remove it from single event pages, pass "tribe_is_event".

How can I sort by a custom field date in the WordPress calendar widget?

I'm using "Advanced Custom Fields" along with "Custom Post Type UI" to create events on my Wordpress site. Everything works fine and the templates are in place however I can't get the posts to display properly in the Wordpress calendar widget.
At the moment the posts are filtered by publishing date. However, for my purposes, I need them shown by the date of the event itself – not the day I created the post. I've already got a custom field called "event_date" that's stored in yymmdd format. With that said, is there a way to overwrite the default behavior of the calendar widget to sort by this field?
If not is there a plugin that might help me accomplish this?
You could try this add-on for the Advanced Custom Fields WordPress plugin:
http://wordpress.org/plugins/acf-field-date-time-picker/

Wordpress template page for custom posts

I have a custom post type (that I'm using on a template page), the custom post type is called 'Headerhome'.
When I post say a gallery there I'm trying to get it to redirect to 'single-Headerhome.php', yet it always just goes to 'single.php'.
The name of the custom post type itself is arbitrary, the name of the templage page it's on is 'home'.
I'm really confused, I'm not the best at WP yet so when something simple like this doesn't work I have no idea how to fix it, even after pouring over the codex for an hour.
The name of the custom post type itself is arbitrary, the name of the templage page it's on is 'home'.
Reading this implies that you have a home.php file in your theme, which would automatically display as your front page of your site. This may not be what you desire? More on this here: http://codex.wordpress.org/Creating_a_Static_Front_Page
An example of a custom post type might be an Event. The Event might have custom fields associated with it, like Location, Date, Time, Description. We would probably want new Events to show up on our front page, but also would want to create a custom theme file so when a user clicks on an Event from the home page to view the Event then the Event page shows our Date, Time, Location, Description, etc. We would then create a single-event.php to do this and put in any custom code their.
So (another example), a custom post type of Fruit would have an associated theme file of single-fruit.php. If their is no single-fruit.php then Wordpress will use single.php as the default theme file to display. More on this here: http://codex.wordpress.org/Post_Types#Template_Files
Hope this helps set you in the right direction.

Resources