Skip to content

Instantly share code, notes, and snippets.

View Dinamiko's full-sized avatar
💭
just coding stuff

Emili Castells Dinamiko

💭
just coding stuff
View GitHub Profile
<?php
// adds a custom field to Speaker Social URL Links metabox.
function custom_dkconf_speaker_meta_fields( $fields ) {
$fields[] = array(
'metabox' => array('name' => 'dkconf_meta_speaker'),
'id' => 'dkconf_speaker_new_url_field',
'label' => __( 'New URL Field:' , 'dkconf' ),
'type' => 'url',
'placeholder' => '',
'description' => ''
<?php
/**
* Example changing default dportfolio_categories url slug
*/
function custom_dportfolio_categories_register_args( $args ) {
$args['rewrite'] = array( 'slug' => 'awesome-categories' );
return $args;
}
<?php
/**
* Example changing default dportfolio url slug
*/
function custom_dportfolio_register_args( $args ) {
$args['rewrite'] = array( 'slug' => 'just-test-slug' );
return $args;
}
add_filter( 'dportfolio_register_args', 'custom_dportfolio_register_args', 20 );
<?php
// remove sharing button in the PDF
function dkpdf_remove_jp_share() {
$pdf = get_query_var( 'pdf' );
if( $pdf ) {
remove_filter( 'the_content', 'sharing_display',19 );
remove_filter( 'the_excerpt', 'sharing_display',19 );
if ( class_exists( 'Jetpack_Likes' ) ) {
<?php
/**
* Example reordering post types array
*/
function reorder_dkpdf_posts_arr( $post_arr ) {
$post_arr = array( 'doc' => 'doc', 'post' => 'post', 'page' => 'page' );
return $post_arr;
<?php
/**
* Example changing wp query arguments for the generated PDF
* $args = array( 'p' => $pdf, 'post_type' => $post_type, 'post_status' => 'publish' );
*/
function changing_dkpdf_query_args( $args ) {
$args['p'] = 1710;
$args['post_type'] = 'doc';
return $args;
}
<?php
/**
* Removes post type attachment in PDF Button Post types to apply
*/
function remove_dkpdf_posts_arr( $post_arr ) {
unset( $post_arr['attachment'] );
return $post_arr;
}
add_filter( 'dkpdf_posts_arr', 'remove_dkpdf_posts_arr' );
?>
<?php
/**
* Adds post type nav_menu_item in PDF Button Post types to apply
*/
function add_dkpdf_posts_arr( $post_arr ) {
array_push( $post_arr, 'nav_menu_item' );
}
add_filter( 'dkpdf_posts_arr', 'add_dkpdf_posts_arr' );
?>
<?php
/**
* Create a shortcode [dkpdf-test-shortcode]
*/
function dkpdf_test_shortcode( $atts, $content = null ) {
$output = '<div style="background:red;">';
$output .= '<h3>Just test</h3>';
$output .= '</div>';