Navigation Menu

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
@Dinamiko
Dinamiko / docu_after_index_content.php
Created January 22, 2015 16:53
adds a text after content in docu-index.php template
function custom_docu_after_index_content() {
echo '<h1>After content</h1>';
}
add_action( 'docu_after_index_content', 'custom_docu_after_index_content' );
@Dinamiko
Dinamiko / docu_before_index_content.php
Created January 22, 2015 16:51
adds a text before content in docu-index.php template
function custom_docu_before_index_content() {
echo '<h1>Before content</h1>';
}
add_action( 'docu_before_index_content', 'custom_docu_before_index_content' );
@Dinamiko
Dinamiko / docu_doc_post_type_labels.php
Last active August 29, 2015 14:13
changes default menu_name to Documents in the admin
function custom_docu_doc_post_type_labels( $docu_labels ) {
$docu_labels['menu_name'] = __('Documents', 'my-text-domain');
return $docu_labels;
}
add_filter( 'docu_doc_post_type_labels', 'custom_docu_doc_post_type_labels' );
@Dinamiko
Dinamiko / docu_doc_category_labels.php
Last active August 29, 2015 14:13
changes default category name and menu name in the admin
function custom_docu_doc_category_labels( $category_labels ) {
$category_labels['name'] = _x( 'My Category', 'taxonomy custom name' , 'my-text-domain' );
$category_labels['menu_name'] = __( 'My Categories', 'my-text-domain' );
return $category_labels;
}
add_filter( 'docu_doc_category_labels', 'custom_docu_doc_category_labels' );
@Dinamiko
Dinamiko / docu_doc_post_type_args.php
Last active August 29, 2015 14:13
This example changes the default slug doc to document
function custom_docu_doc_post_type_args( $docu_args ) {
$docu_args['rewrite'] = array('slug' => 'document');
return $docu_args;
}
add_filter( 'docu_doc_post_type_args', 'custom_docu_doc_post_type_args' );
function custom_dequeue_scripts() {
wp_dequeue_script( 'masonry' );
}
add_action( 'wp_print_scripts', 'custom_dequeue_scripts', 100 );
/**
* Modifica argumentos de WP_Query
*/
add_filter( 'ep_args', 'custom_ep_args' );
function custom_ep_args( $args ) {
$args['posts_per_page'] = 10;
$args['order'] = 'ASC';
$args['orderby'] = 'author';
return $args;
/**
* Añade contenido antes de la lista
*/
add_action( 'ep_before_list', 'custom_ep_before_list' );
function custom_ep_before_list() { ?>
<h3><?php _e('Últimas entradas', 'text-domain');?></h3>
<?php }
/**
* Añade contenido después de la lista
*/
add_action( 'ep_after_list', 'custom_ep_after_list' );
function custom_ep_after_list() { ?>
<p><?php _e('Última modificación: ', 'text-domain') . the_modified_date( 'd-m-Y g:i a' );?></p>
<?php }
/**
* Obtiene el id del attachment a partir del id de la categoría
* @param string taxonomy name
* @param int term id
* @return int attachment id
*/
function ic_get_attachment_id( $taxonomy = 'category', $term_id ) {
$args = array(
'post_type' => 'attachment',