Everytime i try to add a shortcode into my Wordpress site it ends up merely displaying the code i add to the actual page. I've been pasting the code into the "text" area of the content section but still doesnt work.
Even when I paste inside of the header.php file I recieve the same result. For example.
I recently copy pasted the following code in header.php (as instructed by the plugin i downloaded)
<div class="headerslider"> <?php echo do_shortcode('[sp_responsiveslider limit="-1"]'); ?></div>
When I save a reload, I just get [sp_responsiveslider limit="-1"] appear in my website. This happens with all shortcodes i do.
Please help
It seems like the shortcode sp_responsiveslider isn't actually defined. Are you sure the plugin is installed correctly? If the plugin is installed correctly you can test to see if shortcodes are working on your WordPress installation. Paste the following in your functions.php file (add <?php to the first line if it's not already in the file):
function test_shortcodes()
{
return 'Shortcodes are working!';
}
add_shortcode('test_shortcodes', 'test_shortcodes');
This will create a new shortcode in WordPress. To test if shortcodes are working put the text [test_shortcodes] within a post and view the page with the post. When you load the page the shortcode tag should be replaced with "Shortcodes are working!". If this works, there is an issue with the plugin and it's shortcode.
If the test text is not displayed there might be a problem with your WordPress installation.
Related
I have created a subdomain for my website called "hindi.mysite.com" and I want to add the Hindi text "हिंदी" to the site title with tags. I am using the GeneratePress Premium theme and have tried adding the code to the functions.php and header.php files, but it is not working. I have also tried using a GP hook to add the text, but it is still not working. I have also tried adding css but still not working. I have checked for any errors or typos, but haven't found any. I am looking for a solution on how to properly add the Hindi text to the site title with tags using the GeneratePress theme.
I tried adding the following code in the functions.php file, the header.php file, and as a GP hook:
function add_hindi_text() {
echo '<sup>हिंदी</sup>';
}
add_action( 'generate_site_title', 'add_hindi_text' );
I was expecting the Hindi text "हिंदी" to be added to the site title with tags, but it is not showing up.
I'm making a WordPress theme by myself since I'm working for the first time in Wordpress I've watched some tutorials about it.
I have page.php header and footer and ofc an index. I insert the content from the pages with this:
<?php echo get_post_field('post_content', $post->ID); ?>
but I tried the get_post in a while loop with same result..
Everything is fine but when I want to use a plugin I can't add to my page... When I insert the shortcode of it it shows only the shortcode string... There are some plugins where I can click a "view" option and it would show a page with my plugin (for example a calendar) but that page is empty...
When I activate an original theme it works instantly... So I'm sure something is missing from my theme something which can load the plugins but I couldn't find solution for it.
Any ideas?
Did you add the <?php wp_head(); ?> function before the head area of the html document is closing? It imports important scripts and styles from wordpress itself (and probably also from the plugins).
See here:
https://developer.wordpress.org/reference/functions/wp_head/
Before closing the body area, the template should also include
<?php wp_footer();?>
See here:
https://developer.wordpress.org/reference/functions/wp_footer/
I'm trying to create a custom template for a small wordpress site, the template should display some data from the database.
But I can't get PHP to output anything on the pages, I've written a few echo's just to get something but can't see anything.
I can, however, add the page through "Pages" in WordPress, that works just fine and displays an empty page (or with text if I write something in the text box)
To set up the template I created a child template of my original template, the CSS file in the child template works just fine.
I added the custom page called "petitionlist.php" in the root of my child-theme, the code I added for testing is as following
<?php
/*
Template Name: petitionlist
*/
get_header();
echo "test test test";
$test = "testtetsttest";
echo "<h1> this is a test</h1>".$test; ?>
<h1>Hello wordl!</h1>
<?php get_footer(); ?>
Attached is a screenshot of my folder-structure, the petitionlist.php file in wechange-child is the file I'm working on.
I'm using [insert_php] plugin in Wordpress and I have inserted php function in it.If I set the block with the function before the the masonry grid it doesn't load.
If I move the block with the function after the grid it works well.
In console log is appearing an alert:
Syntax error, unrecognized expression: {'status':'Nothing found'}
How can I sole that?
Grid before php block
Block php before the grid
What you need to do is create a page template. This page template can be used to create PHP for your page to load, and you can even use
<?php echo do_shortcode('[shortcode]'); ?>
To create a template just copy your page.php into a new file called tpl_test.php.
Then make sure to have this in the very first line:
`<?php
/*
Template Name: Test Template
*/
?>`
Then, a small window will show up on the back-end of WordPress when you edit the page. In the right hand column you need to select the page template for the page you just created, and update the page. then, any code you put in the custom Page Template will display correctly on your WordPress site. Also, make sure <?php the_content() ?> is below your grid you are trying to output.
I'm using wordpress with Woocommerce and am trying to call the
<?php echo do_shortcode('[woocommerce_pay]'); ?>
shortcode from within a php page.
Problem is that it gives us this result: [woocommerce_pay] instead of actually "performing" the shortcode and showing us the payment form.
Has anyone encountered this before?
Be sure the shortcode is placed in the "Text" tab of the page editor instead of the "Visual" tab.
If you're calling it through PHP: <?php echo do_shortcode('[shortcode]'); ?>. If you're doing it this way, you can't do this within the "Text" tab of the page unless you've allowed PHP to run from within a page. You need to add the PHP to a template file.
Here is a reference: Wordpress Codex for Shortcodes