How to add top bar header in WordPress? - wordpress

I have a website and need to add top bar header for some text, date and time.
Are there any plugins to do this or how I custom my header for this?

I assume you are not using your own custom theme. I would start out by creating a child theme which is the recommended way of modifying an existing premium theme. This will allow you to modify the header.php file so when the parent theme is updated, your changes will not be overwritten.
https://codex.wordpress.org/Child_Themes
After you create your new child theme with the style.css and functions.php files, you'll need to copy over header.php from parent to child. Not sure what the header.php file looks like but if you add in something similar to the code below, it should work:
<ul>
<li>Here is some text</li>
<li>Today is <?php echo date_i18n( "F j, Y, g:i a" ); ?></li>
</ul>

Related

Change the footer in WordPress

How can I edit the footer in WordPress version 5.3.1?
footer.php:
do_action('creativ_musicial_action_before_footer' );
/**
* Hooked - creativ_musician_footer_top_section -10
* Hooked - creativ_musician_footer_section -20
*/
do_action( 'creativ_musician_action_footer' );
/**
* Hooked - creativ_musician_footer_end.
*/
do_action( 'creativ_musician_action_after_footer' );
<p>Test</p>
wp_footer(); ?>
</body>
</html>
I can not change the footer text in the GUI. This is the footer:
Which php file is the right one, and how can I change it?
You need to delete, or comment out, the line calling the function, creativ_musician_action_footer.
/* do_action( 'creativ_musician_action_footer' ); */
Optionally, you can add your own HTML in its place, if you want to add a custom footer of your own.
OR
You can open the functions.php and edit the function creativ_musician_action_footer so it has the text that you want.
However, neither of those are a great solution, because when you update the theme, your changes may be lost.
Instead, you should create a child theme and edit a copy of the footer file from your child's theme folder. By doing this your changes will be resilient through updates. There are plenty of tutorials on child themes, and it's fairly easy to do.
Here is the WordPress codex on child themes.
Essentially, in your child-theme folder, you'll create a new style.css, and a new functions.php, and copy over the orig footer.php file. Your child footer.php will override the version in the orig/parent's theme folder, so you need to copy the orig footer.php to your new child theme folder, then edit this copy to meet your needs. You'll probably also want to copy over the orig theme screenshot, or create a new one.

Make the page title H1 automatically in wordpress

On two of my wordpress sites the page/post title is not automatically assigned the H1 tag.
I'm assume, I need to change the CSS templates for this.
Does anyone know, where to change the theme or CSS, so that the page/post title automatically becomes the H1 tag as well?
Thank you
You should change your php files in the theme folder (\wp-content\themes) to modify an H1 since the css only gives styles to it.
Try it
<?php the_title( '<h1>', '</h1>' ); ?>

WordPress Active Tabs

In my WordPress theme I included the following in the header.php for the menu:
<li>About Us</li>
<li>Contact</li>
However when I include the following code in the about us template:
<?php /* Template Name: About Us */ ?>
<?php $about = "active"; ?>
<?php get_header() ?>
The tab doesn't become "active", though if I include the code snippet $about = "active"; in the header.php file it works. Why is this? Is there an easier way to do this?
This probably has to do with the fact that the get_header() function isn't aware of the $about variable. This has to do with the PHP variable scope.
The way I solved this is by using the Wordpress API to generate a menu. This way, each page will automatically detect if it's the 'active' page and add that class to its relevant menu item.
I'd also suggest you to make your menu dynamic using wp_nav_menu(). However if you do not wish to use wp_nav_menu(), you could also make the menu items active using the page id in header.php

HTML Template to Drupal Theme

I have an HTML template. What are the steps to convert it into a Drupal 6 theme?
Create a copy of a theme you want to modify - usually a blank theme like zen works well. You'll need to rename the files and fix the .info file.
Then you can edit the .tpl.php files. node.tpl.php is the main skeleton one. Start copying content from your html template into that file, replacing dummy content with placeholders (which you can find here.
Make sure caching is off, and you can refresh to see the changes.
If you provide me image if your theme, I could tell you some common plan for that.
Thanks for image.
my advices are
I suggest not realy zen theme implementation, because it suggest just to change css. and you already have html and css that was done not in drupal way.
Install any theme to your sites/all/themes. I will use for example zen theme. So path will be sites/all/themes/zen
Copy files from sites/all/themes/zen/zen sub-theme to sites/all/themes/zen/mytheme
Rename sites/all/themes/zen/mytheme/zen.info to sites/all/themes/zen/mytheme/mytheme.info
Change theme name in mytheme.info
Copy all your css and js files to sites/all/themes/zen/mytheme (better to create subdirs for css and js)
Remove zen default zen css files
stylesheets[all][] = html-elements.css
stylesheets[all][] = tabs.css
stylesheets[all][] = messages.css
stylesheets[all][] = block-editing.css
stylesheets[all][] = wireframes.css
stylesheets[all][] = zen.css
stylesheets[print][] = print.css
Add your css files to mytheme.info. Using this construction
stylesheets[all][] = mycss.css
Add your js files to mytheme.info. Using this construction
scripts[] = myjs.js
More info about theme.info file look here http://drupal.org/node/171205
Look at this image
This is how I think better to split page.
Menu under header looks like primary menu. To theme them add
function mytheme_menu_links ($items, $type = 'free') {
if (!empty($items)) {
foreach ($items as $index => $link) {
$output = l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment']); /* insert your html*/
}
return $output;
}
Right block looks like block. So check block.tpl.php and block theming manual http://drupal.org/node/104319
Content area theming depends of what we are showing as content. Usually it is view or node.
so views = http://drupal.org/node/352970
node = http://drupal.org/node/11816
All other html place into page.tpl.php. But you should do this befor theming blocks, menu or content areas.
http://drupal.org/node/11812
There is no automatic way to convert your HTML to drupal theme. Easiest way to create your own drupal theme is to start with Zen theme then customizing the CSS.
Here's a link to Zen theme
http://drupal.org/project/zen
There's no quick easy solution. I would suggest reading the documentation for theming at Drupal.org. After getting familiar with that information, hit up the Tools, best practices and conventions section specific to theming.
When it comes time to do the conversion from HTML to Drupal, I think you will find Firebug or the development tools of Chrome to be indispensable, inspect element in either tool will be very helpful.
I would recommend to avoid the zen theme (which is great, of course) if you already have your own HTML template. It's 10 minutes job:
Create your theme.info file as per drupal.org/node/171205
Now create you page.tpl.php file. Just rename your HTML template to this name. Put these in your header (replace actual link tags for css, js...):
<?php print $head; ?>
<?php print $styles; ?>
<?php print $scripts; ?>
Now use the variables $menu, $left, $right, $content, etc... where you want to put the appropriate page segments. Do not forget to put this
<?php if ($tabs): print '<div class="tabs">'.$tabs.'</div>'; endif; ?>
<?php if ($help) { ?><div class="help"><?php print $help ?></div><?php } ?>
<?php if ($messages) { ?><div class="messages"><?php print $messages ?></div><?php } ?>
above the content, so you will get the tabs, help and messages as well.
Style it. That's it. You can have a look at this article, however it is in slovak language. But from the code pieces it should be quite clear what is going on, if not, use the Google Translate to get more familiar.
Good luck!

wordpress 3: create navigation menu for a custom post type

Just playing around with Wordpress 3.0 for the first time. I've installed the Custom Post Type UI plugin, and have created a custom post type: "composers".
How do I go about creating a navigation menu for all the composers? Ideally, I'd like a static page entitled 'composers' which has a nav menu of all the individual composers.
In the Appearance -> Menus page, I can create a menu and assign composers individually to it, but what do I need to do to just add the entire collection of composers to a menu, so that it updates when I add a new composer? Surely I don't have to add them all manually?
What you're trying to do might be better achieved as a plugin, or a little editing in your theme file, something along the lines of;
$composers = new WP_Query('post_type=composers');
if ($composers->have_posts():
?>
<ul class="composer-nav">
<?php while ($composers->have_posts()): $composers->the_post(); ?>
<li>
<?php the_title(); ?>
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
I know the idea behind custom menus was to try and avoid the need for plugins or theme editing, but I think it was truly designed for users to be able to pick and choose exactly what they wanted, rather than automatically listing items (just my opinion).

Resources