I am having an issue with setcookie. I need to set a cookie on a page action (form). I have tried on the template file, but not working. then find out if I set it from functions.php with init hook, it's working. then I put condition like if(is_page_template('mytemplate.php')){... then it's not working. how can I do that? here is my code. add_action( 'init', 'hello_my_cookie' ); function hello_my_cookie() { if(is_page_template('mytemplate.php')){ if(isset($_POST['GGmyCookie'])){ setcookie( 'myCookie','Hello Cookie!', time()+3600); } } }
<?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
The closing P tag is stripped out of my blog posts whenever I use this code in my Functions.php file to insert an after a number of paragraphs. It leaves the unclosed. What could be wrong? // Article Ads After X Paragraphs ///////////////////////////////////// $mvp_post_inad = get_option('mvp_post_inad'); if (!empty($mvp_post_inad)) { function mvp_post_ad_insert( $text ) { if ( is_single() ) { $mvp_post_inad = get_option('mvp_post_inad'); if ($mvp_post_inad) { $ads_text = '<div class="mvp-post-ad-wrap"><span class="mvp-ad-label">' . esc_html__( 'Advertisement', 'zox-news' ) . '</span><div class="mvp-post-ad">'.do_shortcode(html_entity_decode($mvp_post_inad)).'</div></div>'; } $split_by …
When I add functions.php file to my WordPress website, my website just stops working. It doesn't matter if I have or have not code there, whenever the functions.php file is present, the site stops working. I tried to check if there is any typo or parser error, but I can't find nothing nor the debugger doesn't report anything. This happens also when I follow tutorial in a book.
I want to use HTML5 in my WordPress theme, how do I turn off wptexturize? I don't mind WP adding breaks, but I want them to be <br> and not <br />. How do I get control over how those breaks show up in my code? EDIT: I only really care about the <br> tag issue, I don't mind the typographic changes it makes. EDIT2: Actually, I guess <img> tags matter too. Any self-closing standalone tags will matter here. So, …
We generally keep our custom theme in non-auto-update mode and one core WP theme in auto-update mode as an emergency backup as our only 2 themes in the wp-content/themes directory. If we had twentytwenty installed when we launched the site in 2020, that's sufficient for our purposes - we don't need twentytwentyone and twentytwentytwo, etc. It's annoying to have to delete these manually after WP updates add them. Is there any way to block that from happening?
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, …
I am working on a website on WordPress and I have it set to where the bottom of the post will automatically link to a random previous post with a picture from that previous link but a notice keeps popping up on the bottom. It says there is something wrong with the previous post image url but the website sets this automatically and it works for all my other posts. Since it is undefined should I try to define it …
Is there a built-in Wordpress function that will allow you to enqueue all stylesheets for a particular theme? I have a directory structure that looks like: -my-custom-theme -css -header.css -footer.css -functions.php I want to load all CSS files found in the my-custom-theme/css folder
So I want to apply a theme and style the lost password page without the use of a plugin. I don't want it to show the default Wordpress lost password page. I managed to style the login form by redirecting the URL to the styled version, but I'm lost as to how I can style the lost password page. Any ideas? Thanks!
kind of a rookie question but here goes: I'm working on a Wordpress theme from scratch on my local machine, and I'm setting up a static page for the Blog. I have my archive.php file for all the posts and then a single.php for individual posts. However, when I put these files in my root folder (themes -> theme name), along with index.php, the file always seems to default to index.php. In addition to that, I was trying to use …
I am using Themify to construct my website. I have a parallax site partially constructed, however when I scroll down my logo and header changes size. It is a sticky header and goes from being transparent to a color. Where can I find the options to change this in the themify builder? I just want to keep the size consistent as I scroll down. Here is the site: http://willwiseman.us
How do I get the trackback count of a post in wordpress without writing an SQL query? I tried searching Brave Search and I couldn't find anything helpful. To fetch the amount of comments a post has, get_comments_number() is the wordpress protocol function for it. But what if I want to fetch the amount of trackbacks a post has? And also, do I have to be inside "the loop" to do this? What if I'm outside the loop?
I use a theme which has a public static function to display a part of a page like: trait SomeTrait { public static function some_function() { ?> <div class="some_class">Some content</div> <? } } and the helper file looks like: class Helper { use SomeTrait; // ... } I need to override the function in my plugin. In the plugin I try the code: /* Plugin Name: MyPlugin Description: - Version: 1.0 Author: - */ if ( ! defined( 'ABSPATH' ) …
I'm using storefront theme for my shop, and here's the header I wanna put both the logo and search bar in in inside the primary navigation as I explain in screenshot.
I've been trying to change the code of my WordPress site. Rather than showing "trending posts" which is determined by post_views_count, I simply want to show posts from a certain category. The code, as it stands is: if ( !function_exists( 'getCrunchifyPostViews' ) ) { function getCrunchifyPostViews($postID){ $count_key = 'post_views_count'; $count = get_post_meta($postID, $count_key, true); if($count==''){ delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, '0'); return "0 View"; } return $count.' Views'; } } if ( !function_exists( 'setCrunchifyPostViews' ) ) { function setCrunchifyPostViews($postID) { $count_key …
I can't add new plugins or themes on a wordpress multisite network from the primary site as super administrator. It shows this error: ERR_TOO_MANY_REDIRECTS. However, I am able to access all pages, login to each site's dashboard or even make changes to existing codes for installed plugins or themes. I am not able to install any new ones and the network is stuck in a loop. However, the problem can be avoided if I turn off the multisite option using …
Short version: before updating to WP 4.5 and on a day when the only known change was adding a page to a submenu via the navigation menu admin all of the menu links of type Custom Link where we specify a URL suddenly lost their href attributes. Links of type Page still have theirs. After much experimentation I confirmed that deactivating all plugins did not change this but setting TwentyFifteen as theme corrected it. Theme authors are no longer available …
I’m setting up a woocommerce shop for my wife. In this shop, the brands mean a lot to us so we’ve added descriptions for each brand. A nice little story with an image and everything. Now when I click the brand-attribute from a single product page, I go to http://www.webshop.com/brand/brand-attribute which show the description above some products. Is there a way to make this work with filters as well? So I’m in the shop and when I filter on brand …