Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

link homepage images to respective categories #10

Closed
jessicasalmon opened this issue Nov 8, 2016 · 2 comments
Closed

link homepage images to respective categories #10

jessicasalmon opened this issue Nov 8, 2016 · 2 comments

Comments

@jessicasalmon
Copy link
Owner

No description provided.

@jessicasalmon
Copy link
Owner Author

solution:

<?php
  //Get the ID of a given category
  $category_id = get_cat_ID( 'My Life As a Background Slytherin' );

  // Get the URL of this category
  $category_link = get_category_link( $category_id );
?> 

<!-- Print a link to this category -->
<a href="<?php echo esc_url( $category_link ); ?>" title="My Life As a Background Slytherin">
  <img class="homepage-image" src="<?= get_template_directory_uri()?>/assets/homepage-images/1-slytherin-600x600px.png" />
</a>

comments on solution:

would benefit from being fully dynamic so that Emily can add new categories herself. Open new issue

@jessicasalmon
Copy link
Owner Author

issue #11 opened for making front-page.php fully dynamic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant