Skip to content

Instantly share code, notes, and snippets.

View feliciaceballos's full-sized avatar

Felicia Ceballos-Marroquin feliciaceballos

View GitHub Profile
@feliciaceballos
feliciaceballos / wpmu-dev-forminator-recent-entries-dashboard-widget.php
Created October 24, 2018 20:01
Plugin Extension for Forminator to Display Forminator Form Entries in WordPress Dashboard Widget
<?php
/*
Plugin Name: Forminator Recent Entries Dashboard Widget
Plugin URI: https://premium.wpmudev.org/project/forminator-pro/
Description: Display Forminator Form Entries in WordPress Dashboard Widget
Version: 0.1
Author: Cvetan Cvetanov
Author URI: https://premium.wpmudev.org/profile/cvetan
*/
@feliciaceballos
feliciaceballos / functions.php
Created March 12, 2019 07:23
WordPress Login Page redirect to Home Page
<?php
//remove <?php when you paste inside your functions.php file
function admin_login_redirect( $redirect_to, $request, $user ) {
global $user;
if( isset( $user->roles ) && is_array( $user->roles ) ) {
if( in_array( "administrator", $user->roles ) ) {
return $redirect_to;
}
@feliciaceballos
feliciaceballos / retina-wordpress.html
Last active November 30, 2019 18:32
Responsive WordPress Retina Images
<picture>
<source
media="(min-width: 900px)"
srcset="large-image_1x.jpeg 1x, large-image_retina.jpeg 2x"
type="image/jpeg >
<source
media="(min-width: 601px)"
srcset="medium-image_1x.webp 1x, medium-image_retina.jpeg 2x"
type="image/jpeg" >
<source
@feliciaceballos
feliciaceballos / functions.php
Last active April 10, 2019 05:12
Add custom sizes in WordPress
<?php
// First we'll add support for featured images
add_theme_support( 'post-thumbnails' );
// Then we'll add our 2 custom images
add_image_size( 'featured-large', 1600, 400, true );
add_image_size( 'blog-width', 800, 600 );
// And then we'll add the custom size that spans the width of the blog to the Gutenberg image dropdown
add_filter( 'image_size_names_choose', 'wpmudev_custom_image_sizes' );
@feliciaceballos
feliciaceballos / index.php
Created April 10, 2019 05:08
Basic WordPress Loop
<?php
get_header();
if (have_posts()) :
while (have_posts()) :
the_post(); ?>
<h1><?php the_title() ;?></h1>
<?php
the_post_thumbnail( 'featured-large' );
the_content();
@feliciaceballos
feliciaceballos / functions.php
Last active April 10, 2019 02:55
Add Custom Images Sizes to Gutenberg Image Block
<?php
add_filter( 'image_size_names_choose','wpmudev_custom_image_sizes' );
function wpmudev_custom_image_sizes( $sizes ) {
return array_merge( $sizes, array(
//Add your custom sizes here
'custom-image-square' => __( 'Square' ),
'blog-width' => __( 'Blog Content Full Width' ),
@feliciaceballos
feliciaceballos / functions.php
Created March 11, 2019 20:00
Add custom stylesheet to WordPress Login Page
<?php
//If you're using this in your functions.php file, remove the opening <?php
//Replace style-login.css with the name of your custom CSS file
function my_custom_login_stylesheet() {
wp_enqueue_style( 'custom-login', get_stylesheet_directory_uri() . '/style-login.css' );
}
//This loads the function above on the login page
add_action( 'login_enqueue_scripts', 'my_custom_login_stylesheet' );
@feliciaceballos
feliciaceballos / functions.php
Created March 12, 2019 07:17
WordPress Login Page Override Error Message
<?php
//remove <?php when you paste into your functions.php file
function login_error_override()
{
return 'Incorrect login details.';
}
add_filter('login_errors', 'login_error_override');
@feliciaceballos
feliciaceballos / style-login.css
Created March 12, 2019 07:14
WordPress Login Page Change WordPress logo
body.login div#login h1 a {
background-image: url('login-logo.png');
}
@feliciaceballos
feliciaceballos / style-login.css
Created March 12, 2019 07:11
WordPress hide lost password link on login page
body.login div#login p#nav {
display: none;
}