Site logo

Archived topic

User Elements within a Custom Page

9 replies · Started by Math on June 1, 2021

Viewing posts 1–10 of 10

Hi there,

that page is not using the GP Sidebar template, so Block Elements or Hook Elements won't work there.
I am not sure how you're generating the sidebar - if its within a PHP template then you could add in your own Hook in that position using the do_action function in WordPress

eg.

do_action( 'your_custom_hook_name' );

Then you can hook into that using the Custom Hook option in elements.

Hi David,

It's being generated by WP Download Manager Pro. Please see below for details.


<div class="row">
    <div class="col-md-8">
        [description]
        <div class="wel">
            [tags]
        </div>

    </div>

    <div class="col-md-4">
        <ul class="list-group ml-0 mb-2">
            <li class="list-group-item d-flex justify-content-between align-items-center [hide_empty:create_date]">
                [txt=Published Date]
                <span class="badge">[create_date]</span>
            </li>
            <li class="list-group-item  d-flex justify-content-between align-items-center [hide_empty:update_date]">
                [txt=Last Updated]
                <span class="badge">[update_date]</span>
            </li>
            <li class="list-group-item d-flex justify-content-between align-items-center [hide_empty:file_size]">
                [txt=File Size]
                <span class="badge">[file_size]</span>
            </li>
            <li class="list-group-item d-flex justify-content-between align-items-center [hide_empty:download_count]">
                [txt=Total Downloads]
                <span class="badge">[download_count]</span>
            </li>
        </ul>
        <div class="wpdm-button-area mb-3 p-3 card">
            [download_link]
        </div>
    </div>

</div>

I reached out to them for support but they responded back with "if you are familiar with some coding, you can easily do that"...which doesn't really help me much.

I understand that this isn't a plugin you support. I was hoping to use Elements as a way to work around it.

Is that HTML in the post editor ?

Hmmm... thats a custom editor for that plugin - had a look at their documentation and it doesn't say if it supports PHP in there.

You can try if you want:

After this block of code:

<div class="wpdm-button-area mb-3 p-3 card">
     https://downloads.wordpress.org/theme/generatepress.3.0.3.zip
</div>

Add this:

<?php do_action( 'doodle_after_sidebar' ); ?>

If nothing breaks then you should be able to select a Custom Hook: doodle_after_sidebar in the element. And fingers crossed it displays :)

Yeah the PHP has been commented out - might want to check with the plugin support to see IF/HOW you can add PHP.
Alternatively you can use the method to create a shortcode here:

https://generatepress.com/forums/topic/hook/#post-1038253

The function goes in your child theme functions.php or added via a plugin like Code Snippets.
The shortcode goes in your template which then returns the hook....

Adding to functions.php and creating a shortcode worked!

You are awesome!! Thank you so much!

Glad to hear that!

This archived topic is closed to new replies.