Skip to content

Instantly share code, notes, and snippets.

@zagk
zagk / list_of_sd_artists_styles_links.md
Created April 25, 2026 08:51 — forked from SMUsamaShah/list_of_sd_artists_styles_links.md
List of Stable Diffusion Artists Styles References
(function(){
toggle=0;
function dblclick() {
if (toggle==0) {
var sc=99999; toggle=1;
} else {
var sc=0; toggle=0;
}
window.scrollTo(0,sc);
}
add_filter( 'comment_form_defaults', 'cd_pre_comment_text' );
/**
* Change the text output that appears before the comment form
* Note: Logged in user will not see this text.
*
* @author Carrie Dils <http://www.carriedils.com>
* @uses comment_notes_before <http://codex.wordpress.org/Function_Reference/comment_form>
*
*/
function cd_pre_comment_text( $arg ) {
/* Add responsive container to embeds
/* ------------------------------------ */
function alx_embed_html( $html ) {
return '<div class="video-container">' . $html . '</div>';
}
add_filter( 'embed_oembed_html', 'alx_embed_html', 10, 3 );
add_filter( 'video_embed_html', 'alx_embed_html' ); // Jetpack
------------------
@zagk
zagk / category per post
Created November 12, 2016 03:11
Plugin API/Action Reference/pre get posts « WordPress Codex https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts
add_filter('pre_get_posts', 'posts_in_category');
function posts_in_category($query){
if ($query->is_category) {
if (is_category('book-reviews')) {
$query->set('posts_per_archive_page', 2);
}
// category With ID = 32 show only 5 posts
if (is_category('politics')){
$query->set('posts_per_archive_page', 1);
add_filter( 'get_the_archive_title', 'remove_category_word_in_archive_title' );
function remove_category_word_in_archive_title( $title ) {
if ( is_category() ) $title = str_replace( 'Category:', '', $title );
return $title;
}
Topic: [Resolved] Remove "Category archive:" on a category page « WordPress.org Forums
https://wordpress.org/support/topic/remove-category-archive-on-a-category-page/
@zagk
zagk / paginate wordpress.php
Created November 11, 2016 12:10
How to Add WordPress Pagination without a Plugin [Enhanced] - Sparklette Studio http://sgwordpress.com/teaches/how-to-add-wordpress-pagination-without-a-plugin/
function pagination($pages = '', $range = 4)
{
$showitems = ($range * 2)+1;
global $paged;
if(empty($paged)) $paged = 1;
if($pages == '')
{
global $wp_query;
@zagk
zagk / parent script remove for child theme.php
Created November 9, 2016 16:22
wp enqueue script - How do I dequeue a parent theme's CSS file? - WordPress Development Stack Exchange http://wordpress.stackexchange.com/questions/65523/how-do-i-dequeue-a-parent-themes-css-file
function PREFIX_remove_scripts() {
wp_dequeue_script( '_s-navigation' );
// Now register your styles and scripts here
}
add_action( 'wp_enqueue_scripts', 'PREFIX_remove_scripts', 20 );
---
function PREFIX_remove_scripts() {
wp_dequeue_style( 'screen' );
wp_deregister_style( 'screen' );
@zagk
zagk / get_the_categor.php
Created November 8, 2016 17:00
get_the_category() | Function | WordPress Developer Resources https://developer.wordpress.org/reference/functions/get_the_category/
$categories = get_the_category();
if ( ! empty( $categories ) ) {
echo '<a href="' . esc_url( get_category_link( $categories[0]->term_id ) ) . '">' . esc_html( $categories[0]->name ) . '</a>';
}
/**
* Just adds a column without content
*
* @param array $columns Array of all the current columns IDs and titles
*/
function misha_add_column( $columns ){
$columns['misha_post_id_clmn'] = 'ID'; // $columns['Column ID'] = 'Column Title';
return $columns;
}
add_filter('manage_posts_columns', 'misha_add_column', 5);