I've been trying to go through the codex on creating a custom plugin, i managed to get as far as adding it to the admin panel but i am a little stuck on how to add custom fields to it. for example if i wanted to make a menu plugin, and add items, in the backend i would want to add each item that would be in the menu.
It would need an image, title, description, price. How would i add these fields?
If someone can help me out or even point me to the right reference material or tutorial that would be amazing.
i uploaded the files i did here for reference: https://www.dropbox.com/s/dn31o8nxfd62bo0/menu-plugin.zip?dl=0
Thanks.
This is probably a good place to start: https://codex.wordpress.org/Writing_a_Plugin
But also, Advanced Custom Fields may provide you with additional features that you could use: http://www.advancedcustomfields.com/
Related
I am trying to add in an option in the admin panel that let's a user populate an image gallery that I've created.
Looking through the Customizer API, I see how to add options, but it's still not what I want.
Is it better to build a plugin? Any reference that's recommended?
There are multiple carousels you could use. As far as I know, there should be a plugin but not many. I reccommend using Bootstrap's carousel, though
The wordpress plugin I'm developing needs to be able to display some custom HTML in posts. I know that this is possible with shortcodes, but unfortunately I'm limited to using 'custom fields'. In order to deside which HTML should be added, the authors set a custom field (using a post-meta-box in the backend created by the plugin).
But I can't find any documention on how to achieve this. It's easy if you edit the wordpress theme, but this plugin should work across different themes.
Anyone able to guide me in the right direction? Thanks!
I am designing a WordPress theme and would like to post recipes. The text (ingredients, etc.) will go into the main post window, but I would like to include a picture, which should become the background picture of the whole window. The usual Upload/Insert includes the picture into the post. Is there any better way of associating a picture to a post? Should I use the Custom Fields for this?
To make your life easy i recommend a plugin for that The Advanced custom fields
Its very easy to use. You can get full documentation here
This plugin always save my development time.
Hope it will help
Check out WP-Alchemy.
http://www.farinspace.com/wpalchemy-metabox/
It's incredible. It can be implemented into a plugin, or a theme. I have used it and it works great!
Otherwise, the term you are looking for is "Wordpress Custom Meta Box" throw that in google, and you will get more info than you probably wanted.
If you are more of a wordpress codex junkie, check out the add_meta_box function.
http://codex.wordpress.org/Function_Reference/add_meta_box
I'm developing a theme for wordpress and would like to know the best way to show highlights on the home page.
Examples:
I thought two ways:
Custom post types -a custom post "highlight" with metabox for image, text and link.
Theme Options - a page with options for each box.
What is the right way?
Neither. What you want can be achieved using either Wordpress' core functions and/or Custom Fields. Consider using Custom Meta Boxes if you have a client that requires a more intuitive setup, or installing something like the Types Plugin to do it for you.
This will allow you to attach your own variables to given Posts/Pages.
To gain access to a post's Custom Fields, click the Screen Options button at the top of the Post Editor to enable Custom Fields.
Personally, I would Enable Support for Thumbnails for your Highlights image, use The Excerpt for your Highlight copy, and use either The Title or a Custom Field for the heading.
This way, you can keep all your eggs in one basket rather than overcomplicating things with Custom Post Types or Theme Options Pages.
Look at the Plugin "Ether Content Builder"
You could use either of the methods you've suggested. In my opinion getting involved with lots of meta boxes on one specific page template for this is a total waste of time - there is only an image, a header and an excerpt linking to a post/page. Three posts (whether custom or not) will handle that with featured image, excerpt and the page/post title.
I also think doing a Custom Post type is too much just for three posts on the homepage. If you go the posts route just create a new post category called Home Highlights and put your three posts in there, pull them in via a custom loop built on WP_Query.
Yes you can go the Theme Options route too. If it's the client updating the site then it can look quite professional this way, I've started using a plugin called Options Tree after it came integrated with Super Skeleton, it makes it very easy to build your custom theme options which work just as well too.
A matter of opinion really, rather than a hard and fast 'this one is definitely better'!
I want to add a google maps widget to Pages on a Wordpress site. They all have the same Template with a Sidebar but the map will be unique for each. I feel like there should be a way to populate the widget from the edit page screen for that Page. Does each Page actually need it's own Template?
This seems limiting maybe I'm missing something. If the question is unclear I let me know but I think this should be something ppl have run up against before.
I would suggest the integration of a wordpress plugin to accomplish this. It will be fairly easy to do.
If you want to do this without purchasing any 'pro' versions of a plugin and don't mind writing some simple code, then I would suggest Simple Google Map. You will have to insert a shortcode into the widgetized sidebar area. Here is the plugin link - http://wordpress.org/extend/plugins/simple-google-map/
In order to customize each page's sidebar area, You need to write some code. Please refer to this article which will explain how http://www.wpbeginner.com/wp-themes/display-different-sidebar-for-each-post-and-page-for-wordpress/
It involves a simple alteration of your 'single.php' file and the usage of 'custom fields' so that you will be able to do this from the edit screen of the page, just like you wanted to do!
Use a plain text widget for each map and Widget Logic to select the page it appears on: WordPress › Widget Logic « WordPress Plugins