I would like to know how I can loop through pages with a specific template name. I have several pages where the admin can select a template name of SALE. I want to display all content with this template name via the loop.   Any ideas are much appreciated!
122699
I want to know if it's possible to get the ID of a page with a specific template. Is this possible to get the ID of a page that assigned to "page-special.php"?
14390
What is Drupal 8 file pattern name for a specified content type?  Suppose I have  a Movie content type. What is the pattern name for its page? Is it page--node--movie.html.twig?
101683
How can i get a list of all custom post types registered and show them on any template page.  I have code like this.  &lt;?php      /**      * Template Name: Custom Post Types List      */      get_header();      $args=array(         'public'                =&gt; true,         'exclude_from_search'   =&gt; false,         '_builtin'              =&gt; false     );       $output = 'names'; // names or objects, note names is the default     $operator = 'and'; // 'and' or 'or'     $post_types = get_post_types($args,$output,$operator);      $posttypes_array = array();      foreach ($post_types  as $post_type ) {         $posttypes_array[] = $post_type;     }      echo "&lt;pre&gt;";     print_r($posttypes_array);     echo "&lt;/pre&gt;";      get_footer();  ?&gt;
66704
Example: I want to get all tag names that are inside field_tags of node 5.  I can get the target_id with $node->field_tags->;     But the problem is, I don't know what entity the target_id value belongs to. Could be a node id, term id, user id. Without that info, I am not able to use the target_id to get the name of the tag.   How can I get all the names of an entity reference field?
20811
I have an HTML page with multiple checkboxes.  I need one more checkbox by the name "select all". When I select this checkbox all checkboxes in the HTML page must be selected. How can I do this?
81726
I have problem to understand how I should use theme('pager') as explained on .  I can't make it work (display pager and links to resulting pages).  Does pager(10) in EntityFieldQuery automatically invoke the pager? Should it be displayed with print(theme('pager'))?  Is this functionality included in Drupal core (7.15)?  I am doing my queries in template.php and injecting the query result in article.tpl.php through a variable.  As a workaround, I am thinking of doing two queries, one to find out what the number of nodes that meet a condition is, output links with numbering, attach the variable to those links, read the variable in another query and select the resulting nodes with range($i,$j).
93572
How can I implement pagination like shown in the title perhaps something similar to most sites
48488
I'm thinking in particular of how to display pagination controls, when using a language such as C# or Java.  If I have x items which I want to display in chunks of y per page, how many pages will be needed?
22600
I have a category page that leads to an additional 100 pages. For example:  www.example.com/category &lt;- this is my category page   www.example.com/category-2.html &lt;- this is paginated content  My question is, do I need unique meta tags for each and every page, or is there any way that my category page's meta tags can be used by all the numbered pages?
27809
I am building a custom (child) theme and I want to style the first post of my loop in a different way than the others (bigger image, different position of some stuff).   Which is the best way of doing it? My "problem" is that my theme has support for different post types and the style would vary depending on the type of content, so I want to avoid repeating code as much as possible (i.e. using a function).   As I am a bit more used to OOP, my ideal scenario would be passing a variable to the view and check it in the loop of each content-type (that way I can re-use most of the code from the TwentyEleven templates). From what I know, that is not possible (please correct me if I am wrong).   For now, what I do is this:  function electric_index_loop($readMore = 0) {  $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array(     //Excluimos los "miniposts" (citas, estados, enlaces...) del listado     'tax_query' =&gt; array(         array(             'taxonomy' =&gt; 'post_format',             'field' =&gt; 'slug',             'terms' =&gt; array('post-format-aside', 'post-format-link',                 'post-format-status', 'post-format-quote'),             'operator' =&gt; 'NOT IN'         )     ),     'posts_per_page' =&gt; 5,     'paged' =&gt; $paged );  // The Query query_posts($args);  // The Loop if (have_posts()) {     $post_count = 0;     global $more;     $more = $readMore; // 0 fuerza que se muestre sólo el "excerpt", 1 fuerza que se muestre todo el contenido     twentyeleven_content_nav('nav-above');     while (have_posts()) {         the_post();         if ($post_count == 0) {             get_template_part('highlight', get_post_format());         } else {             get_template_part('content', get_post_format());         }         $post_count++;     } } else {     ?&gt;     &lt;article id="post-0" class="post no-results not-found"&gt;         &lt;header class="entry-header"&gt;             &lt;h1 class="entry-title"&gt;&lt;?php _e('Nothing Found', 'twentyeleven'); ?&gt;&lt;/h1&gt;         &lt;/header&gt;&lt;!-- .entry-header --&gt;          &lt;div class="entry-content"&gt;             &lt;p&gt;&lt;?php _e('Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven'); ?&gt;&lt;/p&gt;             &lt;?php get_search_form(); ?&gt;         &lt;/div&gt;&lt;!-- .entry-content --&gt;     &lt;/article&gt;&lt;!-- #post-0 --&gt;     &lt;?php } wp_reset_query();}   As you see, I check the counter in the loop that I create in the function and ,if the current post is the first, I load a different template ("highlight").  I'd have to create different templates for the different types of content (which, in some cases sucks, because I can get all I need in some cases with just a CSS class).   Well, is there a better way of doing these? Perhaps a hook or something?   Thanks in advance!
96555
i create a custom page to display loop of cpt with custom field.   I need to add a numberic pagination and i try with this code but not work.  Functions.php  function pagination_bar() {     global $wp_query;      $total_pages = $wp_query-&gt;max_num_pages;      if ($total_pages &gt; 1){         $current_page = max(1, get_query_var('paged'));          echo paginate_links(array(             'base' =&gt; get_pagenum_link(1) . '%_%',             'format' =&gt; '/page/%#%',             'current' =&gt; $current_page,             'total' =&gt; $total_pages,         ));     } }   custompage.php  &lt;!--Loop Salmi--&gt; &lt;?php $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; $loop = new WP_Query( array( 'post_type' =&gt; 'salmi',         'posts_per_page' =&gt; 15,         'paged'          =&gt; $paged ) ); while ( $loop-&gt;have_posts() ) : $loop-&gt;the_post(); ?&gt;      &lt;!--Colonne Contenuto --&gt;     &lt;div class="salmicpt"&gt;         &lt;div class="wpb_column vc_column_container td-pb-span8"&gt;             &lt;div class="titlecpt"&gt;&lt;?php the_title(); ?&gt;&lt;/div&gt;         &lt;/div&gt;         &lt;div class="wpb_column vc_column_container td-pb-span4"&gt;             &lt;?php if( get_field('audio_salmi') ): ?&gt;                 &lt;a href="&lt;?php the_field('audio_salmi'); ?&gt;" &gt;&lt;img src="mysite.com/wp-content/uploads/cuffia-cpt-e1481533293805.png" alt="Ascolta" title="Ascolta" /&gt;&lt;/a&gt;             &lt;?php endif; ?&gt;             &lt;?php if( get_field('salmi_pdf') ): ?&gt;                 &lt;a href="&lt;?php the_field('salmi_pdf'); ?&gt;" &gt;&lt;img src="mysite.com/wp-content/uploads/freccia-32.png" alt="Scarica il PDf" title="Scarica il PDF" /&gt;&lt;/a&gt;             &lt;?php endif; ?&gt;         &lt;/div&gt;         &lt;div style='clear:both'&gt;&lt;/div&gt;&lt;hr class="style-one" /&gt;     &lt;/div&gt;     &lt;nav class="pagination"&gt;         &lt;?php pagination_bar(); ?&gt;     &lt;/nav&gt;  &lt;?php endwhile; wp_reset_query(); ?&gt;    Where is wrong?? Thanks
5401
I'm trying to define a custom template file for a specific node, using the node ID. I read a lot of topics saying to create a node--X.tpl.php file in the templates folder.  That's what I did; unfortunately, even after flushing the theme cache many times, nothing changes.  Is there anything more I have to do?  I am using Drupal 7.
52263
I would like to query only pages with a certain page template with WP_Query or a function that would return the post object, but I can't find any information about that on the official codex.
111973
I would like to include the section name of the page's displayed section in my header tags in the fancyhdr package, something like  \fancyhf[HR]{SECTION NAME} \fancyhf[HL]{SUBSECTION NAME}   How can I go about doing this?
101680
If I want to show the current node title in page.html.twig (by default it seems to only be available in node.html.twig) I have to create a preprocess function like so:  function theme_preprocess_page(&amp;$variables, $hook) {   // Set our page title so we can access it in page.html.twig   if ($node = \Drupal::routeMatch()-&gt;getParameter('node')) {     $variables['my_node_title'] = $node-&gt;title-&gt;value;   } }   And then I have to overwrite page-title.html.twig by copying it into my current theme folder and commenting out everything.  This doesn't seem "right".  Is there a better way?
56333
I would like to remove page numbering on a specific page. However, the header and footer should remain intact. If I try:  \thispagestyle{empty}   The header and footer disappear. What is the recommended way of removing just the page number?
75322
I'm developing some plugin where I would like to enable custom pages. In my case some custom page would contain a form like contact form (not literally). When user will fill out this form and send it, there should be the next step which will require more information. Lets say that the first page with form would be located at www.domain.tld/custom-page/ and after successful form submission, the user should be redirected to www.domain.tld/custom-page/second. Template with HTML elements and PHP code should be also custom.  I think that a part of the problem is possible to achieve with custom URL rewrites, but the other parts are currently unknown to me. I really don't know where should I start looking and what's the correct naming for that problem. Any help would be really appreciated.