Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End WordPress plugin 'get custom content'; missing default content option

  • This topic is empty.
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #191451
    chas.
    Participant

    This plugin does a nice job of inserting custom content based on URL variables. There is not a functional method of inserting default content when no such variable exists. This is on a self-hosted wordpress installation, version 4.1

    #191452
    Alen
    Participant

    I’m away from my computer and don’t have access to try this plugin out. But if you could explain what the issue is in greater detail, I can try helping out. Question too vague.

    #191479
    chas.
    Participant

    Sorry for the original brevity… in the plugin you set variables and values. For testing purposes, I’m using this page: http://marineagency.com/testing/

    For the variable utm_source and matching value skin_inc, the result correctly displays a trackable phone number for this print advertising campaign.

    If someone clicks on an ad with the embedded link http://marineagency.com/testing/?utm_source=skin_inc, the target page displays a phone number associated with this campaign. I’m trying to get a default number to display if no such variable is present in the URL (if they navigate directly to http://marineagency.com/testing/).

    #191480
    Paulie_D
    Member

    @njveganicloud-com

    You might want to update your profile to show a different user name as your email address is now out in the wild.

    #191527
    Alen
    Participant

    Hopefully following series of images is helpful

    Create Variable ( example.com/?variable=value )

    Larger Version

    Create Values and assign them to specified variable

    Larger Version


    Larger Version

    Now test to see if you’re getting the correct values (Using Widgets here)
    http://farm8.staticflickr.com/7461/16089550072_b84cc8ec94_b.jpg” />
    Larger Version


    Larger Version

    Here’s written directions. This might help as well if you’re planning on using shortcodes directly in your templates.

    Hope that helps.

    -Alen

    #191529
    Alen
    Participant

    @Paulie_D my post disappeared. Too many links in the post.

    #191532
    chas.
    Participant

    @Paulie_D thanks!

    #191533
    chas.
    Participant

    @Alen , will watch for your response to appear… thanks for trying.

    #191537
    Senff
    Participant

    @Alen’s post approved, see above.

    #191538
    Alen
    Participant

    I’m afraid to edit the messed up image tag up there and getting my post banned again. :)

    #191541
    chas.
    Participant

    @Alen, yes I’ve got those parts sorted already.

    If navigating to ( example.com/?variable=value ) everything works as expected (the desired text is displayed).

    However, navigating to ( example.com/ ) with no variable/value pair results in no text displayed. I need to devise a way to display a default text in case of no variable/value pair.

    #191542
    Alen
    Participant

    In your template do:

    if ( !isset( $_GET['utm_source'] ) ) {
      echo 'Some Default Data';
    }
    else {
      echo do_shortcode('[bg_gcc variable="utm_source"]');
    }
    

    Tested and working.

    #191544
    chas.
    Participant

    Thanks – looks like that was the missing piece. Will test later.

Viewing 13 posts - 1 through 13 (of 13 total)
  • The forum ‘Back End’ is closed to new topics and replies.