How I create a carousel without images? only text and background color…
-
Hi Tim,
The easiest way will simply to make images that are a background colour.. If you want a cleaner way to do it, you can probably achieve the same effect using CSS.
Phil
ok. thanks. I solved it already by this way.
Phil,
when I archieve the effect by using CSS, I have the problem, that the plugin needs an image? Without an image, the carousel does not work, isn′t it?Regards
TimIf I’m honest, I’ve never tried to use the carousel without an image so I don’t know. I know that the carousel dynamically resizes according the the image dimensions, so at the very least you’ll need to specify fixed heights and widths for the layers that usually contain the images. This is all guesswork though.
Phil
Thanks Phil.
It running now with an image. It′s ok for me.
Thanks anyway.
Best Regards
I managed an work around by adding a thumbnail verifier at line 446 of cpt-bootstrap-carousel.php
It was like this…
if ( '' != get_the_post_thumbnail() ) { $post_id = get_the_ID(); $title = get_the_title(); $content = get_the_excerpt(); $image = ""; $url = get_post_meta(get_the_ID(), 'cptbc_image_url'); $url_openblank = get_post_meta(get_the_ID(), 'cptbc_image_url_openblank'); $images[] = array('post_id' => $post_id, 'title' => $title, 'content' => $content, 'image' => $image, 'url' => esc_url($url[0]), 'url_openblank' => $url_openblank[0] == "1" ? true : false); }
and now it is like this…
if ( '' != get_the_post_thumbnail() ) { $post_id = get_the_ID(); $title = get_the_title(); $content = get_the_excerpt(); if ( has_post_thumbnail() ) { $image = get_the_post_thumbnail( get_the_ID(), 'full' ); } else { $image = ""; } $url = get_post_meta(get_the_ID(), 'cptbc_image_url'); $url_openblank = get_post_meta(get_the_ID(), 'cptbc_image_url_openblank'); $images[] = array('post_id' => $post_id, 'title' => $title, 'content' => $content, 'image' => $image, 'url' => esc_url($url[0]), 'url_openblank' => $url_openblank[0] == "1" ? true : false); }
It is still showing carousel post despite having a featured image or not.
Hi there,
Could you explain what the output is that you’re trying to achieve?
The code you added is within an if statement which only passes when a featured image is present (get_the_post_thumbnail returns an empty string when there is no image set):
if ( '' != get_the_post_thumbnail() ) {
As such, the only time that the code execution will get to your code is when there is a featured image, and so
has_post_thumbnail()
will always return true.Does that make sense? If you could explain what you’re trying to achieve anyway, and I’ll do my best to help.
Cheers,
Phil
Sorry! I made a mistake… now its working as expected… it shows both posts with and without featured images…
$post_id = get_the_ID(); $title = get_the_title(); $content = get_the_excerpt(); if ( '' != get_the_post_thumbnail() ) { $image = get_the_post_thumbnail( get_the_ID(), 'full' ); } else { $image = ""; } $url = get_post_meta(get_the_ID(), 'cptbc_image_url'); $url_openblank = get_post_meta(get_the_ID(), 'cptbc_image_url_openblank'); $images[] = array('post_id' => $post_id, 'title' => $title, 'content' => $content, 'image' => $image, 'url' => esc_url($url[0]), 'url_openblank' => $url_openblank[0] == "1" ? true : false);
All I did was to restrict the thumbnail statement to $image so even there is no image it will still populate the other variables… (y)
Ok, yup. Why do you want to do this? I’m just wondering if enough people will want an image carousel without images to justify putting your changes into the core plugin..
Phil
Phil,
I am a new user of WordPress for a site that actually needs what is described here. I live in a retirement home that currently has closed curcuit TV news system that is driven by a PowerPoint slide show. We are setting up a web site using WordPress that would have all the relevant information, and were looking for a way to have it load the TV system from the data on the site.
It would seem that we could use the carousel idea to achieve this. What we would need is an ability to load a series of frames similar to what goes into PowerPoint, mostly type (in large point sizes ) with some images thrown in. They would have to be in a 3×5 framework, and we would have to be able to specify at least three type sizes (36,32 and 28 point).
What would that take?
Thank you,
Rex du PontHi Rex,
Good to hear from you! When you say that the WordPress website will have “all of the relevant information”, do you know what format that will be in?
My gut feeling is that it’ll be more trouble than it’s worth to try and use this plugin. It’s really designed to slide images and as such doesn’t really have easy tools for manipulating the display of text.
There are other plugins that do this kind of thing though. For example, Text Slider might work?
Hope that helps ?? Good luck!
Phil
Thank you. That sounds like what we need. Most of the stuff we need is deliberately loaded as unformatted text, but needs to be formatted in the “slides” to get the sizes right.
Rex
- The topic ‘How I create a carousel without images? only text and background color…’ is closed to new replies.