<p>Correct me if iam wrong but cant you just use the ElementCriteriaModel. Essentially because you are looking for an element type using that will give you much more flexibility - bassicly it is a query builder on roids. </p>

<pre><code>    $criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);

    // Enter in params. here you can enter your sectionId
    $criteria-&gt;section = 'stories';
    $criteria-&gt;title   = 'Story One';
    $entries = $criteria-&gt;find();
</code></pre>

<p>This will return an array of all the entries that match this criteria. Ofcourse because this is craft you can thus enter a whole lot of other params and do some fancy stuff e.t.c.. </p>

<p>I'll add two links at the bottom that are good reads on the subject:</p>

<p><a href="https://craftcms.com/docs/plugins/working-with-elements" rel="nofollow noreferrer">https://craftcms.com/docs/plugins/working-with-elements</a></p>

<p><a href="https://tighten.co/blog/craft-cms-building-complex-queries-by-extending-the-elementcriteriamodel" rel="nofollow noreferrer">https://tighten.co/blog/craft-cms-building-complex-queries-by-extending-the-elementcriteriamodel</a></p>

CC BY-SA 3.0
2018-03-25T18:36:01.717Z
Will give this a shot tomorrow at work. Ill mark it as correct if it works.
Dan Zuzevich
CC BY-SA 3.0
2018-03-26T11:15:29.860Z
Winner winner, chicken dinner. Thanks for the help!
Dan Zuzevich
CC BY-SA 3.0
2018-03-26T13:05:44.770Z
Glad i could help! Good luck with the project :)!
Gįëł Tėttëłæår
CC BY-SA 3.0
2018-03-25T13:19:10.237Z
2018-03-25T13:19:10.237Z
Gįëł Tėttëłæår
<p>I am attempting to get a specific entries id from within a specific section. I have looked around, and clearly have not found anything yet.</p>

<p>To clarify, lets say we have a section called "Stories", which is a <em>structure</em>. Inside of "Stories" there is a specific entry named, "Story One" that I would like to retrieve the id of.</p>

<p>I can pretty much get as far as getting the contents of the Stories structure via:</p>

<pre><code>$entry = craft()-&gt;sections-&gt;getSectionByHandle('stories');
</code></pre>

<p>The important piece here, is that I want to find the "Story One" entry id. Reason being is that it looks like you can't do relatedTo queries via the title of an entry, but you need the id.</p>

<entries>
How to get specific entries id
# How to get specific entries id

(Asked by: username_0 on 2018-03-24)

I am attempting to get a specific entries id from within a specific section. I have looked around, and clearly have not found anything yet.
To clarify, lets say we have a section called "Stories", which is a structure. Inside of "Stories" there is a specific entry named, "Story One" that I would like to retrieve the id of.
I can pretty much get as far as getting the contents of the Stories structure via:
$entry = craft()->sections->getSectionByHandle('stories');

The important piece here, is that I want to find the "Story One" entry id. Reason being is that it looks like you can't do relatedTo queries via the title of an entry, but you need the id.

**Tags:** entries

---

## 1 answers

### Answer by username_1 on 2018-03-25. Score: 3 | Accepted answer

Correct me if iam wrong but cant you just use the ElementCriteriaModel. Essentially because you are looking for an element type using that will give you much more flexibility - bassicly it is a query builder on roids. 
    $criteria = craft()->elements->getCriteria(ElementType::Entry);

    // Enter in params. here you can enter your sectionId
    $criteria->section = 'stories';
    $criteria->title   = 'Story One';
    $entries = $criteria->find();

This will return an array of all the entries that match this criteria. Ofcourse because this is craft you can thus enter a whole lot of other params and do some fancy stuff e.t.c.. 
I'll add two links at the bottom that are good reads on the subject:
https://craftcms.com/docs/plugins/working-with-elements
https://tighten.co/blog/craft-cms-building-complex-queries-by-extending-the-elementcriteriamodel

> **Comments:**
> **username_0**: Will give this a shot tomorrow at work. Ill mark it as correct if it works.  
> **username_0**: Winner winner, chicken dinner. Thanks for the help!  
> **username_1**: Glad i could help! Good luck with the project :)!  

---

