DevDm
Forum Replies Created
-
Forum: Themes and Templates
In reply to: [DevDmBootstrap3] Adding drop-downs to OptionsThis isn’t so much a support question as it is a WordPress how to but I’ll help anyway. ??
Rather than edit the right column lets just add a new dropdown option.
We are working in the theme-options.php file. If you are going to go this far you might re-brand the whole theme for yourself so that any future updates I make don’t wipe out this for you.
Step 1) add the new option to the $dm_options array and give it a default value.
$dm_options = array( 'author_credits' => true, 'right_sidebar' => true, 'right_sidebar_width' => 3, 'left_sidebar' => true, 'left_sidebar_width' => 3, 'show_header' => true, 'show_postmeta' => true, 'new_dropdown' => 'select' );
Step 2) define some values for this new drop down
$dm_new_dropdown_options = array( '1' => array ( 'value' => 'select', 'label' => 'select' ), '2' => array ( 'value' => 'option1value', 'label' => 'option 1 label' ), '3' => array ( 'value' => 'option2value', 'label' => 'option 2 label' ), '4' => array ( 'value' => 'option3value', 'label' => 'option 3 label' ), '5' => array ( 'value' => 'option4value', 'label' => 'option 4 label' ) );
Step 3) We are going to add some code inside the devdm_theme_options function now.
First add the variable we created above of possible drop down options to the global line at the top of the function.
//get our global options global $dm_options, $dm_sidebar_sizes,$dm_new_dropdown_options, $developer_uri;
Second we are going to add the code that generates the html and sets the selected value.
I put this inside the <form and inside the first table tag. It makes a new table row with cells and sets up the html of our select box.
<tr valign="top"><th scope="row"><?php _e('New Drop Down Options','devdmbootstrap3') ;?></th> <td> <select id="new_options" name="dm_options[new_dropdown]"> <?php foreach( $dm_new_dropdown_options as $new_options ) : $label = $new_options['label']; $selected = ''; if ( $new_options['value'] == $settings['new_dropdown'] ) $selected = 'selected="selected"'; echo '<option style="padding-right: 10px;" value="' . esc_attr( $new_options['value'] ) . '" ' . $selected . '>' . $label . '</option>'; endforeach; ?> </select> </td> </tr>
At this point it should probably be fine and working if you go to the DevDm Theme Options page but there is no security here. So lets do that now because we care about our users and it is our responsibility to save them from the evil of the internet.
With great power… etc. and so forth… responsibility.
Step 4) We are going to move up into the dm_validate_options function now.
Add your $dm_new_dropdown_options to the global line like we did with the devdm_theme_options function.
Insert the code below anywhere after the $settings variable is set and before the return $input at the bottom
The code below first sets a $prev variable to the OLD value before you changed it.
Now we set a holder variable that already says your input is bad.
It has to pass our test before we give it free passage to the database.
Next we loop through the available options checking for an exact match to your change the options page has passed through. If we find one we set the holder variable to true and it saves itself. If the holder variable is still false by the time it gets to our last if statement we override the $input and set it to the old value as it could have been something bad.
$prev = $settings['new_dropdown']; $new_dropdown_valid = false; foreach ($dm_new_dropdown_options as $key => $new_dropdown_option) { if ($input['new_dropdown'] === $new_dropdown_option['value']) { $new_dropdown_valid = true; } } if ( $new_dropdown_valid == false ) { $input['new_dropdown'] = $prev; }
That should be it! Now you can control the “new_dropdown” value inside the $dm_options.
Forum: Themes and Templates
In reply to: [DevDmBootstrap3] Posts in grid or masonryThis can be accomplished but it isn’t something to really be explained with a simple support request. This is a full featured request that a developer needs to build. Everything from configuring your masonry execution to structuring the posts container/elements will have to be taken into account.
It might be much easier for you and less headache to use a plugin.
Forum: Themes and Templates
In reply to: [DevDmBootstrap3] grunt configI’m not using Grunt exius. You might be able to pull some info from the bootstrap repository for it and incorporate my less configuration with it.
Forum: Themes and Templates
In reply to: [DevDmBootstrap3] Set up template drop down?Timothy is right Michelle.
I made a forum topic about this
https://devdm.com/DevDmBootstrap3/community/topic/page-template-to-only-show-the-right-side-bar/
You can view the code for creating the template page to only show a right sidebar.
The childtheme ‘cleanblog’ also as examples of left/right/fullwidth page templates.
Forum: Reviews
In reply to: [DevDmBootstrap3] Great Bootstrap Parent ThemeHey thanks Trishahdee!
I just set up bbpress on the theme website. We have a showcase area. Maybe you can post some of your work there.
Sure Azi.
To solve this problem you can use jQuery to “reorder the divs.”
Here is a stackoverflow about how to do it.
Basically you will write a script that detects the window/screen size and then executes this “reordering.”
Hope this helps.
https://stackoverflow.com/questions/10088496/jquery-reorder-divs
Forum: Reviews
In reply to: [DevDmBootstrap3] Boostraps 3 Starter Theme Rules.You are welcome Jenni. I hope it brings you much success! ??
Forum: Reviews
In reply to: [DevDmBootstrap3] Perfect for Devs Without the BloatThank you for the kind words nosker!
Forum: Themes and Templates
In reply to: [DevDmBootstrap3] how to have drop down on hover for main menuHey Pipedragon!
I actually wrote a bit of jQuery to handle this.
jQuery(document).ready(function ($) {
//only enable drop down hover when the mobile menu isn’t displayed
var $window = $(window);function checkWidth() {
var windowsize = $window.width();
if (windowsize > 767) {$(‘.dmbs-top-menu .navbar-inverse .navbar-nav li’).mouseenter(function(){
$(‘ul’,this).stop().slideDown();
});$(‘.dmbs-top-menu .navbar-inverse .navbar-nav li’).mouseleave(function(){
$(‘ul’,this).stop().slideUp();
});
}
}
// Execute on load
checkWidth();
// Bind event listener
$(window).resize(checkWidth);});
Forum: Reviews
In reply to: [DevDmBootstrap3] Great theme: lots of flexibility without complicationsThank for the support Chicchera! Hopefully it helps you out.
You are right about the conditionals for the custom functions. I will make a note to add them in the next update.
Forum: Themes and Templates
In reply to: [DevDmBootstrap3] Adding a container Div around dropdown menuClosed.
Forum: Themes and Templates
In reply to: [DevDmBootstrap3] Adding a container Div around dropdown menuLet me know what you come up with ?? I’ll be curious.
Forum: Themes and Templates
In reply to: [DevDmBootstrap3] Adding a container Div around dropdown menuI see what you are after here and honestly I’ve not encountered this request before so it is new on me.
I’m digging into the nav-walker to see if I can get you a solution but I’m out of time for today.
Here is a link to the github project. The author is a really cool guy and could probably answer this quickly for you.
Forum: Themes and Templates
In reply to: [DevDmBootstrap3] Adding a container Div around dropdown menuHey Chris,
I think you went the hard way on that one.
You want the navbar below the header to span the length of the page? Do I have that right?
Forum: Themes and Templates
In reply to: [DevDmBootstrap3] How to move time and author from post metaOh in that case it is easier.
Add the “navbar-static-top” to the <nav > element.
Open that index.php file and switch the position of these two:
<?php get_template_part(‘template-part’, ‘head’); ?>
<?php get_template_part(‘template-part’, ‘topnav’); ?>
So the topnav will be first.
<?php get_template_part(‘template-part’, ‘topnav’); ?>
<?php get_template_part(‘template-part’, ‘head’); ?>
You’ll need to do this for page.php too!