• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
seegatesite header

Seegatesite.com

Seegatesite.com - Programming Tutorial , Sharing , How and Learn Together

  • TOOLS
    • Bootstrap Navbar Online Generator
    • Customize Sidebar Menu Bootstrap 3
    • Bootstrap Demo
  • ADVERTISE
  • CATEGORIES
    • Android
    • Blogging Tips
    • Database
    • CSS
    • Info Gadget
    • Javascript
    • Linux
    • PHP
    • Various
    • WordPress
  • Q&A
  • GUEST POST
  • PHP
  • JAVASCRIPT
  • JQUERY
  • ANGULAR
  • WORDPRESS
  • SEO
  • REACT
🏠 » Wordpress » Create WordPress Slider Without Javascript

Create WordPress Slider Without Javascript

By Sigit Prasetya Nugroho ∙ August 30, 2018 ∙ Wordpress ∙ Leave a Comment

Share : TwitterFacebookTelegramWhatsapp

CSS without javascript is created by codeconvey.com which I migrated to the WordPress Plugin. This is a request from one of the my visitors who has difficulty displaying the CSS slider library into the WordPress CMS site. Follow the short tutorial below

Table of Contents

  • 1 Creating CSS Sliders Without Javascript
    • 1.1 Migrate the CSS Slider Library to the WordPress Plugin
    • 1.2 How to use the css-slider plugin on WordPress

Creating CSS Sliders Without Javascript

This library is created using only CSS3 and HTML5. The advantage of using the slider plugin is lightweight and has a good animation display.

Here is a piece of the CSS slider code that I took from the official site codeconvey.com

There is 1 main CSS file that is used so that the slider can run normally, namely component.css

component.css

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
/*
Author: Ashfaq Ahmed @ Codeconvey.
Author URI: http://www.codeconvey.com/
*/
.imgslidersgt{
max-height: 400px;
width: 100%;
}
#cc-slider {
text-align: center;
margin: 0 auto;
max-width: 850px;
position:relative;
margin-bottom: 20px;
}
 
#cc-slider input {
display: none;
}
 
#cc-slider label, a {
color: #ef023f;
cursor: pointer;
text-decoration: none;
}
#cc-slider label:hover {
color: #ff0042 !important;
}
 
#slide1:checked ~ #cc-slides .inner { margin-left:0; }
#slide2:checked ~ #cc-slides .inner { margin-left:-100%; }
#slide3:checked ~ #cc-slides .inner { margin-left:-200%; }
#slide4:checked ~ #cc-slides .inner { margin-left:-300%; }
#slide5:checked ~ #cc-slides .inner { margin-left:-400%; }
 
 
#overflow {
width: 100%;
overflow: hidden;
}
 
#cc-slides article img {
width: 100%;
}
 
#cc-slides .inner {
width: 500%;
line-height: 0;
}
 
#cc-slides article {
width: 20%;
float: left;
}
 
#controls {
margin: -8% 0 0 84%;
width: 15%;
height: 50px;
}
 
#controls label {
display: none;
width: 50px;
height: 50px;
}
 
#active {
margin: 23% 0 0;
text-align: center;
}
 
#active label {
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
display: inline-block;
width: 10px;
height: 10px;
background: #f89e67;
}
 
#active label:hover {
background: #ccc;
border-color: #777 !important;
}
 
#controls label:hover {
opacity: 0.8;
}
 
#slide1:checked ~ #controls label:nth-child(2),
#slide2:checked ~ #controls label:nth-child(3),
#slide3:checked ~ #controls label:nth-child(4),
#slide4:checked ~ #controls label:nth-child(5),
#slide5:checked ~ #controls label:nth-child(1) {
background: url('images/next.png') no-repeat;
float: right;
margin: 0 10px 0 0;
display: block;
background-color:#ef023f;
}
 
 
#slide1:checked ~ #controls label:nth-child(5),
#slide2:checked ~ #controls label:nth-child(1),
#slide3:checked ~ #controls label:nth-child(2),
#slide4:checked ~ #controls label:nth-child(3),
#slide5:checked ~ #controls label:nth-child(4) {
background: url('images/prev.png') no-repeat;
float: left;
margin: 0 0 0 17px;
display: block;
background-color:#ef023f;
}
 
 
 
/* cctooltip Box */
 
.cctooltip {
    color: #FFFFFF;
    font-style: italic;
    line-height: 20px;
    margin-top: 250px;
    opacity: 0;
    position: absolute;
    text-align: left;
-webkit-transform: translateZ(0);
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
 
.cctooltip h3 {
color: #FFFFFF;
margin: 0 0 5px;
font-weight: normal;
font-size: 16px;
font-style: normal;
background: none repeat scroll 0 0 #222222;
padding: 5px;
}
.cctooltip h4 {
color: #FFFFFF;
margin: 0 0 5px;
font-weight: normal;
font-size: 14px;
font-style: normal;
background: none repeat scroll 0 0 #222222;
padding: 5px;
text-align:right;
width:106px;
}
 
 
 
/* cc-slider Styling */
 
#cc-slides {
margin: 45px 0 0;
padding: 1%;
background: #fff;
}
 
 
/* Animation */
 
#cc-slides .inner {
-webkit-transform: translateZ(0);
-webkit-transition: all 800ms cubic-bezier(0.770, 0.000, 0.175, 1.000);
-moz-transition: all 800ms cubic-bezier(0.770, 0.000, 0.175, 1.000);
    -ms-transition: all 800ms cubic-bezier(0.770, 0.000, 0.175, 1.000);
     -o-transition: all 800ms cubic-bezier(0.770, 0.000, 0.175, 1.000);
        transition: all 800ms cubic-bezier(0.770, 0.000, 0.175, 1.000); /* easeInOutQuart */
 
-webkit-transition-timing-function: cubic-bezier(0.770, 0.000, 0.175, 1.000);
-moz-transition-timing-function: cubic-bezier(0.770, 0.000, 0.175, 1.000);
    -ms-transition-timing-function: cubic-bezier(0.770, 0.000, 0.175, 1.000);
     -o-transition-timing-function: cubic-bezier(0.770, 0.000, 0.175, 1.000);
        transition-timing-function: cubic-bezier(0.770, 0.000, 0.175, 1.000); /* easeInOutQuart */
}
 
#cc-slider {
-webkit-transform: translateZ(0);
-webkit-transition: all 0.5s ease-out;
-moz-transition: all 0.5s ease-out;
-o-transition: all 0.5s ease-out;
transition: all 0.5s ease-out;
}
 
#controls label{
-webkit-transform: translateZ(0);
-webkit-transition: opacity 0.2s ease-out;
-moz-transition: opacity 0.2s ease-out;
-o-transition: opacity 0.2s ease-out;
transition: opacity 0.2s ease-out;
}
 
#slide1:checked ~ #cc-slides article:nth-child(1) .cctooltip,
#slide2:checked ~ #cc-slides article:nth-child(2) .cctooltip,
#slide3:checked ~ #cc-slides article:nth-child(3) .cctooltip,
#slide4:checked ~ #cc-slides article:nth-child(4) .cctooltip,
#slide5:checked ~ #cc-slides article:nth-child(5) .cctooltip {
opacity: 1;
-webkit-transition: all 1s ease-out 0.6s;
-moz-transition: all 1s ease-out 0.6s;
-o-transition: all 1s ease-out 0.6s;
transition: all 1s ease-out 0.6s;
}

To try the slider, please use the following HTML code snippet

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<article id="cc-slider">
      <input checked="checked" name="cc-slider" id="slide1" type="radio">
      <input name="cc-slider" id="slide2" type="radio">
      <input name="cc-slider" id="slide3" type="radio">
      <input name="cc-slider" id="slide4" type="radio">
      <input name="cc-slider" id="slide5" type="radio">
      <div id="cc-slides">
        <div id="overflow">
          <div class="inner">
            <article>
              <div class="cctooltip">
                <h3>Amazing / Photoshop / Photography</h3>
                <h4>By <a href="#">codeconvey</a></h4>
              </div>
              <img src="images/slide-1.jpg">
            </article>
            <article>
              <div class="cctooltip">
                <h3>Abstract Retro Photography</h3>
                <h4>By <a href="#">codeconvey</a></h4>
              </div>
              <img src="images/slide-2.jpg"> </article>
            <article>
              <div class="cctooltip">
                <h3>Street Photography</h3>
                <h4>By <a href="#">codeconvey</a></h4>
              </div>
              <img src="images/slide-3.jpg">
            </article>
            <article>
              <div class="cctooltip">
                <h3>Portrait / Woman / Photography</h3>
                <h4>By <a href="#">codeconvey</a></h4>
              </div>
              <img src="images/slide-4.jpg">
            </article>
            <article>
              <div class="cctooltip">
                <h3>Fashion / Sport / Photography</h3>
                <h4>By <a href="#">codeconvey</a></h4>
              </div>
              <img src="images/slide-5.jpg">
            </article>
          </div>
        </div>
      </div>
      <div id="controls">
        <label for="slide1"></label>
        <label for="slide2"></label>
        <label for="slide3"></label>
        <label for="slide4"></label>
        <label for="slide5"></label>
      </div>
    </article>

If run on your browser, the CSS slider result like the following gif image below:

Slider Gallery With Pure Css3 And Html5

You can download the complete project on http://codeconvey.com/pure-css-image-slider

How? Cool and easy right? the question is, how can the script above run on the WordPress CMS? I will share the code to make the CSS slider plugin working normally on your WordPress.

Migrate the CSS Slider Library to the WordPress Plugin

  1. Download the css slider source code in http://codeconvey.com/pure-css-image-slider.
  2. Create a folder called css-slider.
  3. Create a file named css-slider.php in the css-slider folder.
  4. Copy and paste the component.css file into the css-slider folder.
  5. Copy the images folder on the original source into the css-slider folder.
  6. Change the bit of code in component.css so the next and prev navigation image can display properly like the following code snippet

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#slide1:checked ~ #controls label:nth-child(2),
#slide2:checked ~ #controls label:nth-child(3),
#slide3:checked ~ #controls label:nth-child(4),
#slide4:checked ~ #controls label:nth-child(5),
#slide5:checked ~ #controls label:nth-child(1) {
background: url('images/next.png') no-repeat;
float: right;
margin: 0 10px 0 0;
display: block;
background-color:#ef023f;
}
 
#slide1:checked ~ #controls label:nth-child(5),
#slide2:checked ~ #controls label:nth-child(1),
#slide3:checked ~ #controls label:nth-child(2),
#slide4:checked ~ #controls label:nth-child(3),
#slide5:checked ~ #controls label:nth-child(4) {
background: url('images/prev.png') no-repeat;
float: left;
margin: 0 0 0 17px;
display: block;
background-color:#ef023f;
}

Copy the following code in the css-slider.php file

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/*
Plugin Name: CSS Slider
Plugin URI: https://seegatesite.com
Description: CSS Slider For Wordpress Without JS
Version: 1.0
Author: Sigit prasetya nugroho
Author URI: https://seegatesite.com/
Raw Source Url: http://codeconvey.com/pure-css-image-slider
*/
/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
 
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/
function sgt_css_slider_show() {
 
global $post;
$obj_name = query_posts( array( 'posts_per_page' => 5, 'orderby' => 'meta_value_num', 'order' => 'DESC' ) );
if (have_posts()) :
echo '<article id="cc-slider">';
$loop=1;
$i=1;
$nox = 1;
while (have_posts()) : the_post();
if($nox == 1){
echo '<input checked="checked" name="cc-slider" id="slide'.$nox.'" type="radio">';
}else{
echo '<input name="cc-slider" id="slide'.$nox.'" type="radio">';
}
$nox++;
endwhile;
 
echo '<div id="cc-slides">
         <div id="overflow">
           <div class="inner">';
             while (have_posts()) : the_post();
              $ximage = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
echo '<article>';
    echo '          <div class="cctooltip">
                <h3>';
               echo the_title();
    echo '</h3>
                <h4>';
                echo the_category();
    echo '</h4>
              </div>';
             echo ' <img class="imgslidersgt" src="'.$ximage.'"> ';
        echo    '</article>';
  endwhile;
        echo ' </div>
         </div>
           </div>';
        $nox=1;
        echo ' <div id="controls">';
        while (have_posts()) : the_post();
echo '<label for="slide'.$nox.'"></label>';
$nox++;
endwhile;
echo '</div>';
 
echo '</article>';
endif;
 
}
 
function sgt_enqueue_custom_stylesheets() {
if (!is_admin()) {
wp_enqueue_style( 'sgt-plugin-custom-css-slider', plugin_dir_url( __FILE__ ).'component.css' );
}
}
add_action( 'wp_enqueue_scripts', 'sgt_enqueue_custom_stylesheets', 11 );
 
 
?>

How to use the css-slider plugin on WordPress

  1. compress the css-slider folder into zip format.
  2. Install on your WordPress site.
  3. Put the following code to display the slider on the WordPress page, usually placed these code in the index.php file under <body>.

1
<?php if ( function_exists('sgt_css_slider_show') ) { sgt_css_slider_show(); } ?>

The results are as follows

Wordpress Slider Plugin Without Javascript

Noteworthy in the query_posts section, you can change it as needed.

1
query_posts( array( 'posts_per_page' => 5, 'orderby' => 'meta_value_num', 'order' => 'DESC' ) );

Read another article : Create a Responsive Jquery Slideshow With Flexslider for WordPress

Download the full source code at the following link

CSS slider WordPress Plugin without javascript download link

That’s a short tutorial on how to make WordPress sliders without javascript.

Another WordPress Related Post :

  • How To Create The Fastest Social Share Button WordPress Without Plugin
  • The Point Responsive WordPress Theme For Blogging
  • The Doctors Free WordPress Responsive Theme For Medical
  • Develop Your Site With Start Blogging The Responsive WordPress Theme
  • Zerius Theme The Free WordPress Responsive Theme
  • The Site Look Elegant With Modern Free Responsive WordPress Theme

Avatar for Sigit Prasetya Nugroho

About Sigit Prasetya Nugroho

This site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Welcome to my Home,

Avatar for Sigit Prasetya NugrohoThis site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.



Popular Articles

Checked checkbox AdminLTE Bootstrap in Jquery

November 4, 2014 By Sigit Prasetya Nugroho 7 Comments

Simple create date format validation with jqueryUI

December 21, 2014 By Sigit Prasetya Nugroho Leave a Comment

Create Simple Progress Bar for Fake Online Generator with Jquery

January 10, 2015 By Sigit Prasetya Nugroho Leave a Comment

22+ Coolest Free Jquery Plugin For Premium Theme

October 3, 2015 By Sigit Prasetya Nugroho Leave a Comment

Easy Build Your Anti Copy Paste Plugin

October 6, 2015 By Sigit Prasetya Nugroho Leave a Comment

Popular Tags

adminlte (15) adsense (13) adsense tips (4) affiliate amazon (13) amazon (12) Android (8) angular (16) angular 4 (12) angular 5 (4) asin grabber (3) Bootstrap (27) codeigniter (5) create wordpress theme (5) crud (8) css (6) free wordpress theme (7) google adsense (4) imacros (4) increase traffic (6) jquery (34) laravel (10) laravel 5 (5) learn android (5) modal dialog (5) mysql (6) nodeJs (4) optimize seo (4) pdo (6) php (30) plugin (53) pos (7) Publisher Tips (5) react (3) Reactjs (7) SEO (37) theme (17) tutorial angular (5) tutorial angular 4 (6) tutorial javascript (10) tutorial javascript beginners (4) twitter (3) widget (3) wordpress (18) wordpress plugin (13) XMLRPC (5)




  • About
  • Contact Us
  • Disclaimer
  • Privacy Policy
  • Terms and Conditions

©2021 Seegatesite.com