Changing Section Title from H2 to H1 from WordPress Theme - wordpress

As the title states, I am having trouble locating where to change the section titles that are currently h2 to be h1.
Site in reference: http://veloxity.us
Any insight or advice would be much appreciated!

In the "sections.php" page in the "functions/templates" folder on line ~112 and ~219 there is:
<?php echo ($section_post->post_title) ? '<h2>' . apply_filters('the_title', $section_post->post_title) . '</h2><div class="clear"></div>' : ''; ?>
and
<?php echo ($section_post->post_title) ? '<h2>' . apply_filters('the_title', $section_post->post_title) . '</h2><div class="clear"></div>' : ''; ?>
Changing the <h2> to <h1> should achieve what you are wanting.

Related

WordPress | Using imagehover on Featured Images

I'm not a a big pro-Pro, but I do know my way around in basic scripting/adjusting/editing and stuff when it comes to CMS. Right now, I'm using WordPress for my website. I modified a theme and all is running quite well (it's in construction mode).
However, there's one thing I've been trying to accomplish, but I can't get it to work.
WordPress has this feature called Featured Image. It's an image/thumbnail you can include to an article. What I'm trying to do here, is to turn that Featured Image into a imagehover. So when people move their mouse over the (black and white) image, it turns into another (colored) image.
One of the things I've been able to figure out, is using a WordPress pluging called Multiple Post Thumbnails. It lets you add 2 Featured Images (thumbnails) to a single article. In this case: a black and white image and a colored image.
Now here's the thing; there in fact can be found some sort of a tutorial on how to activate this modification, but I can't get it to work. URL: http://www.scratchinginfo.net/hover-two-featured-images-wordpress-via-multiple-post-thumbnails-plugin/
So my two questions:
Is there a better (easier) way to accomplish this imagehover?
As for the tutorial:
I used copy/paste on all code and added it to my own files/theme. All it gave me was a blanc page. I had to remove and adjust some code from the functions.php code (for instance the name of the theme) to get it to work at all (meaning: to be able to show my page at all):
Tutorial:
if (class_exists('MultiPostThumbnails')) {
new MultiPostThumbnails(
array(
'label' => 'Colored Image',
'id' => 'colored-image',
'post_type' => 'post'
)
);
}
Only shows up anything like this:
if (class_exists('MultiPostThumbnails')) {
new MultiPostThumbnails(
array(
'label' => 'Colored Image',
'id' => 'colored-image',
'post_type' => 'post'
)
);
}
Like I said, I can't get it to work. Adjusting this piece of code leaves me off where I started. Black and white images (Featured Image 1) only.
I'm using this Cosmox theme: http://cosmox.ozythemes.com/. I created a page with a couple of images/thumbnails (which are the Featured Images) of partners (faces) under each other. When you scroll over those images, a textbox with information is revealed. It's basically the same as the WHATS NEW section.
Hopefully there's a simple solution to this one ;)
Thanks so much!
#dingo_d:
foreach( $myposts as $post ) : the_post(); $more = 0;
echo '<li>';
echo ' <div class="item-wrapper">';
echo ' <div>';
if ( has_post_thumbnail() ):
$upload_dir = wp_upload_dir();
$custom = get_post_custom(); $custom = get_post_meta($custom["_thumbnail_id"][0]);
$custom = unserialize($custom['_wp_attachment_metadata'][0]); $upload_folder = dirname($custom['file']);
if(isset($custom['sizes']) && !empty($custom['sizes'])) {
echo '<img src="'. $upload_dir['baseurl'] . '/' . $upload_folder . '/' . $custom['sizes']['portfolio-featured-thumb-460']['file'] . '" width="100%"/>';
}else{
echo '<img src="'. $upload_dir['baseurl'] . '/' . $custom["file"] . '" width="100%"/>';
}
else:
//no image image
echo '<img src="' . OZY_BASE_URL . 'images/no-image310x140.png" width="100%"/>';
endif;
echo ' <div class="hover"></div>';
echo ' </div>';
echo ' <span class="cfnt" align="center">';
the_title();
echo ' </span>';
echo ' </div>';
if($xml->description=='1') echo '<div class="desc"><span class="cfnt">' . get_the_title() . '</span><p>' . strip_tags(get_the_content('','')) . '</p></div>';
echo "</li>";
endforeach;
EDIT 2:
echo '<img src="'. $upload_dir['baseurl'] . '/' . $upload_folder . '/' . $custom['sizes']['portfolio-featured-thumb-460']['file'] . '" width="100%" class="nohover" /><img alt="imagehover" src="URL TO HOVER IMAGE" class="hover" />';
From the code above your output should be something like this (in html)
<li>
<div class="item-wrapper">
<div>
<img src=""/>
<div class="hover"></div>
</div>
<span class="cfnt" align="center"></span>
</div>
<div class="desc"><span class="cfnt"></span><p></p></div>
</li>
Under the image there is an empty div with the class hover that you can use in conjuncture with this effect, to make your image first be black, and then be revealed on hover.

Wordpress Post Excerpt Class

I'm customizing a Wordpress Theme and i have stucked in add a custom class to the "the_excerpt()".
I have searched on the web for this function, but nothing is specific to add a custom class.
Hm, i've tried the "get_the_excerpt", but this one doesn't work (returns nothing).
Anyone knows how to do this?
<?php echo get_the_excerpt(); ?>
Shows the excerpt
<p class="your-class"><?php echo get_the_excerpt(); ?></p>
Shows the excerpt in a div with a class
As far as I'm concern wordpress doesnt provide a solution for this however you can try printing the excerpt using this solutions:
Solution 1: printing the class in the page.
<?php echo '<p class="yourclass">' . get_the_excerpt() . '</p>' ?>;
Link of where i found answer 1
Solution 2: override excert function:
You can override the excerpt function in wordpress functions.php using the following code and pasting in the same file:
function my_custom_excerpt( $excerpt ) {
$post_excerpt = '<p class="yourclass">' . $post_excerpt . '</p>';
return $post_excerpt;
}
add_filter( 'the_excerpt', 'my_custom_excerpt', 10, 1 );
Link where i found answer 2
Conclusion: I prefer using the solution #1 because is cleaner and very understable for someone which will maintain the site.
You can add this code to your functions.php to add the class myclass to the excerpt container:
add_action('the_excerpt','add_class_to_excerpt');
function add_class_to_excerpt( $excerpt ){
return '<div class="myclass">'.$excerpt.'</div>';
}
you don't have to put the_excerpt() inside a p tag, this is going to generate a new p tag contains the excerpt , all you have to do is to put the_excerpt() inside a div tag with your class name.
<div class="post-sumary">
<?php the_excerpt() ?>
</div>

How can I access (echo) a pages navigation label in Wordpress?

This is a continuation in a way of this question:
Wordpress Navigation Label in Browser tab
but I am afraid I need more guidance then the previous poster.
I too want to use the navigation label in the WordPress menu, to display the parent navigation label (and not the parent title!) before the page's actual title.
The code that works for the parent title is this:
<h1 class="page-title"><strong><?php
// If child page , also include the parent title:
if($post->post_parent)
{$parent_title = get_the_title($post->post_parent);
echo '<span>'.$parent_title.' — </span><br />';
}
the_title(); ?></strong></h1>
I would like to swap out .$parent_title. for the parent-navigation-label. Is there a way to echo that label?
Disclaimer: I am not a programmer by choice - only when I have to, so please be gentle...
Edit: This is the navigation label I am talking about btw:
The label is stored in the post object as title:
$parent = get_post( $post->post_parent );
echo '<span>' . $parent->title . ' — </span><br />';
(Ok - If there is a way to include formatted code in the comments - please let me know!)
Building on #diggys answer I added this:
<h1 class="page-title"><strong><?php
// Display the parent nav label:
$parent = get_post( $post->post_parent );
echo '<span>' . $parent->title . ' — </span><br />';
the_title(); ?>
</strong></h1>
but the output is empty - apart from the the — character (-). I must be missing something obvious, right?

Change Read More link WordPress

I want to change the Read More link in WordPress, i have found some tutorials where in the <!-- more --> i can write something else <!-- more Proceed... --> (this did not work).
And in the index.php i should edit <?php the_content('Read More..,'); ?>, but in my index.php there is no Read More text, it looks like this <?php the_content(''); ?>, it is empty and it still shows Read More on posts.
Any other ideas how to change it ?
You can change the
<?php the_content(''); ?>
into whatever you want. So you can make it:
<?php the_content('more Proceed... '); ?>
or whatever you want. "Read more..." is default when you leave it open.
add this block of code in function.php file
// Replaces the excerpt "more" text by a link
function new_excerpt_more($more) {
global $post;
return '<a class="moretag" href="'. get_permalink($post->ID) . '"> Read more... </a>';
}
add_filter('excerpt_more', 'new_excerpt_more');

Drupal 6: Printing Unadulterated Primary Links and all children

How in the WORLD is possible? I swear, I've read the equivalent of 3 encyclopedias to no avail. I've tried solutions within regions, page.tpl.php and blocks. None of them give me what I need... and I know there are so many other people that need this too!
I've come to the conclusion that I want to print out the menu within my page.tpl.php ... so no block solutions, please.
I want to be able to loop through the primary menu links (AND children) and rewrite the output so that there's no default Drupal class tagging. The closest I've found is this example:
<?php if (is_array($primary_links)) : ?>
<ul id="sliding-navigation">
<?php foreach ($primary_links as $link): ?>
<li class="sliding-element"><?php
$href = $link['href'] == "<front>" ? base_path() : base_path() . drupal_get_path_alias($link['href']);
print "<a href='" . $href . "'>" . $link['title'] . "</a>";
?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
As you can see, links are being reprinted with a custom UL and LI class ... that's GREAT! However, no children are being printed. How would I extend this code so that all children are a part of the list? NOTE: I don't want the children to only appear on their parent page, they must be present all the time. Otherwise, the drop-down menu I have planned is useless.
I sincerely thank you in advance to lessening my gargantuan headache!
It's hard to affect the output once it's got as far as the page.tpl - you might do better looking for template.php functions.
This is one I used to alter the classes of my primary links:
function primary_links_add_icons() {
$links = menu_primary_links();
$level_tmp = explode('-', key($links));
$level = $level_tmp[0];
$output = "<ul class=\"links-$level\">\n";
if ($links) {
foreach ($links as $link) {
$link = l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment']);
$output .= '<li class="sublevel">' . $link .'</li>';
};
$output .= '</ul>';
}
return $output;
}
And then in page.tpl.php I just called it like this:
<?php if ($primary_links) :?>
<?php print '<div id="menu">'; ?>
<?php print primary_links_add_icons(); ?>
<?php print '</div>'; ?>
<?php endif;?>
I had to add a <span> to my links for styling, so I overrode theme_links() in includes/theme.inc
You can copy the function to your template.php, rename it to yourthemename_links(), and modify it as needed.
This function outputs the ul, li tags, the drupal_attributes, classes of 'first', 'last', 'active', etc, and affects the menus throughout the site.
You may also want to check out the functions in includes/menu.inc, including theme_menu_local_tasks() and menu_local_tasks(), if you need to output the primary and secondary differently.
MarkLNH

Resources