This file contains 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
import './scss/style.scss'; | |
// Example jQuery usage: | |
$(document).ready(() => { | |
$('h1').css('color', 'red'); | |
}); |
This file contains 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
{ | |
"name": "fictional-university-theme", | |
"version": "1.0.0", | |
"description": "A fictional university WordPress theme.", | |
"main": "index.js", | |
"scripts": { | |
"dev": "webpack serve --config webpack.config.js --env.mode=development", | |
"build": "webpack --config webpack.config.js --env.mode=production" | |
}, | |
"author": "", |
This file contains 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 | |
class Recent_Posts_Widget extends WP_Widget { | |
/** | |
* Register widget with WordPress. | |
*/ | |
function __construct() { | |
parent::__construct( | |
'recent_posts_widget', // Base ID | |
__( 'Recent Posts Widget', 'text_domain' ), // Name |
This file contains 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 | |
class Custom_Page_Title_Widget extends WP_Widget { | |
/** | |
* Register widget with WordPress. | |
*/ | |
public function __construct() { | |
parent::__construct( | |
'custom_page_title_widget', // Base ID |
This file contains 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 | |
/* | |
Plugin Name: Date Widget | |
Description: A widget that displays the current date. | |
Version: 1.0 | |
Author: Your Name Here | |
*/ | |
// Register the widget | |
add_action( 'widgets_init', 'register_date_widget' ); |
This file contains 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 | |
class birdtree_greeting_widget extends WP_Widget { | |
// Set up the widget name, description, etc. | |
public function __construct() { | |
$widget_options = array( | |
'classname' => 'birdtree_greeting_widget', | |
'description' => 'Displays a greeting message from BirdTree' | |
); |
This file contains 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 | |
/* To modify the columns in a WordPress dashboard table, you can use the manage_{$post_type}_posts_columns filter. | |
This filter allows you to add or remove columns from the post type's edit screen. | |
Here is an example of how to use this filter to modify the columns in the Posts table: | |
*/ | |
Modify wordpress dashboard table column headings with image columns and featured image example | |
function custom_posts_table_columns($columns) { | |
// Remove the Author column | |
unset($columns['author']); |
This file contains 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 | |
/* Selective refresh is a feature in the WordPress Customizer that allows you to update a specific section of a page without having | |
to reload the entire page. It works by using JavaScript to dynamically update only the content that has changed, rather than reloading | |
the entire page. | |
This is especially useful for live previewing changes to your website's appearance or content, as it allows you to see how your | |
changes will look in real-time without disrupting the user experience. | |
For example, if you make a change to the site title in the Customizer, instead of reloading the entire page, only the site title | |
element would be updated. This makes for a smoother and more efficient editing experience. |
This file contains 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 | |
/* | |
The purpose of this field is to allow you to enter a custom URL for an image, which can be used as the featured image for your | |
WordPress post or page. This could be useful if you have an image that you want to use as the featured image, but it is not hosted | |
on your own website and therefore cannot be easily uploaded through the WordPress media library. | |
By adding this custom field, you can enter the URL of the external image and then use it as the featured image for your post or page, | |
just as you would with a standard image uploaded through the WordPress media library. | |
*/ |
This file contains 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 | |
// Validate and sanitize the ID of the current post | |
$portfolio_id = ( isset( $_GET['post'] ) && ctype_digit( $_GET['post'] ) ) ? $_GET['post'] : ''; | |
$portfolio_id = filter_var( $portfolio_id, FILTER_SANITIZE_NUMBER_INT ); | |
// Verify the nonce before processing the form submission | |
if ( isset( $_POST['submit_related_portfolio'] ) && wp_verify_nonce( $_POST['related_portfolio_nonce'], 'related_portfolio' ) ) { | |
// Sanitize the input data |
OlderNewer