Dot22
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Front end post order by userThank you a lot for your help and patience Scott! It works perfect now π
Forum: Developing with WordPress
In reply to: Front end post order by userThis is the code right now…
function numeric_posts_nav() { if( is_singular() ) return; global $wp_query; if( $wp_query->max_num_pages <= 1 ) return; $paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1; $max = intval( $wp_query->max_num_pages ); if ( $paged >= 1 ) $links[] = $paged; if ( $paged >= 3 ) { $links[] = $paged - 1; $links[] = $paged - 2; } if ( ( $paged + 2 ) <= $max ) { $links[] = $paged + 2; $links[] = $paged + 1; } echo '<ul>' . "\n"; if ( get_previous_posts_link() ) previous_posts_link( __( '<div class="btn-pagination"><span class="fa fa-reply" style="padding: 0px 8px 0px 0px;"></span>PREVIOUS</div>' . "\n" ) ); if ( ! in_array( 1, $links ) ) { $class = 1 == $paged ? ' class="active"' : ''; printf( '<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url( add_query_arg( 'select', $select, get_pagenum_link( 1 ) ) ), '1' ); if ( ! in_array( 2, $links ) ) echo '<li>...</li>'; } sort( $links ); foreach ( (array) $links as $link ) { $class = $paged == $link ? ' class="active"' : ''; printf( '<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url( add_query_arg( 'select', $select, get_pagenum_link( $link ) ) ), $link ); } if ( ! in_array( $max, $links ) ) { if ( ! in_array( $max - 1, $links ) ) echo '<li>...</li>' . "\n"; $class = $paged == $max ? ' class="active"' : ''; printf( '<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url( add_query_arg( 'select', $select, get_pagenum_link( $max ) ) ), $max ); } /** Next Post Link */ if ( get_next_posts_link() ) next_posts_link( __( '<div class="btn-pagination">NEXT<span class="fa fa-share" style="padding: 0px 0px 0px 8px;"></span></div>' . "\n" ) ); echo '</ul>' . "\n"; }Forum: Developing with WordPress
In reply to: Front end post order by userNow all the page numbers display before them the words “Hello, world” so I think the link are generated there. If I go to the url http://my.wordpress.site/page/2/?select=titleasc it works successfully.
Don’t know why the selected array isn’t included on the page link… π
Forum: Developing with WordPress
In reply to: Front end post order by userNo, the link remains the same… for example: http://my.wordpress.site/page/2/
Forum: Developing with WordPress
In reply to: Front end post order by userThanks again for your help Scott! For some reason the changes didn’t impact on the site. The select still works on the first page only. When I click on page 2, 3 the order is βresetβ.
Don’t know where have to look to fix this =(
The list of changes…
- Changed all the $_POST[‘select’] for $_REQUEST[‘select’]
- Added the following code at the top of the original one
<?php $select = ''; if( ! empty( $_REQUEST['select'] ) ) { $select = sanitize_text_field( $_REQUEST['select'] ); } - Added the two lines on
get_pagenum_link( $max )andget_pagenum_link( $link )
Thanks in advance! π
Forum: Developing with WordPress
In reply to: Front end post order by userThanks for your reply stirrell42! Changed the $_POST variable to $_REQUEST and added the following code as you said…
<?php if( ! empty( $_REQUEST['select'] ) ) { $select = sanitize_text_field( $_REQUEST['select'] ); } $order = "&orderby=title&order=ASC"; if ($_REQUEST['select'] == 'titleasc') { $order = "&orderby=title&order=ASC"; } if ($_REQUEST['select'] == 'titledesc') { $order = "&orderby=title&order=DESC"; } if ($_REQUEST['select'] == 'autorasc') { $order = "&post_type=catitem&meta_key=audiovisual_director&orderby=meta_value&order=ASC"; } if ($_REQUEST['select'] == 'autordesc') { $order = "&post_type=catitem&meta_key=audiovisual_director&orderby=meta_value&order=DESC"; }But for pagination I’m using this code on functions.php…
function numeric_posts_nav() { if( is_singular() ) return; global $wp_query; if( $wp_query->max_num_pages <= 1 ) return; $paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1; $max = intval( $wp_query->max_num_pages ); if ( $paged >= 1 ) $links[] = $paged; if ( $paged >= 3 ) { $links[] = $paged - 1; $links[] = $paged - 2; } if ( ( $paged + 2 ) <= $max ) { $links[] = $paged + 2; $links[] = $paged + 1; } echo '<ul>' . "\n"; if ( get_previous_posts_link() ) previous_posts_link( __( '<div class="btn-pagination"><span class="reply" style="padding: 0px 8px 0px 0px;"></span>PREVIOUS</div>' . "\n" ) ); /** Link to first page, plus ellipses if necessary */ if ( ! in_array( 1, $links ) ) { $class = 1 == $paged ? ' class="active"' : ''; printf( '<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url( get_pagenum_link( 1 ) ), '1' ); if ( ! in_array( 2, $links ) ) echo '<li>...</li>'; } sort( $links ); foreach ( (array) $links as $link ) { $class = $paged == $link ? ' class="active"' : ''; printf( '<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url( get_pagenum_link( $link ) ), $link ); } if ( ! in_array( $max, $links ) ) { if ( ! in_array( $max - 1, $links ) ) echo '<li>...</li>' . "\n"; $class = $paged == $max ? ' class="active"' : ''; printf( '<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url( get_pagenum_link( $max ) ), $max ); } /** Next Post Link */ if ( get_next_posts_link() ) next_posts_link( __( '<div class="btn-pagination">NEXT<span class="share" style="padding: 0px 0px 0px 8px;"></span></div>' . "\n" ) ); echo '</ul>' . "\n"; }Don’t know where to add ‘add_args’ => array(‘select’ => $_REQUEST[‘select’]). :/
Forum: Developing with WordPress
In reply to: Creating custom menuThanks for the reply bcworkz! I understand what you said and keep trying to modify only CSS classes to structure the menu but it didn’t works.
I’m a bit confused on how to edit them. Anyone can help me with this codes? Thanks in advance! π
Forum: Developing with WordPress
In reply to: Creating custom menuThe theme is a child version of WordPress default theme: twentytwelve.
My main problem is that I want to make the second/third level submenus show on the same column and not on the right/left side of the main column (like the example of Codepen: http://codepen.io/WhiteWolfWizard/pen/MYQGQQ). I’ve tried lot of codes and modifications and nothing works. π
Forum: Developing with WordPress
In reply to: Creating custom menuI tried to adapt it with WordPress default menu classes, but didn’t work. The codes I have:
MENU:
<div id="menubar-menu"> <ul id="menu" class="menu"><li id="menu-item-100" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-100"><a href="#">Home</a></li> <li id="menu-item-103" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-103"><a href="#">Section 1</a> <ul class="sub-menu"> <li id="menu-item-127" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-127"><a href="#">Subsection 1</a></li> <li id="menu-item-140" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-140"><a href="#">Subsection 2</a></li> <ul class="sub-menu"> <li id="menu-item-122" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-122"><a href="#">SUB subsection 1</a></li> <li id="menu-item-121" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-121"><a href="#">SUB subsection 2</a></li> </ul> <li id="menu-item-141" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-141"><a href="#">Subsection 3</a></li> </ul> </li> </ul></div><script> $(document).ready(function () { $('#menu .menu-item.menu-item-has-children .trigger-sub-menu i').on('click', function () { $(this).toggleClass('fa-flip-vertical'); $(this).parent().toggleClass('active'); $('#menu .menu-item.menu-item-has-children .sub-menu').toggle(); $('#menu .menu-item.menu-item-has-children .sub-menu .trigger-sub-menu i').removeClass('fa-flip-vertical').parent().removeClass('active'); $('#menu .menu-item.menu-item-has-children .sub-menu').slideUp(); return false; }); $('#menu .menu-item.menu-item-has-children .sub-menu .sub-menu i').on('click', function () { $(this).toggleClass('fa-flip-vertical'); $(this).parent().toggleClass('active'); $('#menu .menu-item.menu-item-has-children .sub-menu').slideToggle(150); return false; }); }); </script>CSS:
#menu .menu-item { float: left; margin: 10px 0 10px 5px; } #menu .menu-item a { position: relative; height: 30px; padding: 0 10px; border-radius: 2px; display: block; -webkit-transition: all 150ms ease; transition: all 150ms ease; color: #8aa4bb; line-height: 30px; white-space: nowrap; } #menu .menu-item a:hover, #menu .menu-item a:active { background: #8aa4bb; color: #fff; } #menu .menu-item a:active { background: #758b9f; } #menu .menu-item a[class*="trigger-"] { padding-right: 40px; } #menu .menu-item a i { position: absolute; top: 0; right: 0; bottom: 0; width: 30px; height: 30px; line-height: 30px; text-align: center; } #menu .menu-item a i:after { content: ''; position: absolute; top: 0; left: 0; bottom: 0; height: 50%; margin: auto; border-left: 1px solid rgba(0, 0, 0, 0.15); } #menu .menu-item.menu-item-has-children { position: relative; } #menu .menu-item.menu-item-has-children .sub-menu { position: absolute; top: 0; right: 0; border-radius: 2px; background: #fff; display: none; overflow: hidden; box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); -webkit-transform: translateY(35px); transform: translateY(35px); } #menu .menu-item.menu-item-has-children .sub-menu li { float: none; margin: 0; } #menu .menu-item.menu-item-has-children .sub-menu li a { border-radius: 0; } #menu .menu-item.menu-item-has-children .sub-menu .menu-item-has-children.sub-menu { border-top: 1px solid rgba(0, 0, 0, 0.15); background: #758b9f; display: none; } #menu .menu-item.menu-item-has-children .sub-menu .menu-item-has-children.sub-menu li { width: 100%; display: table; } #menu .menu-item.menu-item-has-children .sub-menu .menu-item-has-children.sub-menu li a { height: 25px; font-size: 8pt; color: #fff; line-height: 25px; } #menu .menu-item.menu-item-has-children .sub-menu .menu-item-has-children.sub-menu li:first-child a { margin-top: 5px; } #menu .menu-item.menu-item-has-children .sub-menu .menu-item-has-children.sub-menu li:last-child a { margin-bottom: 5px; }Any help will be appreciated!
Forum: Developing with WordPress
In reply to: Creating custom menuHello bcworkz! Yes, the example displays sub items on click but for my site it really doesn’t matter if the effect is on click or on hover. I’m using a custom theme (a child version of WordPress default theme) and I can’t configure the CSS rules of the menu to act like the previous example.
Thanks for your reply and help!
Forum: Developing with WordPress
In reply to: Creating custom menuI was searching, and the following link show the menu I want to adapt to WordPress. The problem is I can’t set the class tags on ul’s and li’s: http://codepen.io/WhiteWolfWizard/pen/MYQGQQ
Someone can help me? Thanks! π
Forum: Fixing WordPress
In reply to: Include sticky posts on indexThanks for your reply ThemeSumo. I’ve tried it but didn’t work π
There is another way to include the sticky posts?
Forum: Fixing WordPress
In reply to: Code change if is pagedAwesome Michael, it works like a charm! Thank you very much! =D
Forum: Fixing WordPress
In reply to: First post with different style and wrap every two postsHello jkessel28! Thanks for your reply. I tried this, but didn’t work:
<?php else :?> <?php if( $c == 2 ) echo "\n".'<div class="wrap">open'."\n"; ?> <?php get_template_part( 'content', get_post_format() ); ?> <?php if( $c == 2 ) echo 'close</div> <!--/.wrap-->'."\n"; ?> <?php endif;?> <?php endwhile; ?>The problem with counter defined as $c is that the first post (with different style) counts as post 1, but I need to start the count since the second post.
The graphical form:
| FIRST POST DIFFERENT-UNIQUE STYLE (no wrap, no count) | | OPEN WRAPPER DIV | | POST 1 | | POST 2 | | CLOSE WRAPPER DIV | | OPEN WRAPPER DIV | | POST 3 | | POST 4 | | CLOSE WRAPPER DIV | | OPEN WRAPPER DIV | | POST 5 | | POST 6 | | CLOSE WRAPPER DIV |Any help will be appreciated! =)
Forum: Fixing WordPress
In reply to: Creating a new widgetI found the solution. The content must be added before and after this line:
<?php echo !empty( $instance['filter'] ) ? wpautop( $text ) : $text; ?>