How to allow certain PHP functions when using sanitize_callback in the word press customizer

Hi I am making my own theme in WordPress and setting up some customizer options and I have one for the text in my footer but I would like to still use <? echo date('Y');?> in the footer to dynamically change the date so I don't have to keep going in and doing it manually but the sanitizer call-back obviously blocks it is there a way to still be able use that php function in the sanitizer here is my …
Category: Web

.htaccess and proxy settings for routing a decoupled REST API consuming theme

Developing a decoupled front-end consuming the REST API... I'm using create-react-app so can enter a proxy field corresponding to WP in my package.json and write my calls like fetch('/wp-json/v2/pages/...') if I run yarn start from the front-end directory... I'd love to actually have this theme in my wp-content/themes/my-theme directory though I'm no .htaccess god How can I make so that: Generic requests like mysite.com/jibble/jabble are handled by my SPA routing Protected routes like mysite.com/wp-admin/* and mysite.com/wp-content/uploads/* are still handled by …
Category: Web

CSS loading as empty file in Custom Theme

Hello I made a custom theme and moved it from MAMP to a cloud server. For some reason the CSS is an empty file. File path is correct, checked the file in cPanel and it has the full .css sheet. But when I go to console and follow the path it is just empty. My .js file loads fine and I beleive i enqueued the paths properly. Any help is greatly appreciated and thank you for your time! Functions <?php …
Category: Web

How to get authors who have added the post in the specific custom post type

I have a custom post called event and I have to show all the authors who have added the post. I have tried the below code but I am getting all the users on the page. For example. There are 4 users called A, B, C, and D on the website and A and B added the post. Now I have to get only A and B users but below code getting all the users like A,B,C,D Any idea how …
Category: Web

Layout changes on phone when held as landscape vs portrait

For some reason http://factualfiction.com/marsartists/ displays correctly on a phone when held in landscape position, but not in the normal portrait position. The site uses an old 2012 child-theme and I'm unsure of how this recent problem originated, but wondering if there is a quick fix...? Thank you
Category: Web

Apostrophes replaced by '

I use a plugin for automatic posting of articles on social networks, and when I send an article on Facebook or Twitter from my website, the apostrophes of my articles are replaced by this: ' It is possible that the problem comes from the theme, but I am not sure. I tried to do a "search and replace" to replace this code with an apostrophe using a "regex" but it does not work at all
Category: Web

For some time, some of my pages do not display the content anymore. Any idea where this could be coming from?

I recently worked on this website : https://semaine.com/ But since some time the content of the pages https://semaine.com/classroom/ and https://semaine.com/cinema/ are not displayed anymore. The pages load, the navbar and the footer are there but not the content. It works locally on my computer with MAMP but not online. I tried several things like disabling various plugins, re-generating links, restoring the theme from my local version, ... Here is the content of the cinema.php file: <?php /** * Template Name: …
Category: Web

creating a custom post template

I want to customize my individual posts. I have an example of what I'm trying to achieve below. Would I make a custom post template for this? If so how would I do this? Or should I add to my single.php? Thanks in advance. What I want my individual post pages to look like. I want two pictures side by side that are the full width of the page. Text. One picture that is the full width of the page. …
Category: Web

registering a global template wordpress 6.0

<?php /* * Template Name : Amaizing Inner Page 1 Template from me* * @package WordPress * @subpackage CADENTIC® BUSINESS THEME * @since MY BUSINESS THEME 0.0.1 */ ?> if we would these simple lines in a template file we would use it as a global template but now in WordPress 6.0, there is no such attribute that exists in Gutenberg to select a new page template. I was following a few articles for this wordpress doc clouddera
Category: Web

Getting text from custom field from customizer

So I've created a panel in the customizer section in WordPress to add the phone number to the site. It works fine in the back end but it wont show up in the front end here is my functions.php function home_smart_register_theme_customizer( $wp_customize ) { $wp_customize->add_panel( 'contact_info', array( 'priority' => 10, 'theme_supports' => '', 'title' => __( 'Contact Info', 'home_smart' ), 'description' => __( 'Set your current address.', 'home_smart' ), ) ); $wp_customize->add_section( 'contact_details_block' , array( 'title' => __('Phone Number','home_smart'), 'panel' …
Category: Web

enqueuing external and internal js and css in wordpress did not work with owl.js animate.css

<?php function cadentic_files () { wp_enqueue_script('cadentic_owl_carousel',get_theme_file_uri('js/owl.carousel.min.js'), array('jquery'), time(), true ); wp_enqueue_script('cadentic_wow_carousel',get_theme_file_uri('js/wow.min.js'), array('jquery'), time(), true ); wp_enqueue_script('cadentic_jquery_carousel',get_theme_file_uri('js/jquery-multitabs.js'), array('jquery'), time(), true ); wp_enqueue_script('cadentic_jquery1113_carousel',get_theme_file_uri('js/jquery-1.11.3.min.js'), array('jquery'), time(), true ); //wp_enqueue_script('cadentic_bootstrap_carousel',get_theme_file_uri('js/bootstrap.min.js'), array('jquery'), time(), true ); wp_enqueue_style('cadentic_font_awesome','https://fonts.googleapis.com/css?family=Roboto:300,400,500,600,700,900', false); wp_enqueue_style('cadentic_font_popins','https://fonts.googleapis.com/css?family=Poppins:100,200,400,300,500,600,700', false); wp_enqueue_style('cadentic_font_confortaa','https://fonts.googleapis.com/css?family=Comfortaa:300,400,700|Josefin+Sans:100i,300,400,700|Raleway:100,200,300,400,500,600,700,800,900', false); wp_enqueue_style('cadentic_main_styles',get_stylesheet_uri(), false); wp_enqueue_style('cadentic_animate_styles',get_theme_file_uri('css/animate.css'), false); wp_enqueue_style('cadentic_owl_styles',get_theme_file_uri('css/owl.theme.default.min.css'), false); //wp_enqueue_style('cadentic_owlcarousel_styles',get_theme_file_uri('css/owl.carousel.min.css'), false); wp_enqueue_style('cadentic_bootstrap_theme_styles',get_theme_file_uri('css/bootstrap-theme.min.css'), false); wp_enqueue_style('cadentic_jquery_styles',get_theme_file_uri('css/jquery-multitabs.css'), false); wp_enqueue_style('cadentic_font_awesome_styles',get_theme_file_uri('css/font-awesome.min.css'), false); wp_enqueue_style('cadentic_main_css_styles',get_theme_file_uri('css/main.css'), false); wp_enqueue_style('cadentic_responsive_css_styles',get_theme_file_uri('responsive.css'), false); wp_enqueue_style( 'bootstrap', '//stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css', false); wp_enqueue_script( 'owl-js', 'https://cdnjs.cloudflare.com/ajax/libs/owl-carousel/1.3.3/owl.carousel.min.js',array('jquery'), time(), true ); wp_enqueue_script( 'jq-js', 'https://code.jquery.com/jquery-3.5.0.js', array('jquery'), time(), true ); wp_enqueue_style( 'wpdocs-datatables-bootstrap-style', 'https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.21/css/dataTables.bootstrap4.min.css' ); wp_enqueue_style( 'wpdocs-bootstrap-style', 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.2/css/bootstrap.min.css' ); // …
Category: Web

How to Show Next, Previous, and Page Numbers with wp_link_pages

I want to modify the output of wp_link_pages. Basically what I need is to show Previous and Next buttons and current page/total number of pages. I created the Previous and Next button. Now in between them I want to add a current page and the total pages number. Here is my code wp_link_pages( array( 'before' => '<div class="page-links">' . __(''), 'after' => '</div>', 'next_or_number' => 'next', 'nextpagelink' => __('Next'), 'previouspagelink' => __('Previous'), 'pagelink' => '%', 'echo' => 1, ) ); …
Category: Web

Adding star ratings to testimonials slider

So I've built a testimonials post type into my WordPress theme added it to a slider on the homepage but I'm getting confused when it comes to adding the rating given by the customers can anyone point me in the right direction im not interested in using a plugin function custom_testimonials() { $labels = array( 'name' => __( 'testimonials' ), 'singular_name' => __( 'Testimonials' ), 'all_items' => __( 'All Testimonials' ), 'view_item' => __( 'View Testimonial' ), 'add_new_item' => __( …
Category: Web

Magnific Popup - Add Caption to Images

My theme uses Magnific Popup as follows in theme.js /* add lightbox for blog galleries */ $(".gallery a[href$='.jpg'],.gallery a[href$='.jpeg'],.featured-item a[href$='.jpeg'],.featured-item a[href$='.gif'],.featured-item a[href$='.jpg'], .page-featured-item .slider a[href$='.jpg'], .page-featured-item a[href$='.jpg'],.page-featured-item .slider a[href$='.jpeg'], .page-featured-item a[href$='.jpeg'], .gallery a[href$='.png'], .gallery a[href$='.jpeg'], .gallery a[href$='.gif']").parent().magnificPopup({ delegate: 'a', type: 'image', tLoading: '<div class="loading dark"><i></i><i></i><i></i><i></i></div>', mainClass: 'my-mfp-zoom-in', gallery: { enabled: true, navigateByImgClick: true, preload: [0,1] // Will preload 0 - before current, and 1 after the current image }, image: { tError: '<a href="%url%">The image #%curr%</a> could not be loaded.', …
Category: Web

Use of undefined constant FS_CHMOD_DIR - assumed 'FS_CHMOD_DIR'

I'm seeing an error while trying to change the colours of a theme: Notice: Use of undefined constant FS_CHMOD_DIR - assumed 'FS_CHMOD_DIR' in /var/www/vhosts/xxx/wp-content/themes/consulting/inc/print_styles.php on line 141 The theme creator has given me the following advice, but cannot provide any further detail: Please contact your hosting provider team and ask to enable (set up) PHP FILE extension in your site. It will solve the problem. I manage my server, but I have also been in contact with my hosting provider, …
Category: Web

WordPress Customizer Help with FontAwesome Icon

Here's the scenario - I want to select fontawesome icons from the dropdown list but it's not working. For some reason the class inside span is not adding up (I have tried jQuery().append(), CSS) but so far no luck. ANY help would be appreciated. Code in Page.php file <div class="features-block-one"> <div class="icon-one"> <span class="<?php get_theme_mod('features_one_icon' ,'fa fa-bullseye');?>"> </span> </div> </div> Code in Customizer file //block one icon $wp_customize->add_setting( 'features_one_icon', array( 'default' => 'fa-fa box', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_key', …
Category: Web

get_the_terms() returning wrong results inside of loop

When I use get_the_terms() inside a loop, the whole thing behaves very strangely. Sometimes the terms are included twice or three times and sometimes a post inside of the loop returns only false. I have used get_the_terms() over and over for the last few years without any problems. So i'm quite confused right now. It seems like wp_get_post_terms() and wp_get_post_categories() are getting out the correct data but I would like to know why get_the_terms() is behaving this way inside of …
Category: Web

I don't think WordPress is loading jquery or bootstrap js

I'm building a WordPress theme and I've used the code from https://codeinhouse.com/how-to-create-custom-post-type-slider-in-wordpress-without-plugin/ to build my slider I've also used https://github.com/wp-bootstrap/wp-bootstrap-navwalker I have both jquery and bootstrap both linked to the site they appear in inspect element however they do not seem to be running as my drop down navigation does not work on mobile size and the slider doesn't slide function wpbootstrap_enqueue_styles() { wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.css' ); wp_enqueue_style( 'my-style', get_template_directory_uri() . '/css/style.css'); wp_enqueue_script('bootstrap-js', get_template_directory_uri() . '/js/bootstrap.js', array('jquery'), NULL, …
Category: Web

WordPress navigation wont appear with wp_head

so im building a custom theme and ive got stuck on the navigation if i use wp_head(); it loads bootstrap and my custom style sheet but not the navigation if i use get_header(); it loads the navigation but not bootstrap or my custom style sheet here is my functions.php function register_navwalker(){ require_once get_template_directory() . '/inc/class-wp-bootstrap-navwalker.php'; } add_action( 'after_setup_theme', 'register_navwalker' ); function wpbootstrap_enqueue_styles() { wp_enqueue_style( 'bootstrap', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css' ); wp_enqueue_style( 'my-style', get_template_directory_uri() . '/style.css'); wp_enqueue_script('bootstrap-js', 'https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js', array('jquery'), NULL, true); } add_action('wp_enqueue_scripts', 'wpbootstrap_enqueue_styles'); …
Category: Web

Multiple do_shortcode($content) within one shortcode

TLDR; How can I run a shortcode with multiple shortcodes inside of it? I'm trying to run a shortcode with multiple shortcodes inside of it. I can successfully run a shortcode with one shortcode inside of it with the following code in the theme: add_shortcode('outside_shortcode', function($attr, $content = null) { return ' <section class="example_section"> <div class="container"> <div class="row"> ' . do_shortcode($content) . ' </div> </div> </section> '; }); add_shortcode('inside_shortcode', function($atts, $content = null) { $atts = shortcode_atts( array( 'link' => …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.