Skip to content

Instantly share code, notes, and snippets.

View Regis011's full-sized avatar
:octocat:

Vladimir Rancic Regis011

:octocat:
View GitHub Profile
@Regis011
Regis011 / Change media gallery url
Created November 11, 2016 23:51
Change media gallery url
@Regis011
Regis011 / How to Password Protect Your WordPress Admin (wp-admin) Directory
Created November 11, 2016 23:51
How to Password Protect Your WordPress Admin (wp-admin) Directory
//root .htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
@Regis011
Regis011 / wp admin custom option page and Menu for wp theme-plugins (without ACF pro)
Created November 11, 2016 23:47
wp admin custom option page and Menu for wp theme - plugins (without ACF pro)
//adding menu sections
<?php
/** Step 2 (from text above). */
add_action( 'admin_menu', 'my_plugin_menu' );
/** Step 1. */
function my_plugin_menu() {
add_options_page( 'My Plugin Options', 'My Plugin', 'manage_options', 'my-unique-identifier', 'my_plugin_options' );
}
@Regis011
Regis011 / wordpress Rewriting a custom-post-type url permalink with custom taxonomy term
Created November 11, 2016 23:41
Wordpress Rewriting a custom-post-type url permalink with custom taxonomy term
// Register Custom Post Type
function my_post_type() {
$labels = array(
'name' => _x( 'Frågor', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( 'Fråga', 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( 'Frågor', 'text_domain' ),
@Regis011
Regis011 / wordpress new user phpMyAdmin mysql
Created November 11, 2016 23:34
wordpress new user phpMyAdmin mysql
INSERT INTO `databasename`.`wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES ('4', 'demo', MD5('demo'), 'Your Name', 'test@yourdomain.com', 'http://www.test.com/', '2011-06-07 00:00:00', '', '0', 'Your Name');
INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '4', 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '4', 'wp_user_level', '10');
@Regis011
Regis011 / Wordpress Taxonomy Archive Template
Created November 11, 2016 23:30
Wordpress Taxonomy Archive Template
<?php the_terms($post->ID, 'group') ?>
<?php echo get_the_term_list( $post->ID, 'styles', '<ul class="styles"><li>', ',</li><li>', '</li></ul>' ); ?>
<?php $terms = wp_get_post_terms( $post->ID, 'fragorna', array('fields' => 'all') );
print_r($terms[0]->description);
?>
@Regis011
Regis011 / ACF Theme Options
Created November 11, 2016 23:27
Wordpress ACF Theme Options
//Options for footer
if( function_exists('acf_add_options_page') ) {
$args = array(
'page_title' => 'Theme options',
'post_id' => 'theme_options',
'parent_slug' => 'themes.php',
);
acf_add_options_page($args);
}