Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • #815594

    Hello,

    I would like to have a Newsletter subscription box displayed at the end of every article of my blog http://www.th-photography.net.
    I use the plugin Email Subscribers and the plugin has the following code for such a box:
    <?php es_subbox($namefield = “YES”, $desc = “”, $group = “Public”); ?>

    Where do i have to add this code, that it is displayed automatically under every article (but not for pages)?
    If possible i would like to have it at the position after “You may also be interested in” and before the comments of the article.

    Thanks a lot!
    Torsten

    #815699

    Hey th-photography,

    If you want a quick, easy and reliable solution take a look at https://wp-buddy.com/products/plugins/content-posts-wordpress-plugin/

    If you want a native solution you can use e.g. the enfold action hook ‘ava_before_footer’ in a child theme.

    Best regards,
    Jordan Shannon

    #816471

    Hello,

    thanks for your reply.

    How can i do the native version?
    I have the following codes:

    <?php es_subbox($namefield = “YES”, $desc = “Du willst künftig keinen Artikel mehr auf T.H. Photography verpassen? Dann trag dich gleich für die E-Mail Beitragsbenachrichtigung ein!”, $group = “Public”); ?>

    or:

    [email-subscribers namefield=”NO” desc=”Du willst künftig keinen Artikel mehr auf T.H. Photography verpassen? Dann trag dich gleich für die E-Mail Beitragsbenachrichtigung ein!” group=”Public”]

    Thanks,
    Torsten

    #816474

    Hi,

    Try the adding the following to the bottom of functions.php:

    
    add_action('ava_before_footer', 'ava_before_footer_mod', 10);
    function ava_before_footer_mod() {
    echo do_shortcode("[email-subscribers namefield=”NO” desc=”Du willst künftig keinen Artikel mehr auf T.H. Photography verpassen? Dann trag dich gleich für die E-Mail Beitragsbenachrichtigung ein!” group=”Public”]");
    }

    If this generates correctly then we can work on hiding it where its not needed.

    Best regards,
    Jordan Shannon

    #816500

    Hello,

    thanks for your reply.

    It did not work fully correct. Only the first word of the sentence is visible….

    See here: https://www.th-photography.net/wp-content/uploads/2017/07/newsletter.jpeg

    #816503

    Hi,

    Replace with this. I think the quotes were the issue:

    add_action('ava_before_footer', 'ava_before_footer_mod', 10);
    function ava_before_footer_mod() {
      echo do_shortcode("[email-subscribers namefield="NO" desc="Du willst künftig keinen Artikel mehr auf T.H. Photography verpassen? Dann trag dich gleich für die E-Mail Beitragsbenachrichtigung ein!" group="Public"]");
    }

    Best regards,
    Jordan Shannon

    #816507

    No sorry, with that i only get the famous “white page”. So there must be an error.

    #816511

    Hi,

    This should fix it. I have tested it on my own machine:

    add_action('ava_before_footer', 'ava_before_footer_mod', 10);
    function ava_before_footer_mod() {
      echo do_shortcode("[email-subscribers namefield=”NO” desc=\"Du willst künftig keinen Artikel mehr auf T.H. Photography verpassen? Dann trag dich gleich für die E-Mail Beitragsbenachrichtigung ein!\" group=”Public”]");
    }

    Best regards,
    Jordan Shannon

    #816519

    Ok the text is there.
    But the box spans over the hole width of the blog (main page and sidebar) and not on the main page only.
    See here: https://www.th-photography.net/wp-content/uploads/2017/07/newsletter2.jpeg

    Is it also possible, to have a header over the displayed text line and a small frame around the whole added content?
    Header: E-Mail Benachrichtigung

    Thanks

    #816522

    Hi,

    So this just needs to be on the homepage?

    Best regards,
    Jordan Shannon

    #816524

    Hello,

    no i only whant to have it the articles. Also not on pages, only in the blog posts.

    #816530

    Hi,

    I see. So then remove the code from functions.php and place in single.php directly after:

    <!--end content-->
    </main>

    The code will now have to be wrapped in php tags like this:

    <?php
    add_action('ava_before_footer', 'ava_before_footer_mod', 10);
    function ava_before_footer_mod() {
      echo do_shortcode("[email-subscribers namefield=”NO” desc=\"Du willst künftig keinen Artikel mehr auf T.H. Photography verpassen? Dann trag dich gleich für die E-Mail Beitragsbenachrichtigung ein!\" group=”Public”]");
    }
    ?>

    To style this thing up a bit more add this to quick css:

    .es_shortcode_form{
        width: 900px;
        margin: 10px 180px;
        border: 1px solid black;
        padding: 20px;
    }

    Best regards,
    Jordan Shannon

    #816880

    Hello, i added the code to the single.php of the single.php (it is only available in the enfold main theme).
    But it looks like before for the functions.php.
    See here: https://www.th-photography.net/wp-content/uploads/2017/07/newsletter3.jpeg

    Here also the code in the single.php:

    <?php
    	if ( !defined('ABSPATH') ){ die(); }	
    	global $avia_config;
    	/*
    	 * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
    	 */
    	 get_header();
    	$title  = __('Blog - Latest News', 'avia_framework'); //default blog title
    	$t_link = home_url('/');
    	$t_sub = "";
    	if(avia_get_option('frontpage') && $new = avia_get_option('blogpage'))
    	{
    		$title 	= get_the_title($new); //if the blog is attached to a page use this title
    		$t_link = get_permalink($new);
    		$t_sub =  avia_post_meta($new, 'subtitle');
    	}
    	if( get_post_meta(get_the_ID(), 'header', true) != 'no') echo avia_title(array('heading'=>'strong', 'title' => $title, 'link' => $t_link, 'subtitle' => $t_sub));	
    	do_action( 'ava_after_main_title' );
    ?>
    		<div class='container_wrap container_wrap_first main_color <?php avia_layout_class( 'main' ); ?>'>
    			<div class='container template-blog template-single-blog '>
    				<main class='content units <?php avia_layout_class( 'content' ); ?> <?php echo avia_blog_class_string(); ?>' <?php avia_markup_helper(array('context' => 'content','post_type'=>'post'));?>>
                        <?php
                        /* Run the loop to output the posts.
                        * If you want to overload this in a child theme then include a file
                        * called loop-index.php and that will be used instead.
                        *
                        */
                            get_template_part( 'includes/loop', 'index' );		
                            //show related posts based on tags if there are any
                            get_template_part( 'includes/related-posts');
                            //wordpress function that loads the comments template "comments.php"
                            comments_template();
                        ?>
    				<!--end content-->
    				</main>
    <?php
    add_action('ava_before_footer', 'ava_before_footer_mod', 10);
    function ava_before_footer_mod() {
      echo do_shortcode("[email-subscribers namefield=”NO” desc=\"Du willst künftig keinen Artikel mehr auf T.H. Photography verpassen? Dann trag dich gleich für die E-Mail Beitragsbenachrichtigung ein!\" group=”Public”]");
    }
    ?>
    				<?php
    				$avia_config['currently_viewing'] = "blog";
    				//get the sidebar
    				get_sidebar();
    				?>
    			</div><!--end container-->
    		</div><!-- close default .container_wrap element -->
    <?php get_footer(); ?>

    Is it also possible, to have a header over the displayed text line?
    Header text: E-Mail Benachrichtigung

    Thanks in advance.

    #816933

    Hi,

    Did you also add the css to style it?

    Best regards,
    Jordan Shannon

    #817349

    Hello,

    when adding the css it looks like this: https://www.th-photography.net/wp-content/uploads/2017/07/newsletter4.jpeg

    So it is still not in place…

    Thanks,
    Torsten

    #817353

    Hi,

    Not in place as far as it being to far left? If that’s the case adjust that 180 figure on the margin. Or, is it not on the right spot on the page as far as structure?

    .es_shortcode_form{
        width: 900px;
        margin: 10px 180px;
        border: 1px solid black;
        padding: 20px;
    }

    Best regards,
    Jordan Shannon

Viewing 16 posts - 1 through 16 (of 16 total)
  • You must be logged in to reply to this topic.