SimonTech Development
  • Contact Us
  • Request Quote
  • Consulting
      • Back
      • CMS Strategy
      • Custom Development
      • Server Management
      • Integrated Automation
  • Development & Design
      • Back
      • Joomla CMS
      • WordPress CMS
      • Custom Application Development
      • Marketing Automation
  • Website Maintenance
      • Back
      • Managed Cloud Hosting
      • CMS Maintenance
      • Site Security Mitigation
      • Backup, Repair & Restore
  • Plans & Pricing
  • Support
Account
Please wait, authorizing ...
Not a member? Sign up now
×

Knowledge Base

Wordpress

Inserting local or external script files

Details
Parent Category: Knowledge base
Category: Wordpress

Your  $scr should look like this using wp_register_script()

plugins_url( '/removeArrows.js' , __FILE__ )

wp_register_script( $handle, $src, $deps, $ver, $in_footer );

Another point of note, it is always good practice to load your scripts and styles last. This will ensure that it will not get overriden by other scripts and styles. To do this, just add a very low priority (very high number) to your priority parameter ($priority) of add_action.

 add_action( 'wp_enqueue_scripts', 'wpb_adding_scripts', 999 ); 

And always load/enqueue scripts and styles via the wp_enqueue_scripts action hook, as this is the proper hook to use. Do not load scripts and styles directly to wp_head or wp_footer

For themes, your $scr would change to this

 get_template_directory_uri() . '/removeArrows.js'

for parent themes and this

get_stylesheet_directory_uri() . '/removeArrows.js'

for child themes. Your complete code should look like this

function wpb_adding_scripts() {
    wp_register_script('my_amazing_script', get_template_directory_uri() . '/removeArrows.js', array('jquery'),'1.1', true);
    wp_enqueue_script('my_amazing_script');
} 

add_action( 'wp_enqueue_scripts', 'wpb_adding_scripts', 999 ); 

And In a case th first script should be loaded only if another second script is loaded

function my_enqueue_scripts()
{
    wp_register_script( 'first', get_template_directory_uri() . 'js/first.js' );
 
    wp_enqueue_script( 'second', get_template_directory_uri() . 'js/second.js', array( 'first' ) );
}
add_action( 'wp_enqueue_scripts', 'my_enqueue_scripts' );

 

Example of how to load an external script and making it jquery dependant:

add_action( 'wp_enqueue_scripts', 'radioco_streaming_scripts' );
function radioco_streaming_scripts() {
    wp_enqueue_script( 'radioco', 'https://public.radio.co/playerapi/jquery.radiocoplayer.min.js', array('jquery') );
}

 

Add admin via Database MYSQL Query

Details
Parent Category: Knowledge base
Category: Wordpress

INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`,
`user_status`)
VALUES ('stech', MD5('CrazyHardPasswordWithLotsofWordsandNumbers294173618'), 'Simon Tech', '[email protected]', '0');

INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
VALUES (NULL, (Select max(id) FROM wp_users),
'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');

INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
VALUES (NULL, (Select max(id) FROM wp_users), 'wp_user_level', '10');

Buddypress Multiple Field Groups on Register

Details
Parent Category: Knowledge base
Category: Wordpress
<?php $formloop = 0; ?>
<?php if ( bp_is_active( ‘xprofile’ ) ) : if ( bp_has_profile( ) ) : while ( bp_profile_groups() ) : bp_the_profile_group(); ?>
<?php
if (bp_get_the_profile_group_id() != $formloop) {
$formloop = bp_get_the_profile_group_id();
$newfieldset = TRUE;
?>
<fieldset id="xprofile_<?php echo bp_get_the_profile_group_slug() ?>">
<legend><?php echo bp_get_the_profile_group_name() ?></legend>
<?php
}
?>
<?php while ( bp_profile_fields() ) : bp_the_profile_field(); ?>
<?php$formlist[] = bp_get_the_profile_field_id(); ?>

—– Continue with the form code —-

<?php endwhile; ?>
<?php
if ($newfieldset == TRUE) {
$newfieldset = FALSE;
?>
</fieldset>
<?php
}
?>
<?php endwhile; endif; endif; ?>
<input type="hidden" name="signup_profile_field_ids" id="signup_profile_field_ids" value="<?php echo implode(",", $formlist); ?>" />

 

  • Services
  • Support Tickets
  • Knowledge Base
  • Extensions and Releases
  • Contact Us
Facebook LinkedIn Twitter Github
  • Terms & Conditions
  • Privacy Policy
© 2008 - 2025 SimonTech Development