I created a website in WordPress (Website: Link) using this theme.
I would like to know, how can I add a [timeline-express] widget after the image slider?
(I tried to modify idyllic-functions.php, using:
...
</div> <!-- end .main-slider -->';
echo $idyllic_category_sliders_display;
echo add_filter( 'widget_text', 'timeline-express');
...
,but the site crashes.)
Open this file: idyllic/inc/front-page/front-page-features.php and add this following line on line 34:
<?php echo do_shortcode('[timeline-express]'); ?>
Just above this line:
<div class="our-feature-box <?php echo esc_attr($feature_box_class); ?>">
So, your updated code will be also follows:
<?php echo do_shortcode('[timeline-express]'); ?>
<div class="our-feature-box <?php echo esc_attr($feature_box_class); ?>">
Note that, it's always a good practice to create a child theme, copy file/template to the child theme directory, and then modify your codes. Otherwise, you will lose your modified codes once the theme is updated.
PS: please try to follow what #tacoshy mentioned in his comment while asking questions in stackoverflow.
Related
I have question if is it even possible.
I have contact.php home.php and porfolio.php .
In every single site I have exacly same header (include "header.php") and only what I need is change one h1. I mean on every site have different title of h1. Is there any possible way, to change on every site html code differently ?
Like every site have same header.php but every time different h1..
Or should I make like "one half of code.php" .. CHANGEABLE CONTENT .. "second half of code.php.
Or should I do it in javascript ? like onload function and if site is contact.php then change h1.innerHTML on "".. ?
<body>
<?php include "./components/header.php"; ?>
</body>
I'm pretty sure someone on stackoverflow have answered a similar question but you can do something like
<body>
<?php
$h1Content = "put your desired h1 content here";
include "./components/header.php";
?>
</body>
Then in your header.php, do
<h1><?php echo $h1Content ?></h1>
You can also use an isset to check or set a default value
<h1><?php echo isset($h1Content)? $h1Content : 'Default Value' ?></h1>
you can achieve this easily. All you have to do is to assign header value to an variable and then use that variable in your header file.
//header.php file
<h1><?php echo $mainHeader; ?></h1>
and then before you inject the header you have to init that value on each site
<?php $mainHeader = 'Hello world'; ?>
<body>
<?php include "./components/header.php"; ?>
</body>
I'm trying to add a php code inside a custom HTML widget but the site in showing this like plain text.
Any idea why is this happening?
PHP CODE:
<?php
$param = uniqid();
echo "<script language='javascript'>";
echo "alert('message successfully sent ' . $param)";
echo "</script>";
?>
HTML:
HOW I SEE THE PAGE:
Same problem happenned to me today!!, resolved it by adding the following code to the Wordpress theme function.php file.
add_filter('widget_text','execute_php',100);
function execute_php($html){
if(strpos($html,"<"."?php")!==false){
ob_start();
eval("?".">".$html);
$html=ob_get_contents();
ob_end_clean();
}
return $html;
}
To enable shortcodes in the Text and Custom HTML widget just add this code to your theme functions.php :
add_filter('widget_text','do_shortcode',10);
I am trying to add an horizontal ad in between the content. An example article of my website is: http://articlefirm.com/biography/penny-taylor-age-net-worth-biography-twitter.html. I would like the ad to come somewhere inside the content.
The website is on YII framework. Here's the content code:
<?php echo $page->detail; ?>
Please let me know how could I add script inside the above given code.
you can change your main.php layout and add the code for show the ads as you like this way
if you need pass some php vars to the main.php layout
a simple way is add property to your controller
class YourController extends CController {
public $myParam;
then assign in your action the values you need for params
eg:
$this->myParam ='my_adv';
and then in your layout you can simple
<?php echo $this->myParam; ?>
otherwise if you don't need pass params form controller/action
you can simply change you views/layouts/main.php
adding the conde you need
<?php
echo 'here i cand add the adv i need before the view content';
?>
<?php echo $content; ?>
I can not figure this out.
I have a Controller that loads my main.php:
<div id="container"></div>
<script>$('#container').load('index.php?path=wizard&wizard_id=<?php echo $_GET['wizard_id']; ?> #wizard');</script>
"index.php?path=wizard&wizard_id=1" loads: view/module/wizard.php'
view/module/wizard.php looks like this:
<div id="wizard" data-wizard_id="<?php echo $groups_in_set['wizard_id']; ?>" data-total_sets="<?php echo $groups_in_set['total_sets']; ?>">
<div id="set" name="<?php echo $groups_in_set['wand_set']; ?>">
<?php foreach ($groups_in_set['groups'] as $group){ ?>
<!--Step Text -->
<h1><?php echo $group['group']; ?></h1>
<!--Step Detail -->
<div data-group="<?php echo $group['group']; ?>">
<script>alert("group");</script> // No script tags pass to main.php
<?php foreach($group['wands'] as $wand){ ?>
<span id="prompt_elements_<?php echo $wand->wand_id; ?>"></span>
<script>
// Load Wand
// Script not executing on ajax load
loadPromptElements('<?php echo $wand->prompt_type; ?>', <?php echo $wand->wand_id; ?>);
</script>
<?php } // End Wand Loop ?>
</div> <!-- End Group -->
<?php } // End Group Loop ?>
</div> <!-- End Set -->
</div> <!-- End Wizard -->
As you can see from my comments everything loads correctly except the "loadPromptElements" function. The entire script tag does not display in my rendered HTML. I can not figure this one out and need some help. Thanks community!!!
Regarding jQuery .load() handling of scripts:
If .load() is called with a selector expression appended to the URL [like #wizard], however, the scripts are stripped out prior to the DOM being updated, and thus are not executed.
jQuery Reference Page
$('#container').load('index.php?...stuff... #wizard'); // <--- THAT
So you have a couple of options. Either find another way around using the #wizard selector after the URL in your .load() call or you can put it all (that one function) into a separate JS file and load it at the same time with .getScript(). You'll probably have to make it a PHP file so you can utilize the foreach() loop and whatnot.
I had made my theme to be compatible with woocommerce, by creating woocommerce.php, and adding a custom function in my functions.php file which is
add_theme_support( 'woocommerce' );
And this is how my woocommerce.php file looks like :
<?php
global $mandigo_options, $dirs;
get_header();
// heading level for page title (h1, h2, div, ...)
$tag_post_title_single = $mandigo_options['heading_level_post_title_single'];
?>
<td id="content" class="<?php echo ($mandigo_options['sidebar_always_show'] ? 'narrow' : 'wide'); ?>column"<?php if (mandigo_sidebox_conditions($single = true)) { ?> rowspan="2"<?php } ?>>
<div class="woocommerce">
<?php woocommerce_content(); ?>
</div>
</td>
<?php
// if we have at least one sidebar to display
if ($mandigo_options['sidebar_always_show'] && $mandigo_options['sidebar_count']) {
if (mandigo_sidebox_conditions($single = true))
include (TEMPLATEPATH . '/sidebox.php');
include (TEMPLATEPATH . '/sidebar.php');
// if this is a 3-column layout
if ($mandigo_options['layout_width'] == 1024 && $mandigo_options['sidebar_count'] == 2)
include (TEMPLATEPATH . '/sidebar2.php');
}
get_footer();
?>
Everything is appearing fine now, but I can't find the add to cart button and also all the elements that uses javascript or jquery are not loading.
I had tried :
To use wordpress JQuery updater
To put the jquery library reference in the header.php
Deactivating all plugins
I had all the fields of the necessary elements in woocommerce field like the price, but its obvious that this is a JS or JQuery error.
And here is a link to the site is product page :
http://www.doctor-detail.com/product/gift-card-product-2
Any help would be much appreciated!
When I inspected the site and checked the console I found that although I was linking to the latest jquery in the header of my site, it was using the main jquery of the theme.
So, all I needed to do is to remove the theme is Jquery file from the JS folder.
After that woocommerce was working fine.
You should use wp_enqueue_script() in functions.php instead of linking in a header.php, Plese keep in mind JQuery in enqueued by default. If you need to change version, fist you have to deregister the default one.