Skip to content

Forum in maintenance, we will back soon 🙂

Notifications
Clear all

Code Snippets

19 Posts
3 Users
5 Reactions
750 Views
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
Topic starter
 

Replace WordPress Logo on Login Page

<?php
add_filter( 'login_head', function () {
	// Update the line below with the URL to your own logo.
	// Adjust the Width & Height accordingly.
	$custom_logo = 'https://wpcode.com/wp-admin/images/wordpress-logo.svg';
	if (function_exists('get_custom_logo')) {
		$custom_logo_id = get_theme_mod('custom_logo');
		$custom_logo = esc_url(wp_get_attachment_image_src( $custom_logo_id , 'full' )[0]);
	}
	$logo_width  = 84;
	$logo_height = 84;

Custom User Greeting Shortcode

<?php
function custom_greeting_shortcode() {
    if (is_user_logged_in()) {
        $current_user = wp_get_current_user();
        return 'Welcome, ' . esc_html($current_user->display_name);
    } else {
        return 'Welcome, Anonymous User';
    }
}
add_shortcode('custom_greeting', 'custom_greeting_shortcode');

AIOSEO Disable User Profile Tab Filter

<?php
add_filter( "aioseo_user_profile_tab_disable", "__return_true" );

Disable Application Passwords Except Super User

<?php
$current_user = wp_get_current_user();
if ($current_user->has_cap('delete_users') != true) {
	add_filter( 'wp_is_application_passwords_available', '__return_false' );
}

 

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 02/28/2024 1:27 am
Hasan Aboul Hasan
(@admin)
Posts: 1257
Member Admin
 

Thanks for sharing. 

I am working on a code snippet library : https://learnwithhasan.com/codes-library/

maybe I should allow contributions,

 

 
Posted : 02/28/2024 7:23 am
SSAdvisor reacted
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
Topic starter
 

@admin that would be a great idea. Did you notice I created a custom shortcode without the premium license? You just leave the "Insert method" on the "Auto insert" option and then use the "add_shortcode()" function of WordPress in the snippet.

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 02/28/2024 2:14 pm
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
Topic starter
 

@admin what does the "_lws_" in the function names, variables and file paths represent?

Oh, I get it, it should be "_lwh_" (LearnWithHasan) but you use "_lws_" in a few places in the "Used By All Tools" snippet; was that on purpose?

This post was modified 9 months ago by SSAdvisor

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 02/28/2024 3:00 pm
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
Topic starter
 

You will want to add the following on the Replace WordPress Logo snippet:

function my_login_logo_url() {
    return home_url();
}
add_filter( 'login_headerurl', 'my_login_logo_url' );

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 02/28/2024 9:56 pm
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
Topic starter
 

And also add

function my_login_title() {
    return 'Log In | ' . get_bloginfo('name');
}
add_filter('login_title', 'my_login_title');

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 02/28/2024 10:30 pm
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
Topic starter
 

I've created a public GitHub Repository for these. https://github.com/SSAdvisor/wpCodeSnippets

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 02/29/2024 4:18 am
Hasan Aboul Hasan
(@admin)
Posts: 1257
Member Admin
 

@ssadvisor I just use this to make my functions unique.

 
Posted : 02/29/2024 8:26 am
SSAdvisor reacted
(@google-jameskiarie)
Posts: 6
Active Member
 

Hi guys I am trying to convert the PHP tools website: https://gtseotools.com into a WordPress website. I have for example the full codes for the Plagiarism Checker but I am unsure how to make it work on WordPress. I also want to do the same for all the other tools on the website. I just need help to know how to convert one tool and I''ll convert the others myself.

 
Posted : 02/29/2024 8:33 pm
SSAdvisor
(@ssadvisor)
Posts: 1139
Noble Member
Topic starter
 

@google-jameskiarie why? Do you own the stated website? If so, show us the code. Have you taken the SaaS course; Hasan explains it all in the course.

Regards,
Earnie Boyd, CEO
Seasoned Solutions Advisor LLC
Schedule 1-on-1 help
Join me on Slack

 
Posted : 02/29/2024 9:14 pm
(@google-jameskiarie)
Posts: 6
Active Member
 

@ssadvisor Yeah I own the website, it's a PHP script I bought from codecanyon...Here is the code for the Plagiarism checker specifically <

<?php
defined('APP_NAME') or die(header('HTTP/1.0 403 Forbidden'));
?>
 
<script>
var palPath = '<?php createLink('extract'); ?>';
var wordsLimit = '<?php echo $wordLimit; ?>';
var minLimit = '<?php echo $minChar; ?>';
var apiType = '<?php echo $api_type; ?>';
var placeHolderText = '<?php makeJavascriptStr($lang['61'],true); ?>';
var inputEm = '<?php makeJavascriptStr($lang['AS5'],true); ?>';
var articleLm = '<?php makeJavascriptStr($lang['AS23'],true); ?>';
var wordLm = '<?php makeJavascriptStr($lang['AS24'],true); ?>';
var stringStr = '<?php makeJavascriptStr($lang['AS25'],true); ?>';
var uniqueStr = '<?php makeJavascriptStr($lang['AS26'],true); ?>';
var goodStr = '<?php makeJavascriptStr($lang['179'],true); ?>';
var alreadyStr = '<?php makeJavascriptStr($lang['AS27'],true); ?>';
var unqStr = '<?php makeJavascriptStr($lang['AS28'],true); ?>';
</script>
 
<style>
#outputBox {
    display: none;
}
.progress-bar-striped, .progress-striped .progress-bar {
    background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
    background-size: 40px 40px;
}
.percentimg {
    display: none;
    text-align: center;
}
.fileinput-button {
    overflow: hidden;
    position: relative;
}
.fileinput-button input {
    cursor: pointer;
    direction: ltr;
    font-size: 200px;
    margin: 0;
    opacity: 0;
    position: absolute;
    right: 0;
    top: 0;
}
@media screen {
.fileinput-button input {
    font-size: 100%;
    height: 100%;
}
}</style>
 
<link rel="stylesheet" href="<?php themeLink('css/jquery.fileupload.css'); ?>" />
<script src='<?php createLink('core/library/plagiarism.js?new&v2',false,true); ?>'></script>
 
  <div class="container main-container">
<div class="row">
          <?php
            if($themeOptions['general']['sidebar'] == 'left')
                require_once(THEME_DIR."sidebar.php");
            ?>
          <div class="col-md-8 main-index">
            
            <div class="xd_top_box">
             <?php echo $ads_720x90; ?>
            </div>
            
              <h2 id="title"><?php echo $data['tool_name']; ?></h2>
 
                <?php if ($pointOut != 'output') { ?>
                
                 <div id="mainbox">
 
                     <div class="row">
                         <div class="col-md-6">
                             <p> <?php trans('OR Select a file: (.docx/.txt)', $lang['AD726']); ?> </p>
                             <span class="btn btn-success fileinput-button">
                        <i class="glyphicon glyphicon-plus"></i>
                        <span><?php trans('Select file', $lang['AD727']); ?></span>
                        <input type="file" multiple="" name="files[]" id="fileupload" />
                        </span>
                             <br />
                             <br />
                         </div>
 
                         <div class="col-md-6">
                             <div id="websiteBox">
                                 <p><?php trans('OR Paste your url here', $lang['AD729']); ?> </p>
                                 <input id="myurl" class="form-control" type="text" placeholder="<?php trans('Enter your url', $lang['AD728']); ?>" />
                             </div>
                         </div>
                     </div>
 
                     <!-- The global progress bar -->
                     <div class="progress" id="progress">
                         <div class="progress-bar progress-bar-success progress-bar-striped"></div>
                     </div>
                     <br />
 
                <p><?php echo $lang['56']; ?></p>
                <?php if(isset($_POST['palData'])){ ?>            
                    <textarea id="mycontent" name="data" rows="3" style="height: 270px;" class="form-control"><?php echo $palData; ?></textarea> <br />
                <?php } else { ?>
                    <textarea id="mycontent" name="data" rows="3" style="height: 270px;" class="form-control"></textarea> <br />
                <?php } ?> 
                <input type="hidden" id="authCode" value="<?php echo $secKey.$secVal; ?>" />
                <br />  
                
                <div class="tbox">
                <div class="max-text"><?php echo $lang['59']; ?> <span id="max_words_limit"><?php echo $wordLimit; ?></span> <?php echo $lang['60']; ?>.</div>
                <div class="total-word"><?php echo $lang['58']; ?>: <span id="words-count">0</span></div>
                </div>
                        <br />
 
                <?php if ($toolCap) echo $captchaCode; ?>
                <div class="text-center"> 
                <a class="btn btn-info" style="cursor:pointer;" id="checkButton"><?php echo $lang['57']; ?></a>
                </div>
                        
            </div>
 
            <div class="percentimg">
            <img src="<?php themeLink('img/load.gif'); ?>" />
            <br />
            <?php echo $lang['AS10']; ?>
            <br />
            </div>
            
            <div class="percentbox" id="percent">
            </div>
            
            <div>
                <table class="table table-bordered" id="resultList">
                    
                </table>
            </div>       
           <?php } ?>
 
<br />
 
<div class="xd_top_box">
<?php echo $ads_720x90; ?>
</div>
 
<h2 id="sec1" class="about_tool"><?php echo $lang['11'].' '.$data['tool_name']; ?></h2>
<p>
<?php echo $data['about_tool']; ?>
</p> <br />
</div>              
            
        <?php
        if($themeOptions['general']['sidebar'] == 'right')
            require_once(THEME_DIR."sidebar.php");
        ?>   
        </div>
    </div> <br />
 
<script src="<?php themeLink('js/vendor/jquery.ui.widget.js'); ?>"></script>
<script src="<?php themeLink('js/jquery.iframe-transport.js'); ?>"></script>
<script src="<?php themeLink('js/jquery.fileupload.js'); ?>"></script>
 
<script>
$(function () {
    'use strict';
    // Change this to the location of your server-side upload handler:
    var url = baseUrl+'core/upload/';
    $('#fileupload').fileupload({
        url: url,
        dataType: 'json',
        done: function (e, data) {
            $.each(data.result.files, function (index, file) {
                // Completed 
                var file_name = file.name;
                var tBox = $("#mycontent");
                jQuery.post(baseUrl+'core/upload/process.php',{fileName:file_name},function(data){
                tBox.val(data);
                });
            });
        },
        progressall: function (e, data) {
            var progress = parseInt(data.loaded / data.total * 100, 10);
            $('#progress .progress-bar').css(
                'width',
                progress + '%'
            );
        }
    }).prop('disabled', !$.support.fileInput)
        .parent().addClass($.support.fileInput ? undefined : 'disabled');
});
</script>>
 
Posted : 03/01/2024 8:45 am
Hasan Aboul Hasan
(@admin)
Posts: 1257
Member Admin
 

@google-jameskiarie Hi friend, I see it is a codecanyon script.

are you familiar with PHP? did you watch my latest course? I showed how to build a tool step by step on wordpress. you can replace the code with whatever tool you want

 
Posted : 03/01/2024 12:41 pm
SSAdvisor reacted
Hasan Aboul Hasan
(@admin)
Posts: 1257
Member Admin
 

The code you attached is a combination of HTML, JS, and CSS; this is the front end. if you are a PHP web developer, you can get out the code and convert into WordPress. otherwise it is not a simple process if you are not familiar with the code.

 
Posted : 03/01/2024 12:44 pm
(@google-jameskiarie)
Posts: 6
Active Member
 

@admin Yeah i know thats the frontend. I just have a basic understanding of PHP. So I will try to do it myself. Thanks

 
Posted : 03/01/2024 12:47 pm
(@google-jameskiarie)
Posts: 6
Active Member
 

@admin Hi I just have a basic understanding of PHP, Which course are you talking about? the one about turning WordPress into Saas or the one where you created a hook generator? Personally, my only issue is making sure the script works on WordPress, as for the other parts I can do it myself.

 
Posted : 03/01/2024 12:52 pm
Page 1 / 2
Share: