This function will replace all occurrences of “look-for-this-string” in page content function wb_replace_text($text) { $text = str_replace(‘look-for-this-string’, ‘replace-with-this-string’, $text); return $text; } add_filter(‘the_content’, ‘wb_replace_text’);
Category Archives: Wordpress
Theme or plugin editor are posing a risk to security, at least according to people a lot smarter than me! Many auto-installers, hostings, security plugins are amending wp-config file by adding a couple of constants. If you cannot see theme/plugin editor, check your wp-config.php file for the following lines: define( ‘DISALLOW_FILE_EDIT’, true ); define( ‘DISALLOW_FILE_MODS’, […]
register_activation_hook(__FILE__, ‘wojciech_borowicz_mec_cron_job_schedule’); function wojciech_borowicz_mec_cron_job_schedule() { if (! wp_next_scheduled ( ‘wojciech_borowicz_remove_expired_events_cron_job’ )) { wp_schedule_event(time(), ‘daily’, ‘wojciech_borowicz_remove_expired_events_cron_job’); } } add_action(‘wojciech_borowicz_remove_expired_events_cron_job’, ‘wojciech_borowicz_remove_expired_events’); function wojciech_borowicz_remove_expired_events() { $args = array( ‘post_type’ => ‘mec-events’, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘posts_per_page’=> ‘-1’, ); $loop = new WP_Query( $args ); if( $loop->have_posts() ): $today = date(‘Y-m-d’); while( $loop->have_posts() ): $loop->the_post(); global $post; […]
add_filter(‘style_loader_tag’, ‘flatsomeIconsPreloader’, 10, 2); function flatsomeIconsPreloader($html, $handle) { if( 0 != strpos( $html, ‘flatsome-icons’ ) ) { $html = str_replace( “rel=’stylesheet'”, “rel=’preload’ as=’style’ “, $html ); $html .= “”; } return $html; }
function my_shortcode() { $message = ‘Hello world!’; // Output needs to be return return $message; } // register shortcode add_shortcode(‘shortcodeNameToCall’, ‘my_shortcode’);
Outlook.com SMTP Settings Host: smtp-mail.outlook.com Port: 587 Username: Your Outlook.com account email (e.g. john@outlook.com) Password: Your Outlook.com account password Encryption: TLS Office 365 SMTP Settings Host: smtp.office365.com Port: 587 Username: Your Office 365 account email Password: Your Office 365 account password Encryption: TLS Hotmail SMTP Settings Host: smtp.live.com Port: 587 Username: Your Hotmail account email (e.g. john@hotmail.com) Password: Your Hotmail account password Encryption: TLS Yahoo Mail SMTP Settings Host: smtp.mail.yahoo.com Port: 465 […]
jQuery(document).ready(function( $ ) { // $ Works! You can test it with next line if you like // console.log($); });
$content = get_post()->post_content; echo $content = apply_filters(‘the_content’, $content);
add_action(‘admin_head’, ‘hide_updates’); function hide_updates() { if(get_current_user_id()!=1){ echo ‘<style> span.update-plugins{display:none!important;} tr.plugin-update-tr.active {display:none!important} .wrap .notice.notice-error { display: none!important;} </style>’; } }
function wpdocs_register_meta_boxes() { add_meta_box( ‘meta-box-id’, __( ‘Backend Name’, ‘textdomain’ ), ‘wpdocs_my_display_callback’, ‘post_type’ ); } add_action( ‘add_meta_boxes’, ‘wpdocs_register_meta_boxes’ ); function wpdocs_my_display_callback( $post ) { // INPUT FIELDS GO HERE ?> <label>Year: <input type=”text” name=”inputName” value=”<?php echo get_post_meta(get_the_ID(), ‘meta_key’)[0]; ?>” /></label> <?php } /** * Save meta box content. * * @param int $post_id Post ID */ […]
- 1
- 2