Skip to content

Instantly share code, notes, and snippets.

@SitesByYogi
SitesByYogi / sbci.php
Created September 22, 2022 17:36
(SproutBillings) - Card input Workaround
<?php if ( 'false' === get_option( 'si_plaid_ach_only' ) ) : ?>
<div class="row description">
<p><?php esc_html_e( 'Please select from the payment types below. Saving your payment information is secure and makes things easier for the future', 'sprout-invoices' ); ?></p>
</div>
<div class="sa-control-group ">
<span class="label_wrap">
<label for="sa_credit_payment_method"><?php esc_html_e( 'Payment Method', 'sprout-invoices' ); ?></label> <span class="required">*</span>
</span>
<span class="input_wrap">
@SitesByYogi
SitesByYogi / disable-admin.css
Created August 5, 2022 21:53
disable wp admin with css
#wpadminbar ul#wp-admin-bar-root-default>li {
margin-right: 0;
display: none;
}
@SitesByYogi
SitesByYogi / cpt-query.php
Created August 1, 2022 00:09
Query Custom Post Type in your WordPress Template
<?php
$args = array( 'post_type' => 'movies', 'posts_per_page' => 10 );
$the_query = new WP_Query( $args );
?>
<?php if ( $the_query->have_posts() ) : ?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<h2><?php the_title(); ?></h2>
<div class="entry-content">
<?php the_content(); ?>
</div>
@SitesByYogi
SitesByYogi / cpt.php
Last active August 1, 2022 00:24
Setup Custom Post Type for WordPress
<?php
/*
* Creating a function to create our CPT
*/
function custom_post_type() {
// Set UI labels for Custom Post Type
$labels = array(
'name' => _x( 'Artist', 'Post Type General Name', 'nfinite' ),
@SitesByYogi
SitesByYogi / custom-functions.php
Created July 24, 2022 18:24
Adds a custom functions file to your wordpress file struction. Be sure to create a new folder and connect it.
<?php
//=========================================================
// Add Custom functions file to WordPress
//=========================================================
$roots_includes = array(
'/theme-functions/theme-colors.php'
);
@SitesByYogi
SitesByYogi / expand-profile.php
Created July 24, 2022 02:17
Expand the WordPress User Profile page
<?php
add_action( 'show_user_profile', 'my_show_extra_profile_fields' );
add_action( 'personal_options_update', 'my_save_extra_profile_fields' );
function my_show_extra_profile_fields( $user ) { ?>
<h3>Employee Information</h3>
@SitesByYogi
SitesByYogi / custom-dashwidget.php
Created July 24, 2022 00:35
Add a custom dashboard widget to WordPress admin
<?php
add_action('wp_dashboard_setup', 'my_custom_dashboard_widgets');
function my_custom_dashboard_widgets() {
global $wp_meta_boxes;
wp_add_dashboard_widget('custom_help_widget', 'Theme Support', 'custom_dashboard_help');
}
@SitesByYogi
SitesByYogi / remove-admin-links.php
Last active July 24, 2022 02:31
Remove admin menu links based on user role
@SitesByYogi
SitesByYogi / replace-word.php
Last active July 24, 2022 00:28
Replace terms and phrases
<?php
// Filter hook
add_filter('the_content',array('sby2_fix_wordpress','fix_spelling'));
class sby2_fix_wordpress
{
function fix_spelling($content)
{
@SitesByYogi
SitesByYogi / top-message.php
Created July 24, 2022 00:01
Adds an admin notice to the top of page or post editor
// top message
add_action('all_admin_notices','top_message');
function top_message()
{
if(strpos($_SERVER['REQUEST_URI'],'post-new')>0 || strpos($_SERVER['REQUEST_URI'],'post.php')>0)
{
echo ("
<div style=' background:#d3d3d3; width:95%; font-weight:bold; border:2px solid #AAA;