I'm writing a custom wordpress plugin and trying to incorporate some functionality from a third-party plugin. That plugin seems to use add_meta_box to create the fields for settings options on the plugin admin pages. I searched the entire source code of the plugin for add_settings_field and it doesn't occur once. Are the two functions basically interchangeable? From the WP Codex, it seems that add_meta_box is primarily for the purpose of adding "a custom section to the post and page editing screens" -- i.e. not so much intended for the admin settings/options forms. On the other hand, the 3rd-party plugin seems to work very well, which is why I'm borrowing from it...
So in short my question is this: can someone please explain correct usage for the add_meta_box and add_settings_field functions? Thanks! Please let me know if anything about this question is unclear and I will do my best to rephrase.
This is a settings field (Slug):
This is 2 Meta Boxes (publish and categories):
Related
Is it possible to add custom options (checkboxes and selectfields) to the default gallery settings in wordpress and then query them as parameters in the code?
Examples or links to corresponding tutorials would be great :)
See if advancedcustomfields helps you. This allows you to create additional option fields. But then you would have to deal with the plugin yourself.
But if you do a lot with WordPress and with WordPress programming you can generally recommend advancedcustomfields anyway.
I was wondering if it was possible to use the advanced custom fields - wysiwyg editor as the default editor for the main content and let yoast read that instead of the default?
Or if that isn't possible then if it is somehow possible to dublicate the content from acf to the main editor.
Or if there is any other way please help.
Thanks
This answer is a bit slow in coming, but we had the same exact question and decided to build a plugin to do this:
http://wordpress.org/plugins/ns-seo-custom-fields/
We just released it and found others looking for a solution like this question and hope that it's helpful to the great WP community.
There are a couple of solutions you can work with.
If you search for Yoast and ACF on the plugin directory you can find the one you like best: https://wordpress.org/plugins/search.php?q=yoast+ACF
We have a plugin of our own: https://wordpress.org/plugins/yoast-seo-acf-analysis/
Which is open source, so if you find any problems or think of enhancements you can create an issue at the github project: https://github.com/Yoast/yoast-acf-analysis
Hope this helps you.
Jip from Yoast
I'm creating a site where rarely, but it will happen, I will have a guest author. I looked at plugin for author boxes and none are basic enough for my needs.
I'm creating some basic CSS styles and hard coding an author box for those few times I need to worry about this.
What code would I put in a post to pull an avatar based on an email address? Seems like this is possible with a small snippet of php. Is there an easy way to create a shortcode to do it for me? I've only dabbled in WordPress modifications.
Thanks.
What I would do is use the Shortcode API:
http://codex.wordpress.org/Shortcode_API
With this, you can register a shortcode like
[author_avatar]
This shortcode would be simple, it would just use get_avatar()
http://codex.wordpress.org/Function_Reference/get_avatar
Based on the Shortcode API, you could essentially pass parameters through the shortcode, example:
[author_avatar email="author.name#domain.com" size="32"]
Than use wp_enqueue_style() to pull in your css
http://codex.wordpress.org/Function_Reference/wp_enqueue_style
I apologies for being brief I hope this is useful.
I am a food blogger and have recently learnt about recipe rich snippets. I found some material online, mostly being about plugins. I tried using ZipList plugin, which is actually pretty good, but
For some posts, I cannot add pictures within the recipe box and
I cannot add alt text to my pictures (which I find to be quite SEO-unfriendly or is it?).
So, I was thinking of trying to implement it by myself onto my website.
Any good links or advice on how to do it? I tried looking on google but I am only coming up with plugin tutorials.
Yes, your search results are correct.
If you don't want to use a plugin, you have to code it yourself. But this is the kind of thing that you don't want attached to your theme's functions.php ("without a plugin"). Because you have to be able to swap themes and preserve this functionality. Themes are for design and content display. Plugins for functionality. All those themes with SEO incorporated are simply dumb.
So, you end up writing your own plugin. See this article: Create a functionality plugins instead of using Functions.php.
What is a functionality plugin?
Traditionally, if you wanted to create a new function for your blog to add to its functionality, the advice has been to add the code snippet to your theme’s functions.php file. Now that’s all well and good and it will work fine, but what happens when you change your site’s theme (which you can guarantee will happen at least every few years) or the theme gets updated? Since functions.php is located in your active theme folder, if you change your theme, it inherently becomes defunct.
All that being said, what I'd suggest is that you create a Custom Post Type to handle your recipe snippets. You'll have all the default functionality of WordPress customized to your needs. The CPT could have only Title, Content and Featured Image, eventually your own taxonomy (recipe categories).
Useful links:
Documentation of CPTs
Smashing Magazine tutorial
WP Tuts tutorial
Or you can use a nice plugin to create your CPT :)
I created a wordpress plugin and I added shortcode feature to it.
but i want to execute only one shortcode and prevent applying of multiple shortcodes if the administrator did so.
thanks.
You may find what you need here:
https://wordpress.stackexchange.com/questions/40733/check-for-shortcode-in-post-pages-and-widgets-and-template-files
However please note that if you allow only one shortcode to run, if your client installs a plugin that used shortcodes this will not work.
Why you need this anyway? Maybe we can find a better solution :)