Skip to content

Instantly share code, notes, and snippets.

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@w-perspective
w-perspective / WordPress Get Category name By label
Last active January 14, 2019 13:30 — forked from agragregra/WordPress Get Category name By label
WordPress Get Category name By label
<?php
$idObj = get_category_by_slug('s_about');
$id = $idObj->term_id;
echo get_cat_name($id);
?>
@w-perspective
w-perspective / DIV Equal Height
Last active January 8, 2019 14:43 — forked from agragregra/DIV Equal Height
DIV Equal Height with position absolute
<style>
.square {
display: inline-block;
position: relative;
width: 55%;
}
.square_dummy {
margin-top: 100%;
display: block;
}
<?php
$images = getFieldOrder('img');
$i = 0;
foreach($images as $image) {
$i++;
$nuevos = array ("w" => 300, "h" => 200, "zc" => 1, "q" => 100);
$image_thumb = get_image('img', 1, $i, 0, NULL, $nuevos);
$image_link = get_image('img', 1, $i, 0, NULL); ?>
<?php echo $image_thumb; ?><br/>
@w-perspective
w-perspective / Wordpress Menu
Created January 8, 2019 14:36 — forked from agragregra/Wordpress Menu
Wordpress Menu
//functions.php
register_nav_menus(array(
'top_mnu' => 'Top Menu',
));
//Template
wp_nav_menu(array(
'theme_location' => 'top_mnu'
));
@w-perspective
w-perspective / WordPress Category Home
Last active January 8, 2019 14:37 — forked from agragregra/WordPress Category Home
WordPress Category Home
<?php
if ( have_posts() ) : // если имеются записи в блоге.
query_posts('cat=3'); // указываем ID рубрик, которые необходимо вывести.
while (have_posts()) : the_post(); // запускаем цикл обхода материалов блога
?>
<?php the_post_thumbnail(array(100, 100)); ?>
<? endwhile; // завершаем цикл.
endif;
/* Сбрасываем настройки цикла. Если ниже по коду будет идти еще один цикл, чтобы не было сбоя. */
wp_reset_query();
<?php
$post = $wp_query->post;
if (in_category('cat_label_1')) {
include(TEMPLATEPATH.'/single-cat_label_1.php');
} elseif (in_category('cat_label_2')) {
include(TEMPLATEPATH.'/single-cat_label_2.php');
}
?>
@w-perspective
w-perspective / Wordpress theme-options.php
Last active January 8, 2019 14:30 — forked from agragregra/Wordpress Theme Options
Wordpress theme-options.php
//In Template
<?php
$options = get_option('sample_theme_options');
echo $options['phone1'];
?>
//in functions.php
require_once ( get_stylesheet_directory() . '/theme-options.php' );
//theme-options.php file:
@w-perspective
w-perspective / Waypoints + Animate.css
Last active January 8, 2019 14:39 — forked from agragregra/Waypoints + Animate.css
Waypoints + Animate.css
$(".element").waypoint(function() {
$(this).addClass("animated zoomInUp");
}, {
offset: "70%"
});
.element:nth-child(1) {
-webkit-animation-delay: 0s;
-o-animation-delay: 0s;
animation-delay: 0s;
@w-perspective
w-perspective / WordPress Get Custom Field
Last active January 8, 2019 14:24 — forked from agragregra/WordPress Get Custom Field
WordPress Get Custom Field
<?php echo get_post_meta($post->ID, 'year', true); ?>