How Add Code in Page Index Custom Template?

I want to display a code in a Custom Page (Index-sitemap) created in the theme folder. But when I use the following code it just shows up on the Homepage. if(is_home() && ! is_front_page()) { echo 'code'; } Show in Home and also in index-sitemap if(! is_home() && ! is_front_page()) { echo 'code'; } Not Showing in Home but also not showing in index-sitemap if(is_page(index-sitemap) && ! is_front_page()) { echo 'code'; } not Showing too. if(is_page(index-sitemap) && is_front_page()) { echo …
Category: Web

How to save template data into wp_post table (post_content column)

Is there a way to save template data into wp_post table? I made a custom template that automatically makes tables and some sentences with the meta-data that users insert in. I wanted to make users choose a template and write in a standardized format with custom field. Users can now just put some text on my custom field (bottom of my post edit page) and click the template on the sidebar, then the contents show on the post page! And …
Category: Web

How to get rid of undefined variable in previous post image

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 …
Category: Web

Wordpress Custom Post Type - Post Attribute: Template. Template shows up and saves on the back end, but the default theme file is being rendered

Edit: Now I've found that this is Hybrid Core, and apparently the template hierarchy is different. I still haven't solved my problem below though. In addition to the title. My thinking is that if I am able to select a template in the backend, it should honor that selection. It doesn't change though. I've tested the other template file in place of the default, and it works. This is the function to add my custom post type. This works just …
Category: Web

How do I get the trackback count of a post in wordpress without writing an SQL query?

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?
Category: Web

How to make a custom search template for custom taxonomy?

I have created the custom post type "truck" with custom post type ui plugin. I then created a couple of custom taxonomies "make" and "model". I am using Advanced Custom Fields in the templates to display the output the way I want it. I have everything looking and working the way I want it to.. almost. I am using the plugin search & filter to allow for filtering by custom taxonomy. So where I am getting hung up is when …
Category: Web

Post and page content not displaying in search results

I am using a content-search.php template part to output my search results. The post/page titles and links to those posts/pages are working correctly, but for some reason the the_content() function is not rendering any HTML. I have tested for errors with debugging on, but nothing is displayed. Here is my content-search.php template code: <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <header class="entry-header"> <?php the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?> </header><!-- .entry-header --> <div …
Category: Web

Deeply Nested Menu Loop with Twig using Timber

Using TimberMenu() and I have a menu for mobile that needs to go pretty deep. There must be a better way to write this with twig. Using macros and/or loop.parent or loop.index? It's basically this loop with one nested loop but I need to go all the way down to a great great grandchild. <ul class="menu primary dropdown float-right" aria-hidden="true" data-dropdown-menu data-hover-delay="0" data-closing-time="0"> {% for item in primary_menu.get_items %} <li class="{{ item.class }}"> <a href="{{ item.link }}">{{ item.title }}</a> {% …
Category: Web

How to duplicate a page template but make minor changes to the header?

I will apologize in advance, I am very new to this. I have been teaching myself php as a hobby, but now I need it for work! I don't work as a web designer, but to try and save some money, I need to be able to make minor changes to our website. I can handle most things... But this one issue is throwing me for a loop. The page was designed by a "marketing firm" and the code is …
Category: Web

How to loop specific Category menu from archive page?

I'm trying to loop a specific product category menu from the archive.php page and the category has 4 columns or as a 4th Tree How I can Loop it here in ul ? <ul><!-- 1--> <li><a> First tree</a> <ul><!-- 2--> <li><a>Second Tree</a> <ul><!-- 3--> <li><a>Third Tree</a> <ul><!-- 4--> <li><a>Fourth Tree</a></li> </ul> </li> </ul> </li> </ul> </li> </ul>
Category: Web

How to display custom taxonomy

I have created city taxonomy in back end and i have added mumbai,pune,nashik city in city taxonomy like bellow snipe. My problem is that when i click the city for example mumbai i want display the all product in the mumbai city which i have set from the product tab means that product is in mumbai city category. I have tried with bellow code but not getting any thing. Custom Taxonomies display Template file used to render the Archive Index …
Category: Web

Would like to use hook or filters to customize email templates

I hired a contractor to help me with my site a few years ago when I didn't have the coding experience that I do today. The contractor ended up making new templates for almost every email, and they are all out of date. I started making updates to them when I realized I should just be making the custom changes in the functions.php page so I don't have to go through updating a billion templates each time WooCommerce makes an …
Category: Web

Override Dokan Includes File in Child Theme

I'm trying to override this Dokan plugin file in a child theme: wp-content/plugins/dokan-pro/includes/modules/vendor-verification/templates/verification-new.php I can successfully override files in the normal Dokan templates folder: wp-content/plugins/dokan-pro/templates/path-to-file.php by using wp-content/themes/theme-child/dokan/path-to-file.php However, because the file I wish to override is in the includes folder, I'm having trouble finding the correct file path to override the verification-new.php file. Any ideas? P.S. The reason why I wish to override the file in a child theme rather than simply edit the original is so I can …
Category: Web

How to echo a plugin's function into a template?

I've tried checking for a similar question but couldn't find one. If possible please link me to this as I might be creating a duplicate. Anyways.. I am using a basic testimonial plugin (Clean Testimonials) and wish to create a custom template which it allows. The only things I like to add are the the_client() and the_website() functions. But the the_website() function isn't displaying? <div class="su-posts su-posts-default-loop"> <?php // Posts are found if ( $posts->have_posts() ) { while ( $posts->have_posts() …
Category: Web

How to set a template with wp_insert_post

I'm trying to set my template to the Elementor Canvas when using wp_insert_post but it isn't working. It is creating the new page fine but not using the canvas. What am I doing wrong? { "action": "create_post", "post_author": "<authorID>", "post_content": "<post content>", "post_title": "Leave us a Review", "post_status": "publish", "post_type": "page", "comment_status": "closed", "post_name": "<post-name>", "page_template": "elementor_canvas" }
Category: Web

How do I display two separate taxonomy archives for two post types that share a single taxonomy?

I have a custom content type, "products", which shares the category taxonomy with posts. We're using posts to discuss and review products. The idea is to have two separate URLs: /discussion/category/term/ : Displays a listing of posts belonging to a specific term with a "related products" area pulling from the same term /products/category/term/ : Displays a listing of products belonging to that term with a "related discussions" area pulling from the same term I can use the default category/archive templates …
Category: Web

Overwrite template-tags.php in child theme

I would like to overwrite some content which is located in (inc/) template-tags.php file on parent theme. Content need to be changed is in function footer_content_widget_area in template-tags.php file and that function is called on functions.php: add_action( 'page_widgets', 'footer_content_widget_area' );
Category: Web

Why would adding a template file to a child theme cause an error in template-loader.php?

Per wordpress best practices, I created a child theme for an existing theme I have. Everything works fine until I try to add a template file which follows WP's template hierarchy conventions. For example, if I add category.php or archive.php, I get a white screen of death, and this is the error I get in Apache: [:error] [pid 2919] [client 98.24.106.38:64974] PHP Warning: include(): Failed opening '/home/www-dev/beokinawa/wp-content/themes/x-child/index.php' for inclusion (include_path='.:/usr/share/php') in /home/www-dev/beokinawa/wp- includes/template-loader.php on line 74, referer: http://dev.bluepresley.com/beokinawa/wp-admin/edit-tags.php?taxonomy=category Whenever I …
Category: Web

Polylang and template files

I divided the website i am making in diferent template files for example: Category for blog -> category-blog.php Category for projects -> category-projects.php But now I am using the POLYLANG plug in to make the translations. I've noticed that while i am creating the respective category in other languages the template does not apply for example category-blog.php file does not apply to the category-blog.php in other languages. Is any way that i can use the same category template file to …
Category: Web

About

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