Skip to content

Instantly share code, notes, and snippets.

@ABooooo
ABooooo / new_gist_file_0
Created August 19, 2014 07:47
Check URL and create an array
// check url
var url = window.location.pathname;
var output = url.split('/');
//alert (output[0]);
if (output[0] == "condition") {
// do something
@ABooooo
ABooooo / new_gist_file_0
Created August 19, 2014 07:48
Add or remove class
$( "#menu-item-11" ).addClass( "download" );
$( ".pages ul").removeClass( "btn btn-primary" ).addClass( "btn btn-success" );
@ABooooo
ABooooo / new_gist_file_0
Created August 19, 2014 07:49
Append or prepend
$( '.left li a' ).append( '<i class="fa fa-arrow-circle-right pull-right"></i>' );
http://api.jquery.com/append/
http://api.jquery.com/prepend/
@ABooooo
ABooooo / new_gist_file_0
Created August 19, 2014 07:50
Change CSS parameter
$( ".left li a i" ).css({ "padding-top" : "3px" });
@ABooooo
ABooooo / new_gist_file_0
Created August 19, 2014 20:01
Add dropdown with posts to contact form
wpcf7_add_shortcode('postdropdown', 'createbox', true);
function createbox(){
global $post;
$args = array('numberposts' => 0, 'category' => 5 );
$myposts = get_posts( $args );
$output = "<select name='cursus' id='cursus' onchange='document.getElementById(\"cursus\").value=this.value;'><option></option>";
foreach ( $myposts as $post ) : setup_postdata($post);
$title = get_the_title();
$output .= "<option value='$title'> $title </option>";
@ABooooo
ABooooo / new_gist_file_0
Created August 20, 2014 07:04
Include page
<?php
$include = get_pages('include=5');
$title = apply_filters('the_title',$include[0]->post_title);
echo $title;
$include = get_pages('include=5');
$content = apply_filters('the_content',$include[0]->post_content);
echo $content;
?>
@ABooooo
ABooooo / new_gist_file_0
Created August 21, 2014 07:33
Include shortcode
<?php echo do_shortcode('[contact-form-7 id="4" title="Kontaktni obrazec"]'); ?>
@ABooooo
ABooooo / new_gist_file_0
Created August 21, 2014 09:19
Add dropdown from post from two or more categories
wpcf7_add_shortcode('postdropdown', 'createbox', true);
function createbox(){
global $post;
$args1 = array('numberposts' => 0, 'category' => 14 );
$myposts1 = get_posts( $args1 );
$args2 = array('numberposts' => 0, 'category' => 19 );
$myposts2 = get_posts( $args2 );
$myposts = array_merge($myposts1, $myposts2);
@ABooooo
ABooooo / new_gist_file_0
Created October 2, 2014 09:42
Terminal install Typo3
Open the terminal
Move downloaded typo3_src-6.2.4.zip to host's root
mv ~/Downloads/typo3_src-6.2.4.zip /Application/MAMP/htdocs/typo3/
Go to destination folder:
cd /Application/MAMP/htdocs/typo3/
Still in this location unzip downloaded package (you can remove zip file after that)
@ABooooo
ABooooo / new_gist_file_0.php
Last active November 1, 2018 08:19
Absoluth server path with PHP
<?php
$path = getcwd();
echo "Your Absoluthe Path is: ";
echo $path;
?>
//for example for Joomla logs or tmp files