So far I have the following header on my site:
Right now, when you scroll down the page, the sticky header is the LOGO, Phone numnber and the Request service button in red. How could I change this to use the Services menu below to be my sticky header instead?
I checked the code of the Header.php and found the following lines:
// Sticky header
if(isset($theme_options['enable_sticky_header']) && $theme_options['enable_sticky_header']) {
$header_add_class = ' class="'.esc_attr('sticky-header main-header').'"';
} else {
$header_add_class = ' class="'.esc_attr('main-header').'"';
}
?>
<header<?php echo $header_add_class; ?>>
<div class="container<?php echo esc_attr($header_container_add_class); ?>">
<div class="row">
<div class="col-md-12">
<div class="header-left logo">
<?php
// Center logo
if(isset($theme_options['header_logo_position']) && $theme_options['header_logo_position'] == 'center'): ?>
<?php magnium_header_center_show(); ?>
<?php else: ?>
<?php magnium_header_left_show(); ?>
<?php endif;
// Center logo END
?>
</div>
<div class="header-center">
<?php
// Center logo
if(isset($theme_options['header_logo_position']) && $theme_options['header_logo_position'] == 'center'):
?>
<?php magnium_header_left_show(); ?>
<?php else: ?>
<?php magnium_header_center_show(); ?>
<?php
endif;
// Center logo END
?>
</div>
<div class="header-right">
<?php magnium_header_right_show(); ?>
</div>
</div>
</div>
</div>
<?php magnium_menu_below_header_show(); ?>
</header>
I guess this line magnium_menu_below_header_show() is responsible for displaying the menu, but I really do not know where to search it. Although I looked in functions.php, I could not find it.
I know I could use a plugin, but I just do not want to always rely on plugins if I can make it by myself.
Related
Apologies, I am relatively new to PHP and am learning as I go, but am stuck on this... I have this template for a page-title section with a background image. I can add the background image, but if there is no background-img:url elected on the page, is there a way to write in a default background-img:url into this template?
<section class="page-title" <?php if($bg):?>style="background-image:url('<?php echo esc_url($bg);?>');"<?php endif;?>>
<div class="auto-container">
<h1><?php if($title) echo balanceTags($title); else wp_title('');?></h1>
<div class="bread-crumb">
<?php echo convo_get_the_breadcrumb();?>
</div>
</div>
Add this before your code:
if(empty($bg)){
$bg = '/path/to/your/default/image.jpg';
}
<section class="page-title" <?php if($bg):?>style="background-image:url('<?php echo esc_url($bg);?>')" <?php else: ?>
style="background-image:url('your URL')"
<?php endif; ?>>
Using #psdev's code, I was able to add in a default background-image if $bg was empty. Thanks!!
<section class="page-title" <?php if(empty($bg)){$bg = 'http://aqmenalt.mhsites.co.uk/wp-content/uploads/2017/06/Banner-10.png';} if($bg):?>style="background-image:url('<?php echo esc_url($bg);?>');"<?php endif;?>>
<div class="auto-container">
<h1><?php if($title) echo balanceTags($title); else wp_title('');?></h1>
<div class="bread-crumb">
<?php echo convo_get_the_breadcrumb();?>
</div>
</div>
Here is the part of my index.php::
<?php include("header.php");
$containerClass="container"; $rowClass="row";
?>
<div id='wrapper'>
<div class='<?php print $containerClass; ?>' >
<?php
if(($ptype=="" && $fullScreenEnabled!="true") || $ptype=="home" || $ptype=="viewMemberListing" || $ptype=="viewFullListing" || ($ptype=="showOnMap" && $fullScreenEnabled!="true") || $ptype=="adminOptions" || $ptype=="UpdateAdminOptions" || $ptype=="allMembers" || $ptype=="contactus" || $ptype=="page" || $_GET["cpage"]==1){
if($ptype=="viewMemberListing") $reextraMessage=" ".$relanguage_tags["your listings"]." ";
else $reextraMessage=" ".$relanguage_tags["all listings"]." ";
?>
<div class='<?php print $rowClass; ?>'>
<div class='col-md-4 col-lg-4 sbar'>
<div id="sidebar">
<div id="sidebar1">
<div class='a_block'>
<h3><?php print $relanguage_tags["Search"].$reextraMessage; ?></h3>
<?php include("reSearchForm.php"); ?>
</div>
</div> <!-- end #sidebar1 -->
To this I add:
<div id="sidebar1">
<div class='a_block'>
<h3><?php print $relanguage_tags["Add Listing"].$reextraMessage; ?></h3>
<?php include("submitReListing.php"); ?>
</div>
</div> <!-- end #sidebar1 -->
// submitReListing.php is already there on my website and working but i just want this button to be on the home page so that users can search and submit listing from the homepage.
After I added the second part, I go to filezilla and it asks me if i want to upload file back to the server. I select yes. ( Do i need to check "Finish editing and delete local file"??) But i dont see any changes in my website.
Please suggest.
I am new to php so please bear with these questions. I can also provide the entire index file or other file if required. Thanks
Entire code:
<?php include("header.php");
$containerClass="container"; $rowClass="row";
?>
<div id='wrapper'>
<div class='<?php print $containerClass; ?>' >
<?php
if(($ptype=="" && $fullScreenEnabled!="true") || $ptype=="home" || $ptype=="viewMemberListing" || $ptype=="viewFullListing" || ($ptype=="showOnMap" && $fullScreenEnabled!="true") || $ptype=="adminOptions" || $ptype=="UpdateAdminOptions" || $ptype=="allMembers" || $ptype=="contactus" || $ptype=="page" || $_GET["cpage"]==1){
if($ptype=="viewMemberListing") $reextraMessage=" ".$relanguage_tags["your listings"]." ";
else $reextraMessage=" ".$relanguage_tags["all listings"]." ";
?>
<div class='<?php print $rowClass; ?>'>
<div class='col-md-4 col-lg-4 sbar'>
<div id="sidebar">
<div id="sidebar1">
<div class='a_block'>
<h3><?php print $relanguage_tags["Search"].$reextraMessage; ?></h3>
<?php include("reSearchForm.php"); ?>
</div>
</div> <!-- end #sidebar1 -->
<div id="sidebar2">
<div class='a_block'>
<h3><?php print $relanguage_tags["Add listing"].$reextraMessage; ?></h3>
<?php include("submitReListing.php"); ?>
</div>
</div> <!-- end #sidebar1 -->
<?php if(trim($sidebarad)!=""){ ?>
<div id='sidebarad1'><?php print $sidebarad; ?></div>
<?php } ?>
</div> <!-- end #sidebar -->
</div>
<div class='col-md-8 col-lg-8'>
<div id="mainContent">
<div id='reResults'>
<?php if($ptype=="viewFullListing") include("viewFullListing.php"); ?>
<?php if($ptype=="adminOptions" || $ptype=="UpdateAdminOptions") include("adminOptions.php"); ?>
<?php if($ptype=="allMembers") include("allMembers.php"); ?>
<?php if($ptype=="showOnMap" && $fullScreenEnabled!="true") print "<div id='mapResults'></div>" ?>
<?php if($ptype=="contactus") include("contactus.php"); ?>
<?php if($ptype=="page"){ include("page.php"); $fullScreenEnabled="false"; } ?>
<?php if($_GET["cpage"]==1) include("pluginPage.php"); ?>
<?php if($ptype=="categoriesEdit") loadPage("categoriesEdit.php"); ?>
</div>
</div><!-- end #mainContent -->
</div>
</div>
<?php
}
if($fullScreenEnabled=="true"){
?>
<div style="width:100%;">
<div style="width:248px;" id='mapSidebar' >
<div id='showbar' data-original-title="<?php print $relanguage_tags["Show the sidebar"]; ?>"></div>
<div id="sidebar" class='ui-widget-content'>
<div id="sidebarTabs"><div id='hidebar' data-original-title="<?php print $relanguage_tags["Hide the sidebar"]; ?>"></div>
<ul>
<li><?php print __("Search"); ?></li>
<li id='resultTab'><?php print __("Results"); ?> </li>
</ul>
<div id="sidebar1">
<div class='a_block'>
<!-- <div id="logo2"></div> -->
<h3><?php print $relanguage_tags["Search"].$reextraMessage; ?></h3>
<?php include("reSearchForm.php"); ?>
</div>
<?php if(trim($sidebarad)!=""){ ?>
<div id='sidebarad1'><?php print $sidebarad; ?></div>
<?php } ?>
</div> <!-- end #sidebar1 -->
<div id='sidebarResults'></div>
</div>
</div> <!-- end #sidebar -->
</div> <!-- end mapSidebar -->
<div style="width:80%;" id='mapContainer'>
<div id="mainContent"><div id='mapResults'></div><div id='theListing'></div> <div id='MapLoadingImage'><img src='images/maploading1.gif' alt='loading' /> </div>
<div id='modeButton'><a class='btn btn-primary btn-large' href='index.php? ptype=home&<?php print str_replace("ptype=", "",htmlspecialchars($_SERVER['QUERY_STRING'])); ?>'><i class='icon-align- justify'></i> <?php print $relanguage_tags["Switch to text mode"]; ?></a></div>
</div> <!-- end span8 -->
</div>
</div> <!-- end row -->
<div class="nolisting alert alert-info"><a class="close" onclick="$('.alert').hide()" data-dismiss="alert" href="#">x</a>
<h4 style="text-align:'center'"><?php print $relanguage_tags["No listings found for your search criteria"]; ?>.
<?php if($isThisDemo=="yes") print "The demo has limited listings." ?>
</h4></div>
<?php
}
if($ptype=="checklogin") loadPage("checklogin.php");
if($ptype=="submitReListing") loadPage("submitReListing.php");
if($ptype=="addReListing") loadPage("addReListing.php");
if($ptype=="editReListingForm") loadPage("editReListingForm.php");
if($ptype=="updateReListing") loadPage("updateReListing.php");
if($ptype=="myprofile") loadPage("myprofile.php");
if($ptype=="languagetags" || $ptype=="updateLanguageTags") loadPage("languagetags.php");
if($ptype=="categories" || $ptype=="updateCategories") loadPage("categories.php");
if($ptype=="pricerange" || $ptype=="updatePriceRange") loadPage("pricerange.php");
if($ptype=="countries" || $ptype=="updateCountries") loadPage("countries.php");
if($ptype=="towns" || $ptype=="updateTowns") loadPage("towns.php");
if($ptype=="addeditpage") loadPage("addeditpage.php");
if($ptype=="oodle" || $ptype=="updateOodle") loadPage("plugins/oodle/options.php");
?>
<!--
<div id="a_c" style="display:none;"><?php print $authorization_code; ?></div>
<div id="p_c" style="display:none;"><?php print md5($purchase_code); ?> </div>
-->
</div>
</div>
<?php
//if($fullScreenEnabled!="true")
include("footer.php"); ?>
Please Check whether it is going into the IF statement.
Ok, so you need to test this out methodically. First you need to check if ANY changes you type are getting uploaded into the server and getting reflected on the website.
So edit your file again, type die("Updated code"); as the first line of your index.php and save the file. In the dialogue box that comes up (the one of which you have the screen shot), Just click yes.
Now hard-refresh the page and see if the text "Updated code" shows up. If yes, then we can move to second step. If no, then you got either a permission or a cache issue. To resolve it might take more expertise than you have. You could check if correct file permissions are available (though I doubt that is the reason, since you will get warnings if thats the case). In any case, right click the file - select File Permissions and make sure the write checkbox is checked (If you are unsure of your user then just check it for all three - user, group and public. Not very safe, but I do not think you are building the worlds most secure site at the moment in any case)
Next is to check if there is a cache issue. You can try opening the same URL is a different browser or you can try deleting all your cache and trying again.I do not think this might be a problem either (unless you have a caching layer like varnish or memcache and it is set up in a really really bad way)
This next thing is very important:
The more apparent reason seems to be that your code could possibly be wrong. You are thinking that the software is problematic that is why you are not seeing changes that you should. It is a common mistake that people think that there can be no problems with their code, but with everything else in the world. So I would advice you to start line by line debugging until you hit one line where what is printed is not what was expected. And begin from there.
My page http://www.allyourpods.no/ has some odd "holes" that I cant for the life of me figure out.
I would love some help to figure out how to make it automagickly fill the site in a proper fashion.
My template-file for the start-screen looks like this:
<?php
/*
Template Name: Home Template
*/
get_header(); ?>
<?php query_posts('cat='.recPodcastCategory.'&showposts=30');?>
<?php $categories = get_categories('child_of='.recPodcastCategory); ?>
<?php if($categories): $count=0;?>
<div class="recommended">
<div class="wrapper">
<div class="main_recommended_main_block">
<?php foreach($categories as $category) { if($count<30) { $count++;
if($count!=30) $class='recommend_block'; else $class='recommend_block_1'; ?>
<?php if (function_exists('get_terms_meta'))
{
$cat_image = get_terms_meta($category->term_id, 'image',true);
$add_play_podcast = get_terms_meta($category->term_id, 'play_download',true);
}?>
<div class="<?php echo $class;?>">
<div class="main">
<?php $play_podcast = get_post_meta($post->ID,'play_podcast',true);?>
<div class="view view-fifth"><?php if($cat_image):?><img src="<?php echo $cat_image;?>" alt="category image" /><?php endif;?>
<?php if($add_play_podcast):?>
<div class="mask">Play</div>
<?php endif; ?>
</div>
</div>
<?php echo substr( category_description( $category->term_id ),0,100 ) . "..."; ?>
</div>
<?php } } ?>
</div>
</div>
</div>
<?php endif; ?>
<?php if(!isset($_GET['pod_category']))$class_all = ' class="active"'; ?>
<div class="clr"></div>
<?php get_footer(); ?>
If any more information is needed please let me know.
You should add this css:
.recommend_block:nth-child(4) {
clear: left;
}
The problem is one of the first two is a little lower than the others, so it is blocking the float.
Edit: that should be
.recommend_block:nth-child(4n)
Basically, I need for the image at the bottom of the page with no text wrapped around it to be in the place of test post 4 (it's going to be a Google Adsense block but I am using images as a placeholder for now). I'm not sure how to do this, right now the code is the following:
<div class="google_ad_post">
<?php if ($count == 3) { ?>
<br /><img src="****" alt="post ad">
<?php } ?>
<?php $count++; ?>
</div>
Yet, the image is still at the bottom of the page. How can I fix this?
Here is the image:
I can't post pictures just yet so the URL to the image is http://i.imgur.com/7rw5B.jpg
I have to see your code to help you better with the Scripting Part, but something logical like this should work:
<?php
$count = 0;
foreach( $posts as $post ) : ?>
<?php if ($count == 3) { ?>
<div class="google_ad_post">
<img src="****" alt="post ad">
</div>
<?php } else { ?>
<div class="post" id="post-<?php the_ID(); ?>><div class="content"><?php the_content(); ?></div>
<?php } ?>
<?php $count++; ?>
<?php endforeach; ?>
I have a parent page that acts as menu for my portfolio.
It pulls in thumbnail images from the child pages which i have been able to accomplish with magic fields and some code. It dumps the images into a grid layout. The thumbnails are pulled into one container div like so:
div id="folio-content">
<div class="thumb-container">
<div class="thumb"><img src="/images/pic.jpg"/>
</div>JCPenny</div>
... </div>`
when the div gets filled up with 2 thumbnails I want to create a new container div and fill it with 2 images again and so on after 2 images.
So, if you had 4 images it would look like this.
<div id="folio-content"><!--/Main Container/-->
<div class="thumb-container">
<div class="thumb"><img src="/images/pic1.jpg"/>
</div>JCPenny</div>
<div class="thumb-container">
<div class="thumb"><img src="/images/pic1.jpg"/>
</div>Champ Car</div></div>
<div id="folio-content"><!--/Main Container/-->
<div class="thumb-container">
<div class="thumb"><img src="/images/pic1.jpg"/>
</div>JCPenny</div>
<div class="thumb-container">
<div class="thumb"><img src="/images/pic1.jpg"/>
</div>Champ Car</div></div>
this is the code I am using in my page.php file.
<?php get_header(); ?>
<div id="folio-content">
<?php
$projectpage = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=desc');
$count = 0;
foreach($projectpage as $page)
{
$content = $page->post_content;
if(!$content)
continue;
if ($count == 10) --- this is geting 10 images now, but I want to get them all.
break;
$count++;
$content = apply_filters('the_content', $content);
?>
<div class="thumb-container">
<div class="thumb"><a href="<?php echo get_permalink($page->ID); ?>"<?php echo get_image ("thumbnail",1,1,1,$page->ID);?></a>
</div><?php echo $page->post_title ?>
</div>
<?php
}
?>
</div><!--/close set!-->
</div>
also, how can I get ALL child pages? I have it set to 10 now with this if ($count == 10)
any help? thanks a ton again!!!!
I'm not familiar with "get_pages" but since Wordpress treats posts and pages in an identical manner you could use this.
$projectpage = get_posts('numberposts=-1&post_type=page&child_of='.$post->ID.'&sort_column=post_date&sort_order=desc');
The -1 removes the limit and gets ALL the specified pages.
I have cobbled together some code, that sort of sounds right but does not work at all! Which I am not surprised. But it is a starting point - please take a look at this code, maybe it is step in the right direction?
<?php
$projectpage = get_posts('numberposts=-1&post_type=page&child_of='.$post->ID.'&sort_column=post_date&sort_order=desc');
if (have_posts()) :
$i=0; // counter
while(get_posts()) : the_post();
if($i%2==0) { // if counter is multiple of 3, put an opening div ?>
<!-- <?php echo ($i+1).'-'; echo ($i+2); ?> -->
<div>
<?php } ?>
<div class="single_item">
<h2><?php the_title(); ?></h2>
</div>
<?php $i++;
if($i%2==0) { // if counter is multiple of 3, put an closing div ?>
</div>
<?php } ?>
<?php endwhile; ?>
<?php
if($i%2!=0) { // put closing div here if loop is not exactly a multiple of 3 ?>
</div>
<?php } ?>
<?php endif; ?>