Skip to content

Instantly share code, notes, and snippets.

View ncesar's full-sized avatar
🎯
Focusing

César Nascimento ncesar

🎯
Focusing
View GitHub Profile
add_filter( 'default_content', 'my_editor_content' );
function my_editor_content( $content ) {
$content = "[vc_row full_width='stretch_row' css='.vc_custom_1546953804123{margin-top: -314px !important;padding-top: 310px !important;padding-bottom: 195px !important;background-image: url(http://homolog.mrjobs.com.br/ocktus/wp-content/uploads/2018/12/2-imoveis-alguel-interna.jpg?id=128) !important;background-position: center !important;background-repeat: no-repeat !important;background-size: cover !important;}'][vc_column][/vc_column][/vc_row][vc_row el_class='post-content' css='.vc_custom_1549045196317{margin-top: -150px !important;background-color: #fbf3f0 !important;}'][vc_column width='2/3'][vc_column_text][sliderImoveis][/vc_column_text][/vc_column][vc_column width='1/3'][vc_raw_html]JTNDcCUzRUxvcmVtJTIwaXBzdW0lMjBkb2xvciUyMHNpdCUyMGFtZXQlMkMlMjBjb25zZWN0ZXR1ciUyMGFkaXBpc2NpbmclMjBlbGl0LiUyMFN1c3BlbmRpc3NlJTIwZGlnbmlzc2ltJTIwbGFjdXMlMjB1dCUyMG1ldHVzJTIwZmluaWJ1cyUyMHByZXRpdW0uJTIwTWF1cmlzJTIwbWF1cmlzJTIwb
@ncesar
ncesar / hamburgerMenu.html
Created January 28, 2019 20:46
hamburgermenu using jquery and css. made by salah uddin
/* html */
<button id="hamburger-menu" data-toggle="ham-navigation" class="hamburger-menu-button"><span class="hamburger-menu-button-open">Menu</span></button>
<nav id="ham-navigation" class="ham-menu">
<ul class="menu">
<li><a href="#">Home</a></li>
<li class="active"><a href="#">About</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Features</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Contact</a></li>
@ncesar
ncesar / addAndRemoveActiveClassInaMenu.js
Created January 28, 2019 20:32
This code adds a .active class on a menu, then removes.
$('.menu li').click(function() {
$('.menu li.active').removeClass('active');
$(this).addClass('active');
});
/* Give your iframe a name, and target your anchors to point to it: */
<a href="the iframe link" target="myiframe">Foo</a>
<a href="the iframe link" target="myiframe">Bar</a>
<a href="the iframe link" target="myiframe">Baz</a>
<iframe name="myiframe"></iframe>
add_filter ( 'woocommerce_account_menu_items', 'misha_rename_downloads' );
function misha_rename_downloads( $menu_links ){
// $menu_links['TAB ID HERE'] = 'NEW TAB NAME HERE';
$menu_links['downloads'] = 'My Files';
return $menu_links;
}
@ncesar
ncesar / customWooCommerceMyAccountPage.php
Created January 24, 2019 20:18
customWooCommerceMyAccountPage
/*
* Step 1. Add Link (Tab) to My Account menu
*/
add_filter ( 'woocommerce_account_menu_items', 'misha_log_history_link', 40 );
function misha_log_history_link( $menu_links ){
$menu_links = array_slice( $menu_links, 0, 5, true )
+ array( 'log-history' => 'Log history' )
+ array_slice( $menu_links, 5, NULL, true );
@ncesar
ncesar / removeWooCommerceMenuItem.php
Created January 24, 2019 19:46
Code to remove a WooCommerce menu item
add_filter ( 'woocommerce_account_menu_items', 'misha_remove_my_account_links' );
function misha_remove_my_account_links( $menu_links ){
unset( $menu_links['edit-address'] ); // Addresses
//unset( $menu_links['dashboard'] ); // Remove Dashboard
//unset( $menu_links['payment-methods'] ); // Remove Payment Methods
//unset( $menu_links['orders'] ); // Remove Orders
//unset( $menu_links['downloads'] ); // Disable Downloads
@ncesar
ncesar / autoAddWooCommerceChildren.php
Created January 24, 2019 13:14
Auto add WooCommerce categories children in a wordpress menu
add_filter("wp_get_nav_menu_items", function ($items, $menu, $args) {
if( $menu->term_id != 111 ) return $items ;
// don't add child categories in administration of menus
if (is_admin()) {
return $items;
}
foreach ($items as $index => $i) {
@ncesar
ncesar / register_nav_menus.php
Created January 23, 2019 18:39
//register nav menu and footer nav.
//register nav menu and footer nav for wordpress
register_nav_menus(
array(
'main-nav' => 'Main Navigation',
'footer-nav' => 'Footer Navigation'
)
);