Skip to content

Instantly share code, notes, and snippets.

//Gallery shortcode
function gallerys_shortcode($atts, $content){
extract( shortcode_atts (array( // a few default values
)
, $atts));
$q = new WP_Query(
array('posts_per_page' => 3, 'post_type' => 'gallery-items', 'order' => 'ASC', )
);
@priyabratary
priyabratary / unique-class-id.php
Created April 13, 2016 07:19
unique id each post
<?php $post_counter = 0; // start a counter before the loop ?>
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php $post_counter++; // increment the counter for each post ?>
<article <?php post_class(); ?> id="layout-<?php echo $post_counter; ?>">
<?php if ( $post_counter <= 3 ) : ?>
// display something only for the third post in the loop
<?php endif; ?>
@priyabratary
priyabratary / recent-post.php
Created July 21, 2016 14:08
recent post shortcode
// recent post shortcode
function my_recent_posts_shortcode($atts){
$q = new WP_Query(
array( 'orderby' => 'date', 'posts_per_page' => '-1')
);
$list = '<div class="latest-news p-t-70 p-b-50">
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
https://github.com/MWDelaney/bootstrap-3-shortcodes
wordpress ownership
chown -R www-data:www-data /var/www
sudo systemctl restart apache2
In terminal type:
sudo gedit /etc/apache2/apache2.conf
Find:
@priyabratary
priyabratary / linux_console_commands.sh
Created May 6, 2018 14:50 — forked from alkavan/linux_console_commands.sh
All kind of useful Linux commands.
# I book marked some sites with useful Linux commands i found.
# then i noticed they were down, so i loaded them via google cache, and copied here.
# source: http://blog.urfix.com/
# source: http://www.pixelbeat.org/cmdline.html
# Enjoy!
# How to run process as background and never die
#
# nohup means: Do not terminate this process even when the stty is cut off.
# > /dev/null means: stdout goes to /dev/null (which is a dummy device that does not record any output).
cd /
for version of linux
lsb_release -a
back command
cd ..
to edit a document
nano test.txt
@charset "utf-8";
/* CSS Document */
/*----*****---- << Responsive >> ----*****----*/
vc_hidden-lg vc_hidden-md vc_hidden-sm vc_hidden-xs
@priyabratary
priyabratary / gist:85e734ca0911b47397aabbc42658b258
Created July 19, 2018 14:09
pollylang read more translation
function modify_read_more_link() {
return '<a href="' . get_permalink() . '" class="more-link btn-a btn-a_fill_theme">' . pll__('string translation') . '</a>';
}
add_filter( 'the_content_more_link', 'modify_read_more_link' );
pll_register_string('my-theme', 'string translation');