0
Welcome Guest! Login
0 items Join Now

php pagination code

    • Mazalien's Avatar
    • Mazalien
    • Rocketeer
    • Posts: 61
    • Thanks: 0
    • Economist

    php pagination code

    Posted 5 years 6 months ago
    • Hello All

      I want to use the pluging wp-pagenavi from lester for wordpress I use the theme photon because it gives nice navigation with an array of page numbers like: <- prev 1 2 3 4 5 6 next -> on a single blog page. Since there is also gantry I want to know where to put
      <?php wp_pagenavi(); ?>

      Where do I put the php code?
      Does anybody know?

      Earlier I found this gantry code:


      {% if post.prev.link %}
          <a href="{{ post.prev.link }}">&larr; {{ post.prev.title }}</a>
      {% endif %}
      
      {% if post.next.link %}
          <a href="{{ post.next.link }}">{{ post.next.title }} &rarr;</a>
      {% endif %}

      but the result is not with numbers see this on the page :

      weblog.mazalien.nl/2018/09/08/faces-of-india/

      or do uou know a better way? tnx
    • Above us only sky....
    • Matt's Avatar
    • Matt
    • Preeminent Rocketeer
    • Posts: 21506
    • Thanks: 3082
    • messin' with stuff

    Re: php pagination code

    Posted 5 years 6 months ago
    • If the plugin provides a Widget to position the Navigation elements then you can simply use a Widget Instance or Position Particle to load it on your layout.

      We use TWIG as opposed to PHP to render our WordPress Content Templates so you cannot place PHP Code into the the template file that renders WordPress content pages
    • SEARCH the forum first! These boards are rich in knowledge and vast in topics. This includes searching just the 'Solved' forums, using Google, and using ChatGPT :woohoo:
    • Mazalien's Avatar
    • Mazalien
    • Rocketeer
    • Posts: 61
    • Thanks: 0
    • Economist

    Re: php pagination code

    Posted 5 years 6 months ago
    • Ok tnx no php then:)- but do you have twig code available to get somthing like : <- prev 1 2 3 4 5 6 next ->


      Or how can I alter this:


          {% if post.prev.link %}
              <a href="{{ post.prev.link }}">&larr; {{ post.prev.title }}</a>
          {% endif %}
           
          {% if post.next.link %}
              <a href="{{ post.next.link }}">{{ post.next.title }} &rarr;</a>
          {% endif %}

      to get the numbers in between post.prev and post.next ?
      if not no worries.

      tnx
    • Above us only sky....
    • Matt's Avatar
    • Matt
    • Preeminent Rocketeer
    • Posts: 21506
    • Thanks: 3082
    • messin' with stuff

    Re: php pagination code

    Posted 5 years 6 months ago
    • try like this in a Custom Particle beneath your Content Particle on whatever Outline renders your Single Blog Posts and make sure you click the Process Twig checkbox in the Particle
      {% set post = wordpress.call('Timber::get_post') %}
      
          {% if post.prev.link %}
              <a href="{{ post.prev.link }}">&larr; {{ post.prev.title }}</a>
          {% endif %}
           
          {% if post.next.link %}
              <a href="{{ post.next.link }}">{{ post.next.title }} &rarr;</a>
          {% endif %}
      docs.gantry.org/gantry5/advanced/content-in-particles
    • Last Edit: 5 years 6 months ago by Matt.
    • SEARCH the forum first! These boards are rich in knowledge and vast in topics. This includes searching just the 'Solved' forums, using Google, and using ChatGPT :woohoo:

Time to create page: 0.052 seconds