How do I add a div between the header area and content area of a thesis theme. What is the code I need to write in custom_functions.php file to do this? If that's not the place, where do I need to make changes to get this done?
In your custom_functions.php file add the following code:
function my_div()
{
echo '<div>Some new DIV between the header and content</div>';
}
add_action('thesis_hook_after_header', 'my_div');
You my want to reference Thesis Hooks and the DIYThemes site for more specific Thesis help.
You'll need to edit the theme files. Probably the header.php and the one where the one which contains the body. Before you fire off questions like this, please read through http://codex.wordpress.org/Theme_Development.
One really easy way, is to use Thesis Openhooks. Select the one that's between the header and the content area. I use that method all the time, especially for images. Inside the hook, all you have to do is type the HTML code for the DIV (I tried to type it here, but the code disappeared after I posted the comment) and then I can add CSS code to it in custom.css. Hope this helps :)
Related
Wordpress | Advanced Custom Fields plugin
I created a new field in the editor where my colleagues can fill in a URL relevant to that specific page. This URL will be used in the button we load on every single job listing page. This button is created within the functions.php file:
function my_editor_content( $content ) {
$content = "<h3>Title</h3><p>text</P>
<a href='[acf field='afas_url']' target='_blank' rel='noopener'><button>Solliciteer Nu</button></a>";
The above is cut off at the 'afas_url' part. So, I think it has something to do with the quotations marks and probably not even hard to fix, but as I'm just starting to figure things out I couldn't find the answer myself yet.
I hope it's a clear enough explanation :)
(And maybe it's not best practice to use functions.php but it was already like this)
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/
so we are making a wordpress site that automatically adds a link to a comment every time a comment is created. The theme we are using is html5 blank. I have written several lines of code into its function.php. however it is not working right now, here is what i wrote:
function bo_wrap_comment_text($content) {
$content = get_comment_text();
$texta = urlencode(get_comment_text());
$textb = "http://www.google.com/search?btnI&q=" + $texta;
return ''.$content.'';
}
add_filter('wp_insert_comment','bo_wrap_comment_text',1000);
a separate code(this one works) is tested here: http://phpfiddle.org and the code is:
<?php
$texta='i hate apple';
$textb=urlencode($texta);
$textc= "http://www.google.com/search?btnI&q=".$textb;
echo ''.$texta.'';
?>
the wordpress site is here. It is simply a static front page. the title you see there is the title of comment area. everything related with blog posts has been hidden using css. we have manually added links to several comments as prototyping. what we want is replace manual work with wordpress functions. I would really appreciate any help.
You need this hook instead to edit comment data:
http://codex.wordpress.org/Plugin_API/Filter_Reference/preprocess_comment
I need to hide the comments to non members in wordpress.
I don't know the function to I have to implement in the template. Maybe you can help me with this?
To be clear, the only thing I want to do is that only members can view comments posted.
Thanks.
If you are a litlle bit familiar with PHP you can have these blocks of code to block the comments displays for non logged users. Open the comments.php file or whatever file assumes that role.
You can add this line of code at the top of that PHP file:
<?php if (is_user_logged_in()): ?>
Then add the line below at the very end of the file.
<?php endif; ?>
I just spent two hours trying to do this, only to find an incredibly simple option that didn't need php. I'm using Live Composer, and my theme doesn't have a comments.php (and trying to create one didn't work - the site just ignored it). Here's what I did:
1) add a custom class to my comments element of .commentlist
2) add this to my style.css:
.commentlist {
display:none;
}
.logged-in .commentlist {
display:inline;
}
I'm trying to figure out how to hide the title of my nodes in drupal... I don't wanna use another module, I just want to change something in the node.tpl.php...
My attempt was to ask if the title is "" and if not, it should just post the title... I've did it like this:
Damn won't work to show the code here, got it in jsfiddle now: jsfiddle.net/8d6FR/
But it doesn't work. Has someone some suggestions why it won't work?
You code looks almost right, I've changed it slightly just to make it easier to understand:
<?php if($title!="<none>"){ print render($title_prefix); ?>
<h2<?php print $title_attributes; ?>><?php print $title; ?></h2>
<?php print render($title_suffix);} ?>
If that is not working then add the code:
var_dump($title!="<none>")
That will let you know how PHP is evaluating your if statement and will allow you to do some further debugging.
PHP in a JSFiddle, that is not gonna work :)...To hide your node titles you'll have to modify your tpl file indeed, or create one if it you need it for a certain content type or node, or manage the display of your nodes within Drupal admin. You may need Title to replace title field with a regular field in order to hide it with the "Manage display" interface or Display Suite.
Find your node.tpl.php or page.tpl.php (depends on your theme) using Theme Developper, and find something like print $title.