Forum Replies Created

  • In reply to: Add a custom action-hook in a child-theme?


    oooops πŸ˜€

    I didn’t notice that one … was it added recently as a “hook”? *smash a can on my head*

    I will give it a try, though my first tries ended in having duplicate content in that area if I have a widget placed in that action hook o.O

    Of course I’ll give a feedback on that later after I tested it further.

    However … I keep looking for adding an own hook as I might need it in another place. I found a very very general description about how to add widget areas but I don’t yet know if it will bring me ahead.

    In reply to: Add a custom action-hook in a child-theme?

    Even if you add your own widget area, you will still need to use a PHP Widget to add PHP code to it.

    Yes – that’s exactly what I want! πŸ˜‰

    But how to insert my own widget area resp. action hook?


    OT @Sanuja:

    You mean the standard author page from wordpress that would lead to the trail /author/[mysuername]/ ?

    I did that making the following function inside my function.php (child-theme!):

    function hch_change_author_link( $link, $author_id, $author ) {
    if ( '[myusername]' == $author )
    return 'http://www.hollbeck.net/autor/?rel=author';
    return $link;
    add_filter( 'author_link', 'hch_change_author_link', 10, 3 );

    rename the function as what you like and replace [myusername] with your wordpress-username. The “?rel=author” was added to my URL for google πŸ˜‰

    I also found that somewhere in a forum… could not find the link to it now.

    In reply to: Add a custom action-hook in a child-theme?


    My initial question was actually pretty general: whether I can put an own action hook just anywhere in a child template. If it is a custom loop-single.php or a loop-custom-post-type.php does not matter – nor what code (html or php) will be put into the php-widget that I could place in that new action-hook widget area. I should be able to put php, html or javascripts there as I can do with any other action hook when I use a php-widget.

    The closest built-in graphene action hook to there where the “adsense code” (using the built-in adsense option) would go is the action hook called “graphene_before_comment_template” – though it is, if you look into the code of loop-single.php, not really close there and after the code inserted by the adsense-option. The closest hook just before that is called “graphene_post_footer” – which is, by the way, still in the main content’s div’s. So, there is, for example, no action hook before/after the post’s author info box (but after the main content div-tags) where I would need them.

    I am restyling a custom post type while all the rest of the project’s page use the graphene theme pretty unspectacular. One of the things I am going to try to realize is to display other posts (defined in custom fields of the custom post type’s post) like sub-pages are shown on pages in the graphene theme. If I want to achieve that through php-widgets and want to decide later where exactly (before/after author-info box and adsense-“box”) those things will appear, I would need one or two more action hooks that are not there currently. So that’s why I’m actually asking how I could register my own hooks in a graphene-child-theme.

    In reply to: Add a custom action-hook in a child-theme?


    Yes, I know there is that adsense option … but as it is filtered through some wordpress function I cannot add any code there I want, especially not any PHP-Code or (what I tried last) a PayPal-Donate button which actually uses basic HTML Form-Tags as <form> and <input type="hidden"> and an image that will pass the necessary parameters from the form-tags to PayPal. So, this is not quite true – as I already found out earlier in a different situation: https://forum.graphene-theme.com/graphene-support/adsense-options-possible-to-use-php-code-or-widget-shortcodes

    I tried to find a solution myself and tracked down in the theme files where this “filter” for the adsense-option was set. I think it’s the function wp_kses_post() which is called in the theme file located in admin/options-validator.php on line 203. I would not know how to change that or even how to override that in a function within my child-theme’s function.php (if possible at all?). Probably there was some reason to filter the adsense-code in that way – though I don’t yet understand it.

    Back to the hooks: the function that will “scan” for the action hooks is defined in the includes/theme-functions.php, line 76 and following. Though I don’t wanna touch any theme files like with the adsense option above. If it would be possible to add the child-theme directory to that function it might be possible to add action hooks myself in child-themes?

    Maybe I keep digging too much into the core theme files and don’t understand PHP and the theme code enough … ?

    In reply to: Insert a floating widget within a blog post content


    Update: I now put my php-code it into the template file I created in my child theme for my custom post type “ebook” (loop-ebook.php) just before

    <?php /* The full content */ ?>
    <?php the_content(); ?>

    I copied loop-single.php as basement for my loop-ebook.php. I just don’t know if that is a clever solution – I probably will have to create this file new when I update to the next version of the graphene-theme? So, I guess doing this through the action-hook would be more clever – but I couldn’t find a way around the clearfix class which is obviously added to all widgets πŸ™

    In reply to: Insert a floating widget within a blog post content


    The widget code gets surrounded by these tags… where I think the class “clearfix” is my problem. Any way to remove or override it?

    <div id="execphp-6" class="sidebar-wrap clearfix widget_execphp">
    <div class="execphpwidget">



    In reply to: Insert a floating widget within a blog post content

    What is it you are trying to insert? If it’s an image, why not just insert it into the content of your post?

    Because it will be a multi-user “blog” where the authors should’nt be much concerned about the styling of their posts and to make sure all the posts from the different authors look similar. Most post authors won’t know anything about HTML or how to style the image to display in the correct position. It’s like making a form they can just fill out and the styling will be done through the theme and the custom fields inserted to the custom post type (child theme template for the post type).

    It will be a different image each post (to be more precise: it will be a book-cover corresponding to the post that will announce it). The content of the PHP-widget itself (unstyled) looks like:

    $attachment_id = get_field('cover');
    $size = "medium"; // (thumbnail, medium, large, full or custom size)

    $image = wp_get_attachment_image_src( $attachment_id, $size );
    <img src="<?php echo $image[0]; ?>" />

    I currently work on customizing the above code that the output will be something like:

    <div style="width: 224px" class="wp-caption alignright" id="attachment_46"><a rel="attachment wp-att-46" href="http://www.sample.com/2012/07/testroman/test-buchcover/"><img width="214" height="300" alt="Alternativtext" src="http://www.sample.com/wp-content/uploads/2012/07/Test-Buchcover-214x300.png" title="Test-Buchcover" class="size-medium wp-image-46"></a><p class="wp-caption-text">Beschriftung</p></div>

    which would be the html-output if I just inserted the image within the content of my post. So, the PHP-Part (inserting the ID’s and things alike) is not the problem – I will manage that. But I wanted to have the widget “floating” – as if I inserted the image within the post content.

    In reply to: Header not correct when updating to 1.7.1


    I fixed it temporarily for me using the following “custom css” (just copied from the original style.css, changing the color to white).

    .header_title a,
    .header_title a:visited,
    .header_title a:hover {
    text-decoration: none;
    color: #fff;

    Now it looks again as it should.

    In reply to: Header not correct when updating to 1.7.1


    I answer now here instead of the other thread, as it obviously isn’t connected to H1/H2 tags.

    Unfortunately for me clearing the browser’s cache does *not* work (I tried that before too and also reviewed the site using other browsers and a mobile device). I still have the text “TrÀumen war gestern!” in black unless I move the mouse over it.


    In reply to: Deleting default H1 homepage


    Since I updated to version 1.7.1 I now get H2-Tags for the Main-Site title on every page/article except the front page “Home”, which is extremely uncool!

    I have made the settings to have a white site-title, as I am using mostly dark header images. On “Home” everything is okay, but if you navigate anywhere else, you won’t see the Site-Title anymore (H2, #000) on a dark background.

    Please change that back!

Viewing 10 posts - 1 through 10 (of 20 total)

  • 1
  • 2
Do NOT follow this link or you will be banned from the site!