Tagged: 

Viewing 5 reply threads
  • Author
    Posts
    • #1805
      s1r0n
      Member

      I am trying to create a widget. I seem to be able to do that however under the “available widgets” screen, the plugin widget appears as a blank box. I have the following code in the

      global-scholar-article.php file

      <?php
      /*
      Title: Global Scholar Article
      Description: Output article information, social links, etc.
      */
      ?>
      <?php echo $before_widget; ?>
       
      <?php echo $before_title; ?>
       
      <?php echo $after_title; ?>
       
      <?php echo 'Put some stuff here';
      
      ?>
      
      <?php echo $after_widget; ?>
      
      

      Screen cap

    • #1806
      Steve
      Keymaster

      This code sample looks like a Widget OUTPUT file. It looks like you have a Widget SETTINGS file saved as well that is causing the widget to display that field. You can learn more about Widgets here >

    • #1808
      s1r0n
      Member

      ya. i read that. something is not right though. As you can see in the screenshot the widget itself is just a blank box. When I add the widget to a sidebar I get a dropdown to select the widget. when I add and save, the widget does not provide any output, even though it probably should, I think.

      here is the code for global-scholar-article-form.php

      <?php
      /*
      Title: Global Scholar Article Widget
      Description: Output article information, social links, etc.
      */
      
      piklist('field', array(
        'type' => 'text'
        ,'field' => 'article_widget_title'
        ,'label' => 'Title'
        ,'description' => 'Title'
        ,'value' => 'Global Scholar'
        ,'attributes' => array(
          'class' => 'text'
        )
      ));
      
      ?>
      

      and here is the code for global-scholar-article.php

      <?php
      /*
      Title: Global Scholar Article Widget
      Description: Output article information, social links, etc.
      */
      ?>
      <?php echo $before_widget; ?>
       
      <?php echo $before_title; ?>
       
      <?php echo $after_title; ?>
       
      <?php echo 'Put some stuff here';
      
      ?>
      
      <?php echo $after_widget; ?>
      
      
    • #1809
      Steve
      Keymaster

      You are outputting “put some stuff here”. Replace it with <?php echo $settings['article_widget_title']; ?>

    • #1810
      s1r0n
      Member

      Still get nothing. nothing it getting output. and the title and description of the widget are not showing up 🙁

    • #1813
      Steve
      Keymaster

      @s1r0n– This works for me:

      FILE: global-scholar-article.php

      <?php
      /*
      Title: Global Scholar Article Widget
      Description: Output article information, social links, etc.
      */
      ?>
      <?php echo $before_widget; ?>
       
      <?php echo $before_title; ?>
      
      <?php echo $settings['article_widget_title']; ?>
      
      <?php echo $after_title; ?>
       
      <?php echo $after_widget; ?>
Viewing 5 reply threads
  • The topic ‘Widget’ is closed to new replies.