This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.addEventListener('load', function() { | |
const testimonialItems = document.querySelectorAll('.testimonial-item'); | |
testimonialItems.forEach(testimonialItem => { | |
var maxLength = 200; | |
const textLength = testimonialItem.innerText.length; | |
if(textLength > maxLength) { | |
var shortContent = testimonialItem.innerText.substring(0, maxLength); /*split the content in two parts*/ | |
var longContent = testimonialItem.innerText.substring(maxLength); | |
testimonialItem.innerHTML = shortContent + '<i class="read_more">...<strong> Read More</strong></i>'; | |
const readbtn = testimonialItem.querySelectorAll('.read_more'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Create a custom shortcode that calls and display content from another file/tempalate part | |
* | |
* We have a file called custom-form.php inside inc folder which contains our custom form codes | |
* | |
*/ | |
function custom_form( $atts, $content, $shortcode_tag ){ | |
ob_start(); | |
get_template_part('inc/custom-form'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="opening-hours"> | |
<div class="row"> | |
<div class="col-12"><h4>Our Business Hours</h4></div> | |
</div> | |
<div class="row" id="Sunday"> | |
<div class="col-6 day">Sunday</div> | |
<div class="col-6 text-md-end hours">Open 24 Hrs</div> | |
</div> | |
<div class="row" id="Monday"> | |
<div class="col-6 day">Monday</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* We are using rank_math_locations custom post type. (or any other) | |
* Meta Box to create custom fields which saves in its own database table | |
* We have location metabox custom field saved in table "mbox_locations" and | |
* service type custom field saved in table "mbox_services" | |
* | |
* mbox_locations contains a sub-field(toggle) called capital-cities | |
* mbox_services contains a sub-field(radio) called service-type | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//get repeater field called 'services' | |
$services = rwmb_meta( 'services' ); | |
if ( ! empty( $services ) ) { | |
foreach ( $services as $service ) { | |
//retrieve each values from subfield inside the services field | |
echo wp_get_attachment_image( $service['services_image'], 'full' ); | |
echo $service['services_title']; | |
echo $service['services_description']; | |
//there is a repeater subfield within this called 'services_links' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$fileName = get_template_directory() . '/css/theme.css'; | |
$modifiedDate = filemtime($fileName); | |
echo '<script>console.log(' . $modifiedDate . ')</script>'; | |
?> | |
<script> | |
var fileName = "<?=home_url()?>/wp-content/themes/jims-aircon/css/theme.css"; | |
var req = new XMLHttpRequest(); | |
req.open("HEAD", fileName, false); | |
req.send(null); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
In this example, I've created custom post-types called "locations" and custom taxonomy called "state" | |
By default the generated permalink structure would look like this: | |
Locations: <base-url>/locations/<post-slug>/ | |
State: <base-url>/state/<taxonomy-slug>/ | |
But here is what I wanted: | |
1. Replace "locations" with "service-areas" in the permalink for locaitons. | |
2. Permalink structure for "locations" to be: <base-url>/service-areas/<state-slug>/<locations-slug> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Remove WP Bloat | |
* Please Note: This removes WP bloat for better performance. Remove or add feaures as necessary | |
*/ | |
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10 ); | |
remove_action( 'template_redirect', 'wp_shortlink_header', 11 ); | |
remove_action('wp_head', 'rsd_link'); //removes EditURI/RSD (Really Simple Discovery) link. | |
remove_action('wp_head', 'wlwmanifest_link'); //removes wlwmanifest (Windows Live Writer) link. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//add custom message box in Dashboard | |
add_action('wp_dashboard_setup', 'custom_dashboard_widgets'); | |
function custom_dashboard_widgets() { | |
wp_add_dashboard_widget('custom_dashboard_id', 'Custom Theme Support', 'custom_dashboard_message'); | |
} | |
function custom_dashboard_message() { | |
echo '<p>Welcome to your Awesome WordPress Theme.</p>'; | |
} |
NewerOlder