Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LBDesign Button Shortcode
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
plugins
LBDesign Button Shortcode
Commits
5fb2128c
Commit
5fb2128c
authored
9 years ago
by
Lauren
Browse files
Options
Downloads
Patches
Plain Diff
In progress: full width button option fix
parent
69eee3cb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lbdesign-button-shortcode.php
+11
-9
11 additions, 9 deletions
lbdesign-button-shortcode.php
with
11 additions
and
9 deletions
lbdesign-button-shortcode.php
+
11
−
9
View file @
5fb2128c
...
...
@@ -9,33 +9,35 @@
*/
/* our main shortcode function */
function
lbdesign_button
(
$atts
,
$content
=
null
)
{
function
lbdesign_button
_shortcode
(
$atts
,
$content
=
null
)
{
$atts
=
shortcode_atts
(
array
(
'link'
=>
null
,
'type'
=>
'default'
,
'color'
=>
'default'
,
'size'
=>
'default'
,
'style'
=>
'default'
,
'full_width'
=>
'off'
,
'custom_class'
=>
null
,
),
$atts
,
'lbdesign_button'
);
// check if we want the button to be full width. if yes, set up lbdesign_full_width class. if not, leave empty
if
(
$atts
[
'full_width'
]
==
"true"
)
{
$full_width
=
'lbdesign_full_width'
;
}
else
{
$full_width
=
''
;
}
if
(
$atts
[
'full_width'
]
==
'on'
)
$full_width
=
1
;
if
(
$atts
[
'full_width'
]
==
'off'
)
$full_width
=
0
;
foreach
(
$atts
as
$key
=>
$att
)
{
if
(
$key
!==
'link'
&&
$att
!==
null
&&
$att
!==
''
&&
$att
!==
'default'
)
{
$classes
[]
=
'lbdesign_'
.
$att
;
if
(
$key
==
'full_width'
)
{
$classes
[]
=
'lbdesign_full_width'
;
}
}
}
return
'<a class="lbdesign_button '
.
implode
(
$classes
,
" "
)
.
'
'
.
$full_width
.
'
" href="'
.
$atts
[
'link'
]
.
'">'
.
do_shortcode
(
$content
)
.
'</a>'
;
return
'<a class="lbdesign_button '
.
implode
(
$classes
,
" "
)
.
'" href="'
.
$atts
[
'link'
]
.
'">'
.
$content
.
'</a>'
;
}
add_shortcode
(
'button'
,
'lbdesign_button'
);
add_shortcode
(
'
lbdesign_
button'
,
'lbdesign_button
_shortcode
'
);
/* enqueue the default button styles */
...
...
@@ -52,7 +54,7 @@ add_action( 'wp_enqueue_scripts', 'lbdesign_button_styles' );
add_action
(
'init'
,
'lbdesign_tinymce_buttons'
);
function
lbdesign_tinymce_buttons
()
{
add_filter
(
"
mce_external_plugins
"
,
"
lbdesign_add_buttons
"
);
// hooks plugin to TinyMCE
add_filter
(
'
mce_external_plugins
'
,
'
lbdesign_add_buttons
'
);
// hooks plugin to TinyMCE
add_filter
(
'mce_buttons'
,
'lbdesign_register_buttons'
);
// used to show which buttons to show on TinyMCE
}
/* add custom button to wp editor */
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment