function connect_scripts_and_styles_form( $hook_suffix ) {
if ( 'comment.php' === $hook_suffix ) {
wp_register_script( 'jquery_form', plugins_url( 'scripts/jQuery.js', __FILE__ ) );
wp_enqueue_script( 'jquery_form' );
wp_register_script( 'script_form', plugins_url( 'scripts/script.js', __FILE__ ) );
wp_enqueue_script( 'script_form' );
wp_register_style( 'style_form', plugins_url( 'styles/style.css', __FILE__ ) );
wp_enqueue_style( 'style_form' );
}
}
The shortcode parser does not accept square brackets within attributes
<?php
$current_post_id = get_the_ID(); // ещё можно попробовать функцию get_queried_object_id()
$args = array (
'post_type' => 'jobs',
'posts_per_page' => '5' ,
'ignore_sticky_posts' => false ,
// 'post__not_in' => array(get_the_ID ())
);
$query = new WP_Query ($args);
if ($ query-> have_posts ()):
while ($query-> have_posts ()): $query-> the_post (); ?>
<?php if( get_the_ID() == $current_post_id ){ ?>
<?php the_title();?>
<?php } else { ?>
<a href="<?php the_permalink(); ?>"><?php the_title();?></a>
<?php }?>
<?php end while ;
endif ;
wp_reset_query(); ?>
$args = array(
'orderby' => 'count',
'order' => 'desc',
'exclude' => array( 1, 2 ) // Исключенные рубрики
);
$top_categories = get_categories( $args );
echo "<ul>";
foreach ( $top_categories as $category ) {
echo '<li><a href="' . get_category_link( $category->term_id ) . '">' . $category->name . ' (' . $category->count . ') </a></li>';
}
echo "</ul>";
но в ней не указано КУДА вставлять скрипт из их примера (в functions.php или в настройки самого плагина Contact Form 7):
document.addEventListener( 'wpcf7mailsent', function( event ) {
if ( '59' == event.detail.contactFormId ) {
gtag('event','submit', {'event_category' : 'Form'});
}
}, false );
function my_wp() {
$user_id = get_current_user_id();
$class = get_user_meta( $user_id, 'user_class', true );
$role = get_user_meta( $user_id, 'user_role', true );
if ( ( $class != 5 || $role != 'user_role_4' ) && is_single() ) {
global $wp_query;
$wp_query->set_404();
status_header( 404 );
}
}
add_action( 'wp', 'my_wp' );