Hello,
Let me first explain what I have in mind:
1.Every category should have option to add header image (width of the td-category-header NO full page width).
2.Every post would then have that option too.
My concerns:to be responsive, not to be ruined by an update.
Important: I don’t want to have the same image on all of the categories. I can’t stress enough how important it is for me to have that kid of flexibility.
Could you be so kind to provide me with some code and manual have to achieve that.
Regards
Hello,
Posts already have that option. The featured image does exactly that. Use a post template with a big featured image and you will have the desired effect: http://demo.tagdiv.com/newspaper/td-post-if-you-only-knew-how-much-your-relative-churn-rate-matters/
For the categories, you will need to modify the top post files in order to achieve your goal and you can add a condition to filter your categories and images: https://codex.wordpress.org/Function_Reference/is_category
You can also use a do_shortcode to place you images. For example:
The category number represents the category id. You can get it from here: http://screencast.com/t/OKsDtKVi3G5
<?php
if (is_category(13)) {
echo do_shortcode('[vc_row][vc_column][vc_single_image image="887"][/vc_column][/vc_row]')
}
elseif (is_category(14)){
echo do_shortcode('[vc_row][vc_column][vc_single_image image="886"][/vc_column][/vc_row]')
}
?>
You can add some padding to the image from visual composer from design options in order to make it fit the content.
result:http://screencast.com/t/pHkte6ztxf6t
I hope this helps
Thank you!
Hello,
Thank you for your fast response.
BUT, when you say that I will have to change top post files which ones are those exactly?
Then, this code: [vc_single_image image="887"] is 887 some kind of id? How do I find that? Do I upload my image as I would any other? How do I make it responsive? Do I need to pay special attention on initial size?
To make this faster and easier regarding to the single post issue. Lets just say I want 1 image on all single post ‘pages’ (adding featured image at this point when thee is more than 8000 posts is out of the question) how do I do that?
-Open file….
-change what….
-upload image of size….
Thanks
Hello,
I understand your request now. The example above only placed an image on the category page.
You will need to edit the top post files located here: http://screencast.com/t/5V35g4r7aO
Every file corresponds to a top post style you set from the theme panel: http://screencast.com/t/Koefd7FWIm
The shortcode i used was from a visual composer single image element. You can see visual composer shortcodes in text mode when editing a page. You can add a single image element in visual composer when editing a page and style it as you want: http://screencast.com/t/VBHhKVZuk2Oy -http://screencast.com/t/yv4uWDhsMH
Then after you are done with the image settings, you can enter text edit mode and copy the code created for the image to the files as i have shown you above using do_shortcode. You basically copy and paste a visual composer element which is responsive by default.
But the code will not set the feature image anywhere. It just places an image on the category page.
If you want to set the featured images on all 8000 post, besides the manual version, one thing you might try, if you already have an image “in the post” of some type, use the “auto post thumbnail pro” plugin which will automatically take first image from post (or from external site, if necessary) and then generate thumb and assign as “featured” image in every post.
Unfortunately there is no other option for this. You can maybe find a free plugin to do this as well.
I hope this helps
Thank you!
Helli again,
I was looking into it right now, but there is a problem.
Please have a look at the image: http://s21.postimg.org/fpgye7suv/Post_bounderies.jpg
If you notice that blueish part. That is where this code starts :
<!– big grid –>
<div class=”td-category-grid”>
So I would say I need 1 level up? Parent template? I need it above td-category-header, have a look here:
http://s24.postimg.org/l3kzalwud/place.jpg
How do I access that part? What template or .php file would be best for that?
As I could find that is above td_category_template_2.php ?? http://s22.postimg.org/ha6d86vwh/template.jpg
—————————-
If I just add that code of yours like here: http://s23.postimg.org/w5cyqt7sr/all_Cat_Image.jpg
Nothing happens: http://s15.postimg.org/qbenoep3f/No_Image.jpg
——————————
I do really hope this images will help you understand what I am trying to do and how I can’t.
Thanks
Hi,
If you want the first thing on the page to be the image, then you need to add your code in the category template files: http://screencast.com/t/Jhqe3L6t
<?php echo do_shortcode('[vc_row][vc_column][vc_single_image image="223" img_size="full" css=".vc_custom_1447858280464{padding-top: 20px !important;padding-bottom: 20px !important;}"][/vc_column][/vc_row]');?>
I just added a few more option to the image in visual composer like full size and padding.
Place it like so: http://screencast.com/t/gH5GgPEb
Just be advised that this will generate the same image on every category that uses this template.
result: http://screencast.com/t/jNBgRk8D
Thanks
-
This reply was modified 10 years by
Bogdan B..
Thanks you so much, all is much clearer now. We are getting there…
Adding image code: <?php echo do_shortcode('[vc_row][vc_column][vc_single_image image="223" img_size="full" css=".vc_custom_1447858280464{padding-top: 20px !important;padding-bottom: 20px !important;}"][/vc_column][/vc_row]');?>
How do I know what that image=”223″ is? Please if you can explain this.
Last thing, can I use the same procedure so all the single posts have that too? What .php file would I edit?
Hello,
The image number is for the image i set. I showed you above how to use a single image element in visual composer. Just create a blank page, add a single image element, select your image, apply some settings/styling to it, then enter classic mode and text mode(not visual) and you will see the code for your image.
You can use the same method on posts. The posts have 2 files that correspond for one template. There is the single.php files and the loop-single.php. For this you have to edit the loop files. http://screencast.com/t/Dq6GqnpUBQ3O
Thanks.