Skip to content

Instantly share code, notes, and snippets.

View rodica-andronache's full-sized avatar
🦄

Rodica-Elena Irodiu rodica-andronache

🦄
  • themeisle.com
  • Bucharest
View GitHub Profile
@rodica-andronache
rodica-andronache / gist:5636083
Last active December 17, 2015 16:08
WORDPRESS - Adaugare css stylesheet in functions.php
function my_scripts_styles() {
wp_register_style( 'style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'style' );
}
add_action('wp_enqueue_scripts', 'my_scripts_styles');
@rodica-andronache
rodica-andronache / gist:5656386
Last active December 17, 2015 18:49
WORDPRESS - Creare thme-options(submenu la meniurile default wordpress)
Creez un fisier 'create_option.php', pe care il includ in functions.php si in care pun:
<?php
add_action('admin_menu', 'register_my_custom_submenu_page');
function register_my_custom_submenu_page() {
add_submenu_page( 'themes.php', 'My Custom Submenu Page', 'My Custom Submenu Page', 'manage_options', 'my-custom-submenu-page', 'my_custom_submenu_page_callback' );
//aici, mai pot folosi(si e recomandat sa fac asta)
//in loc de add_submenu_page
//add_theme_page('My Custom Submenu Page', 'My Custom Submenu Page', 'read', 'my-custom-submenu-page', 'my_custom_submenu_page_callback' );
@rodica-andronache
rodica-andronache / gist:5669335
Created May 29, 2013 10:19
WORDPRESS - taguri in style.css
E recomandat sa pun in style.css, si taguri despre tema.
Lista de taguri:http://wordpress.org/themes/about/
Exemplu:
/*
Theme Name: Codeinwp theme
Theme URI: http://www.codeinwp.com
Author: Codeinwp
Author URI: http://www.codeinwp.com
@rodica-andronache
rodica-andronache / gist:5669596
Created May 29, 2013 11:23
CSS - Remove orange line from focused inputs in Chrome
textarea:focus, input:focus{
outline: 0 !important;
}
@rodica-andronache
rodica-andronache / gist:5677242
Last active December 17, 2015 21:49
WORDPRESS - Custom fields
Sunt campuri pe care le poate completa cel care creeaza un post, in wp-admin, pe care le poate folosi in alt scop decat textul atasat postului.
Sunt de forma key/value.
Cum se creeaza:
- pe pagina de adaugare post, in wp-admin, dau la 'Custom Fields' (daca nu apare, e posibil ca e hidden si ma duc in dreapta sus, la Screen options, si activez Custom Fields).
- completez campurile de Name si Value si dau Add Custom Field
Obs: Dupa ce completez primul custom field, data viitoare, la name, o sa apara un dropdown list cu toate optiunile pe care le-am pus deja, din care pot sa aleg, sau pot adauga unul nou.
@rodica-andronache
rodica-andronache / gist:5677318
Last active December 17, 2015 21:49
WORDPRESS - Metabox
Metabox - sunt casutele din dreapta de la wp-admin, de la adaugare post.
- putem adauga unele noi, in plus fata de cele existente.
<?php
add_meta_box( $id, $title, $callback, $post_type, $context,
$priority, $callback_args );
?>
EXEMPLU:
-------------
@rodica-andronache
rodica-andronache / gist:5677454
Last active December 17, 2015 21:49
WORDPRESS - Navigare pagina cu posturi
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'paged' => $page,
...
);
query_posts( $args );
if (have_posts()) : while (have_posts()) : the_post();
@rodica-andronache
rodica-andronache / gist:5677571
Last active December 17, 2015 21:49
WORDPRESS - Navigare Comentarii post
Ca sa modific nr de comentarii a unui post care sunt afisate, ma duc in wp-admin, Setting -> Discussion -> Break comments into pages with top level comments per page and the page displayed by default
in comments.php
<div class="navigation">
<?php
paginate_comments_links( array('prev_text' => 'prev', 'next_text' => 'next'));
?>
</div>
@rodica-andronache
rodica-andronache / gist:5677660
Last active December 17, 2015 21:49
WORDPRESS - Afisare comentarii post
In comments.php:
<ul>
<?php
wp_list_comments('type=comment&callback=mytheme_comment');
?>
</ul>
In functions.php:
@rodica-andronache
rodica-andronache / gist:5677680
Last active December 17, 2015 21:49
WORDPRESS - Afisare formular prin care utilizatorul poate adauga un comentariu la un post
$comments_args = array(
// change the title of send button
'label_submit'=>'Submit',
'comment_notes_before' => '',
// remove "Text or HTML to be displayed after the set of comment fields"
'comment_notes_after' => '',
// redefine your own textarea (the comment body)
'comment_field' => '<textarea id="comment" name="comment"></textarea>',
'fields' => array(