I cannot find a category specific calendar, or any sample code to allow me to get slightly dirty... Anyone know of a category specific calendar so I can call it for example:
get_calendar(true, true, $cat_id);
Otherwise I will have to copy the get_calendar function and make my own get post by category loops sigh
Ended up making my own calendar.
This is a really shaky way of doing it but it works great.
Create a new page in your template directory called “the-calendar.php” place the following code in it: http://pastebin.com/sUSzJMWM
Create a new script file (that has access to jquery).
Put the following code in it
(MAKE SURE YOU HAVE SET site_url to equal “get_template(‘blog_info’) . ‘/’”): http://pastebin.com/Q16ibAZ0
Now just include this wherever you want the calendar to be (keeping in mind that the above script must be accessible):
http://pastebin.com/fyhXrCiW
Don’t forget to style your date.php page in your wordpress theme directory!!!
Here is some default styling that looks awful but should get you started:
http://pastebin.com/NMauFJWq
The Calendar works by calling (via AJAX) an external PHP file that gathers and echos the HTML code that generates the table. On the success of the AJAX, it just fills the specific div with the returning html.
Please feel free to expand on the code and also ask questions if you can’t get it to work! I hope it saves you some time!
Related
I am new here and looking for some help to copy content from a specific page on another site.
I tried
$result get_file_contents('https://ncov.totok.ai/details');
echo print $result
something like.
Where I am trying to get.
I have a Wordpress website. because Wordpress does not allow us to use PHP code directly into posts and pages. therefore, I added a plugin called Insert PHP and some other to use their shortcodes into posts or page to run custom code.
when I save file and check preview, nothing shows there.
I would like to ask the professionals to advise the way to do it.
Result Page: how to copy the active result from this page
I've found a number of plugins for wordpress that add a link to the table in the backend to clone or duplicate a post or page (Duplicate Post, Clone Post, and Post Duplicator). This is nice, but I'm building a bit of an app on wordpress where I'm using a custom post type as an entry and would like to be able to quickly copy an entry with a link from the frontend of the site (similar to how edit_post_link works but without jumping into the backend).
I'm using Gravity Forms for the create and edit functionality for entries on the frontend, but I can't quite figure out the best approach for a secure way to submit a request, execute the clone query, and the return to the same page I was on before (i.e. not jumping into the backend). Gravity Forms Post Updates plugin does something similar with a do_action call to generate a link. I've looked through this function and generally get what's happening, but I'm not sure if I need all of the extra plugin class structure.
I was hoping to find an example of a function that could create a secure url with a nonce and then another function we validate the url and execute the query and return to the previous page. Is this the right way to go or am I barking up the wrong tree? If so, any code samples or examples that might be able to help get me started?
Much appreciated!
I found this post (http://rudrastyh.com/wordpress/duplicate-post.html) and was able to figure out what I needed to. Instead of adding a filter to include the link in the backend, I instead created an action that can be called with do_action and generates the link. I also have a page and page template that is solely for executing the call and then redirecting back to the referring url.
I know the title is messed up, but basically I have: news.php which is kind of a dashboard where I get all news from DB and I can perform actions on them (update, delete, insert new) and also I display them in a traditional way (tables). The problem is I want the title of the first news to be displayed on my homepage(footer), but when I include the news.php file withinclude(), the hole code it's included and on the home page I get all the things I have in news.php, all the news, the buttons (edit, add, delete) and everything else. Is there any way of including one .php file but not displaying it ? I want to create a function that only displays the title of the first news but I can't because the hole code is imported and displayed.
Thank you for your quick answers. Having only this small problem, I'll just create another file where I get the latest news without using frameworks
You need to create a function library so that you can call specific segments if you want.
But here's a quick shortcut. copy news.php into news2.php. go into news2.php delete all the parts you don't want; include news2.php instead
You could try making another single file called firstnews.php which would only retrieve that particular first news item and include that.
You should maybe read up on MVC frameworks, its a good way to seperate data retrieval, manipulation, and then actually showing the data. For example one php file would hold a function that retrieves all news item, and another function that only gets the latest news article. Then the actual file which shows the user data would simply choose which function it wants to use.
Its a lot to get into, but the codeigniter framework is a great way to get familiar with MVC frameworks and it will open a lot of doors for you.
CodeIgniter Homepage
Manual on how to setup and use CodeIgniter
For now though try just making a seperate php file that only retrieves the latest news item instead of all of them and include that.
Hope this helps!
-Gui
I have already working guestbook script, which I’d like to add to my prestashop on a separate page. The problem is, that I can’t find where to place it.
I’ve browsed through a lot of modules, but it looks like all of them are registering to either left or right column hook. What I need is to display the script in the middle column, which basically consists of only calling one or two methods that will render out the correct html.
I don’t need to do anything with configuration or accessing the prestashop database, or even create a page in the administration. Basically the same thing I’m trying to achieve could be done using an iframe in a CMS page, where the iframe’s url would link to the guestbook script, but that really doesn’t seem like a clean solution to me.
Is there any simple way to make a separate php script display on the “main” center column?
Isn't the include able to help you?
<div><?PHP include(something)?></div>
<div><?PHP include(something else)?></div>
etc
you can place if conditions if needed.
Since I had some comments on the formulation of my question, I decided to rewrite it completely. And also, I understand a little bit more about wordpress so it should make more sense now.
So, let's start with what I'm trying to accomplish by using a simple example:
Goal:
Make a search engine for some products and link to them using a database to generate the information.
Result:
http://my.site.url/wordpress/<plugin-name> <-- The page with the "search" and "search result
http://my.site.url/wordpress/<plugin-name>/products/<product_name> <-- When click on a search result
Part 1:
I want to make a plugin with the name "plugin-name" Right now, I put my code in
http://my.site.url/wordpress/wp-content/plugins/<plugin-name>
On the activate, I create some tables with some data. Since there is no page yet, I create 1 on the fly using the API call 'wp_insert_post'. I give the name and slug "myPlugin".
So, when I go on the main site, I can see my newly created page "myPlugin". But right now, there is no content attached to it. To do so, from what I understand, I need to create a page in my plug-in directory named "myPlugin.php".
http://my.site.url/wordpress/wp-content/plugins/<plugin-name>/myPlugin.php
So, how do I link the page I created manually and the source file in the plugin directory?
Part 2
When clicking on a link in the search result, I would like to have a page "product.php" and display its information. So, is it possible to create a "temporary url" for the result using sub pages (see result at the beginning)? And if possible, how can we achieve that?
Thanks in advance and I hope it's clearer.
u can find how to create plugin from
http://ditio.net/2007/08/09/how-to-create-wordpress-plugin-from-a-scratch/
in plugin write function for search(as per u r logic) fetch result
create a custom page refer video from www.wordpressmax.com/customize-wordpress/custom-page
in custom pages template in between get_header(); and get_footer(); call search function and display records.
Thats it.
thisMayhem is right. This sounds like a bunch of nonsense. But, if you're trying to make a WP page that executes some custom PHP, look up the WP template hierarchy.
What you can do is this:
create a WP "page" - call it "Search results."
create a template directory file called page-search-results.php (filename corresponds with slug of page from step 1)
put some generic header/footer stuff there (see other template files - most often it's just a question of putting in <?php get_header(); ?> and <?php get_footer(); ?>)
put PHP code in that thar page. in them hills.
if you use a caching plugin, may want to put an exemption for /search-results/
So, when someone pulls up http://your.site/search-results/ - your custom PHP code will execute. It's up to you to make that logic and communication happen - whether via $_GET or $_POST, etc.
I'm sorry you're experiencing some problems. Unfortunately as we say above because it's a 'one off' for a client project we can't support it - it works for them :) Feel free to rip it apart and retest and if you have any success let us know.