How to add custom field in Sidebar under Feature Image column? - wordpress

I am using WebDevStudios/CMB2 to create custom fields for WordPress posts, that is working fine. My question is how can I add field in sidebar in area where Featured Image located.

You can use add_meta_box() for solving your problem. This function should be called from add_meta_boxes action. For more information please refer to http://codex.wordpress.org/Function_Reference/add_meta_box.

Related

How to use an image for a blog post thumbnail, but NOT have it be the featured image on the top of the post?

I have an image that I would like to be used for thumbnails for the page, but I don't want that as a featured image when users come to the page. Does anyone know how to do this in wordpress?
Thank you.
You probably want to use ACF (Advanced Custom Fields) to add a new field for an image in posts (or you can create your own meta field just for the image). Then You can edit your theme to show whatever image, wherever you want.
ACF Plugin
If you just want to hide the featured image in every post, and only show it in blog page (or a page like that), you need to edit the post template.
https://developer.wordpress.org/themes/template-files-section/page-template-files/#page-templates-within-the-template-hierarchy
I ended up solving this by using an extension called 'Conditionally display featured image on singular posts and pages'. This allowed me to toggle off the the big picture on the post.

Using WPBakery ( Visual Composer) and Advanced Custom fields, I want to create or use an object that displays custom images

I'm currently working on a Wordpress website using the Advanced custom fields and WPBakery aka visual composer plugins.
While I manage to use these two plugins to post custom text, I have problems with images.
What I have tried so far is:
use acf in plain text, but as expected this only displays the link, not the image
using an image building block, but that won't work because there does not seem to be an option to link the image to a custom field
using ACF-VC integrator and linking it to the custom field, this also only displays the image
using an advanced custom field, also does not work.
using raw html, also does not work.
(Screenshot of the 5 methods:
and their output when creating the blog post: )
The only working solution I found so far is to insert this line in the single.php file:
<img src="<?php the_field('associated_image'); ?>" alt="" />
When doing that, this is what the blog post shows. As you can see, it is the correct image that is displayed, and it has pulled the image from the link in the custom field.
Some additional information:
The custom image field is configured as a text field, as we pull automatically
an image link from a file, so I can configure it to an image field, as we do not pull an image
One constraint that I have is that I should make use of WPBakery if possible and not work to much with raw php files, as it is very important that the work done should be easily maintainable, especially by people without an understanding of php.
What can I do to solve this problem? One possibility might be to add a function and shortcode in the functions.php file, but I do not manage to do that, as I have no real understanding of php.
I hope the formating of this post is at least acceptable, and if anyone is interedsted in helping I can provide additional details of course
You can use the ACF shortcode to echo out the value of your custom field. So you can create a new text block element in Page Builder, then switch to the text tab (above the editing field to the right), and insert the following code
<img src="[acf field='field_name']">
When Page Builder outputs its content, it'll pass through the function 'do_shortcode()', where ACF will work its magic.

How to create choose sidebar template layout in WordPress under post section?

I would like to know (or create something similar like this ) how to create choose sidebar template (sidebar layout) under post section in WordPress. I just need a link to refer. Can anyone suggest me relate link so that I can refer it? Thanks!
What you are trying to do is called WordPress meta box. You can always find a lot of the information on the internet.

Wordpress Custom Plugin Fields

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/

Add node CCK fields to a lightbox image?

I have a view with different nodes and an image with lightbox functionality.
I need to add some CCK fields of the node to the lightbox overlay. In other words, I don't want only the image to be displayed in the lightbox, but also some CCK fields of the current node.
What's the easiest way to do it ? Should I code it, or is there any module to customize lightbox ?
ps. My node is an Ubercart product. I also have Price, Order button, not only CCK fields.
thanks
I've solved by using the lightmodal option to include any html code and using "custom formatters" module to assign it to each image.
Successively I've edited my node.tmp.php file for being displayed in the lightbox.

Resources