adding stuff in shortcut
This commit is contained in:
parent
e354afb96b
commit
21b289cbcd
|
|
@ -1,24 +1,22 @@
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
define( 'WP_DEBUG', true );
|
define('WP_DEBUG', true);
|
||||||
define( 'WP_DEBUG_LOG', true );
|
define('WP_DEBUG_LOG', true);
|
||||||
define( 'WP_DEBUG_DISPLAY', false );
|
define('WP_DEBUG_DISPLAY', false);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
// ##### Syntax
|
// ##### Syntax
|
||||||
|
|
||||||
<?php if($var):?>
|
<?php if ($var) : ?>
|
||||||
<p><?php echo $var['title']?></p>
|
<p><?php echo $var['title'] ?></p>
|
||||||
<?php endif;?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
||||||
<?php if($var){?>
|
<?php if ($var) { ?>
|
||||||
<p><?php echo $var['title']?></p>
|
<p><?php echo $var['title'] ?></p>
|
||||||
<?php };?>
|
<?php }; ?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -27,11 +25,13 @@ define( 'WP_DEBUG_DISPLAY', false );
|
||||||
|
|
||||||
// ##### Template parts 🡒 Get templates parts
|
// ##### Template parts 🡒 Get templates parts
|
||||||
|
|
||||||
get_template_part( 'template-parts/blocks/the-file', null,
|
get_template_part(
|
||||||
|
'template-parts/blocks/the-file',
|
||||||
|
null,
|
||||||
array(
|
array(
|
||||||
'ID'=>$my_post_id,
|
'ID' => $my_post_id,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
/** ------------------------------
|
/** ------------------------------
|
||||||
QUERIES
|
QUERIES
|
||||||
|
|
@ -51,15 +51,15 @@ $posts = get_posts($args);
|
||||||
// ##### Query 🡒 Recent posts
|
// ##### Query 🡒 Recent posts
|
||||||
|
|
||||||
$posts = wp_get_recent_posts([
|
$posts = wp_get_recent_posts([
|
||||||
'numberposts' => 4 ,
|
'numberposts' => 4,
|
||||||
'post_status' => 'publish'
|
'post_status' => 'publish'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
// ##### Query 🡒 With Metaqueries
|
// ##### Query 🡒 With Metaqueries
|
||||||
$args = array(
|
$args = array(
|
||||||
'post_type'=>'activities',
|
'post_type' => 'activities',
|
||||||
'post_status' => array( 'publish', 'future' ),
|
'post_status' => array('publish', 'future'),
|
||||||
'numberposts' => '3',
|
'numberposts' => '3',
|
||||||
'meta_key' => 'date',
|
'meta_key' => 'date',
|
||||||
'orderby' => 'meta_value',
|
'orderby' => 'meta_value',
|
||||||
|
|
@ -78,13 +78,13 @@ $recent_activites = wp_get_recent_posts($args);
|
||||||
|
|
||||||
// ##### Query 🡒 Wordpress Global Query Loop
|
// ##### Query 🡒 Wordpress Global Query Loop
|
||||||
|
|
||||||
$args = array('posts_per_page' => 6,'post_type' => 'post');
|
$args = array('posts_per_page' => 6, 'post_type' => 'post');
|
||||||
$the_query = new WP_Query( $args );
|
$the_query = new WP_Query($args);
|
||||||
|
|
||||||
|
|
||||||
if ( $the_query->have_posts() ) {
|
if ($the_query->have_posts()) {
|
||||||
echo '<ul>';
|
echo '<ul>';
|
||||||
while ( $the_query->have_posts() ) {
|
while ($the_query->have_posts()) {
|
||||||
$the_query->the_post();
|
$the_query->the_post();
|
||||||
echo '<li>' . get_the_title() . '</li>';
|
echo '<li>' . get_the_title() . '</li>';
|
||||||
}
|
}
|
||||||
|
|
@ -106,41 +106,104 @@ $post_date = date_i18n('j F Y', strtotime($post['post_date']));
|
||||||
------------------------------*/
|
------------------------------*/
|
||||||
|
|
||||||
// ##### URL 🡒 Home Url
|
// ##### URL 🡒 Home Url
|
||||||
echo home_url('/admission/');
|
echo home_url('/admission/');
|
||||||
|
|
||||||
// ##### URL 🡒 Site Url
|
// ##### URL 🡒 Site Url
|
||||||
echo site_url('/admission/', 'https');
|
echo site_url('/admission/', 'https');
|
||||||
|
|
||||||
|
|
||||||
/** ------------------------------
|
/** ------------------------------
|
||||||
ENABLE SVG
|
ENABLE SVG
|
||||||
------------------------------*/
|
------------------------------*/
|
||||||
|
|
||||||
/* <?xml version="1.0" encoding="utf-8"?> */
|
/* <?xml version="1.0" encoding="utf-8"?> */
|
||||||
|
|
||||||
function cc_mime_types($mimes) {
|
function cc_mime_types($mimes)
|
||||||
$mimes['svg'] = 'image/svg+xml';
|
{
|
||||||
return $mimes;
|
$mimes['svg'] = 'image/svg+xml';
|
||||||
|
return $mimes;
|
||||||
}
|
}
|
||||||
add_filter('upload_mimes', 'cc_mime_types');
|
add_filter('upload_mimes', 'cc_mime_types');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** ------------------------------
|
/** ------------------------------
|
||||||
INIT WIDGET
|
INIT WIDGET
|
||||||
------------------------------*/
|
------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
function tailwind_widgets_init() {
|
function tailwind_widgets_init()
|
||||||
register_sidebar(
|
{
|
||||||
array(
|
register_sidebar(
|
||||||
'name' => esc_html__( 'Discover_next', 'tailwind' ),
|
array(
|
||||||
'id' => 'discover_next',
|
'name' => esc_html__('Discover_next', 'tailwind'),
|
||||||
'description' => esc_html__( 'Add widgets here.', 'tailwind' ),
|
'id' => 'discover_next',
|
||||||
'before_widget' => '<section id="%1$s" class="widget %2$s">',
|
'description' => esc_html__('Add widgets here.', 'tailwind'),
|
||||||
|
'before_widget' => '<section id="%1$s" class="widget %2$s">',
|
||||||
'after_widget' => '</section>',
|
'after_widget' => '</section>',
|
||||||
'before_title' => '<h2 class="widget-title">',
|
'before_title' => '<h2 class="widget-title">',
|
||||||
'after_title' => '</h2>',
|
'after_title' => '</h2>',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** ------------------------------
|
||||||
|
POSTS
|
||||||
|
------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
// Change Defaults Posts to "News" in menu bar
|
||||||
|
function cp_change_post_object()
|
||||||
|
{
|
||||||
|
$get_post_type = get_post_type_object('post');
|
||||||
|
|
||||||
|
$labels = $get_post_type->labels;
|
||||||
|
$labels->name = 'News';
|
||||||
|
$labels->singular_name = 'News';
|
||||||
|
$labels->add_new = 'Add News';
|
||||||
|
$labels->add_new_item = 'Add News';
|
||||||
|
$labels->edit_item = 'Edit News';
|
||||||
|
$labels->new_item = 'News';
|
||||||
|
$labels->view_item = 'View News';
|
||||||
|
$labels->search_items = 'Search News';
|
||||||
|
$labels->not_found = 'No News found';
|
||||||
|
$labels->not_found_in_trash = 'No News found in Trash';
|
||||||
|
$labels->all_items = 'All News';
|
||||||
|
$labels->menu_name = 'News';
|
||||||
|
$labels->name_admin_bar = 'News';
|
||||||
|
}
|
||||||
|
add_action('init', 'cp_change_post_object');
|
||||||
|
|
||||||
|
|
||||||
|
// Change Defaults Posts Icon in menu bar
|
||||||
|
|
||||||
|
function change_menu_icon()
|
||||||
|
{
|
||||||
|
|
||||||
|
// Access global variables.
|
||||||
|
global $menu;
|
||||||
|
|
||||||
|
foreach ($menu as $key => $val) {
|
||||||
|
|
||||||
|
if (__('News', 'plugin-name') == $val[0]) {
|
||||||
|
$menu[$key][6] = 'dashicons-welcome-widgets-menus';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_action('admin_menu', 'change_menu_icon');
|
||||||
|
|
||||||
|
|
||||||
|
/** ------------------------------
|
||||||
|
HIDE EDITOR ON SPECIFIC PAGE
|
||||||
|
------------------------------*/
|
||||||
|
function remove_editor_init()
|
||||||
|
{
|
||||||
|
if (isset($_GET['post'])) {
|
||||||
|
$id = $_GET['post'];
|
||||||
|
if ($id == 7) {
|
||||||
|
remove_post_type_support('page', 'editor');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_action('init', 'remove_editor_init');
|
||||||
Loading…
Reference in New Issue
Block a user